ExpressModel.class.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 ExpressModel{
  16. public function update($data)
  17. {
  18. $ins_data = array();
  19. $ins_data['name'] = $data['name'];
  20. $ins_data['simplecode'] = $data['simplecode'];
  21. $ins_data['customer_name'] = $data['customer_name'];
  22. $ins_data['customer_pwd'] = $data['customer_pwd'];
  23. $id = $data['id'];
  24. if( !empty($id) && $id > 0 )
  25. {
  26. M('lionfish_comshop_express')->where( array('id' => $id) )->save( $ins_data );
  27. }else{
  28. M('lionfish_comshop_express')->add( $ins_data );
  29. }
  30. }
  31. public function get_express_info($id)
  32. {
  33. $info = M('lionfish_comshop_express')->where( array('id' => $id ) )->find();
  34. return $info;
  35. }
  36. public function load_all_express()
  37. {
  38. $where = array();
  39. $list = M('lionfish_comshop_express')->where($where)->field('id, name,simplecode')->order('name')->select();
  40. return $list;
  41. }
  42. public function load_kdn_express()
  43. {
  44. $where = array();
  45. $code_array = array();
  46. $kdn_list = M('lionfish_comshop_kdniao_template')->field('distinct(express_code) as express_code')->select();
  47. foreach($kdn_list as $v){
  48. $code_array[] = $v['express_code'];
  49. }
  50. $where['simplecode'] = array('in', $code_array);
  51. $list = M('lionfish_comshop_express')->where($where)->field('id, name,simplecode')->select();
  52. return $list;
  53. }
  54. public function show_express_page($search = array()){
  55. $where = array();
  56. if(!empty($search) && isset($search['store_id'])) {
  57. $where['store_id'] = $search['store_id'];
  58. }
  59. $count=M('seller_express')->where($where)->count();
  60. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  61. $show = $Page->show();// 分页显示输出
  62. $list = M('seller_express')->where($where)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
  63. return array(
  64. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  65. 'list'=>$list,
  66. 'page'=>$show
  67. );
  68. }
  69. }
  70. ?>