ShippingModel.class.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Seller\Model;
  15. class ShippingModel{
  16. public function update($data)
  17. {
  18. $ins_data = array();
  19. $ins_data['name'] = $data['name'];
  20. $ins_data['type'] = $data['type'];
  21. $ins_data['sort_order'] = $data['sort_order'];
  22. $ins_data['firstprice'] = $data['default_firstprice'];
  23. $ins_data['secondprice'] = $data['default_secondprice'];
  24. $ins_data['firstweight'] = $data['default_firstweight'];
  25. $ins_data['secondweight'] = $data['default_secondweight'];
  26. $ins_data['areas'] = serialize($data['areas']);
  27. $ins_data['firstnum'] = $data['default_firstnum'];
  28. $ins_data['secondnum'] = $data['default_secondnum'];
  29. $ins_data['firstnumprice'] = $data['default_firstnumprice'];
  30. $ins_data['secondnumprice'] = $data['default_secondnumprice'];
  31. $ins_data['isdefault'] = $data['isdefault'];
  32. if ($data['isdefault']) {
  33. M('lionfish_comshop_shipping')->save( array('isdefault' => 0) );
  34. }
  35. if (!empty($data['id'])) {
  36. M('lionfish_comshop_shipping')->where( array('id' => $data['id'] ) )->save( $ins_data );
  37. }
  38. else {
  39. $id = M('lionfish_comshop_shipping')->add( $ins_data );
  40. }
  41. }
  42. }
  43. ?>