ExpressModel.class.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * 小梦科技资源nanodreamtech.com
  4. *
  5. *
  6. * @author fish
  7. *
  8. */
  9. namespace Seller\Model;
  10. class ExpressModel{
  11. public function update($data)
  12. {
  13. $ins_data = array();
  14. $ins_data['name'] = $data['name'];
  15. $ins_data['simplecode'] = $data['simplecode'];
  16. $ins_data['customer_name'] = $data['customer_name'];
  17. $ins_data['customer_pwd'] = $data['customer_pwd'];
  18. $id = $data['id'];
  19. if( !empty($id) && $id > 0 )
  20. {
  21. M('lionfish_comshop_express')->where( array('id' => $id) )->save( $ins_data );
  22. }else{
  23. M('lionfish_comshop_express')->add( $ins_data );
  24. }
  25. }
  26. public function get_express_info($id)
  27. {
  28. $info = M('lionfish_comshop_express')->where( array('id' => $id ) )->find();
  29. return $info;
  30. }
  31. public function load_all_express()
  32. {
  33. $where = array();
  34. $list = M('lionfish_comshop_express')->where($where)->field('id, name,simplecode')->order('name')->select();
  35. return $list;
  36. }
  37. public function load_kdn_express()
  38. {
  39. $where = array();
  40. $code_array = array();
  41. $kdn_list = M('lionfish_comshop_kdniao_template')->field('distinct(express_code) as express_code')->select();
  42. foreach($kdn_list as $v){
  43. $code_array[] = $v['express_code'];
  44. }
  45. $where['simplecode'] = array('in', $code_array);
  46. $list = M('lionfish_comshop_express')->where($where)->field('id, name,simplecode')->select();
  47. return $list;
  48. }
  49. public function show_express_page($search = array()){
  50. $where = array();
  51. if(!empty($search) && isset($search['store_id'])) {
  52. $where['store_id'] = $search['store_id'];
  53. }
  54. $count=M('seller_express')->where($where)->count();
  55. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  56. $show = $Page->show();// 分页显示输出
  57. $list = M('seller_express')->where($where)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
  58. return array(
  59. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  60. 'list'=>$list,
  61. 'page'=>$show
  62. );
  63. }
  64. }
  65. ?>