PrinterModel.class.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 fld
  12. *
  13. */
  14. namespace Seller\Model;
  15. class PrinterModel{
  16. public function update($data)
  17. {
  18. $ins_data = array();
  19. $ins_data['printer_name'] = $data['printer_name'];
  20. $ins_data['printer_type'] = $data['printer_type'];
  21. $ins_data['api_id'] = $data['api_id'];
  22. $ins_data['api_key'] = $data['api_key'];
  23. if($data['printer_type'] == 1){
  24. $ins_data['printer_sn'] = $data['printer_sn'];
  25. $ins_data['printer_key'] = $data['printer_key'];
  26. }else if($data['printer_type'] == 2){
  27. $ins_data['printer_sn'] = $data['printer_yly_sn'];
  28. $ins_data['printer_key'] = $data['printer_yly_key'];
  29. }
  30. $ins_data['printer_num'] = $data['printer_num'];
  31. $ins_data['status'] = $data['status'];
  32. $id = $data['id'];
  33. if( !empty($id) && $id > 0 )
  34. {
  35. M('lionfish_comshop_printer')->where( array('id' => $id) )->save( $ins_data );
  36. }else{
  37. $ins_data['addtime'] = time();
  38. M('lionfish_comshop_printer')->add($ins_data);
  39. }
  40. }
  41. }
  42. ?>