PickupModel.class.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 PickupModel{
  16. public function show_pickup_page($search = array()){
  17. $where = array();
  18. if(!empty($search) && isset($search['store_id'])) {
  19. $where['store_id'] = $search['store_id'];
  20. }
  21. $count=M('pick_up')->where($where)->count();
  22. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  23. $show = $Page->show();// 分页显示输出
  24. $list = M('pick_up')->where($where)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
  25. return array(
  26. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  27. 'list'=>$list,
  28. 'page'=>$show
  29. );
  30. }
  31. public function show_pickup_member_page( $search = array() )
  32. {
  33. $where = array();
  34. if(!empty($search) && isset($search['store_id'])) {
  35. $where['store_id'] = $search['store_id'];
  36. }
  37. if(!empty($search) && isset($search['pick_up_id'])) {
  38. $where['pick_up_id'] = $search['pick_up_id'];
  39. }
  40. //
  41. $count=M('pick_member')->where($where)->count();
  42. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  43. $show = $Page->show();// 分页显示输出
  44. $list = M('pick_member')->where($where)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
  45. foreach( $list as $key => $val )
  46. {
  47. if( $val['pick_up_id'] == 0)
  48. {
  49. $val['pick_name'] = '<span class="red">所有店铺</span>';
  50. }else{
  51. $pick_up_info = M('pick_up')->field('pick_name')->where( array('id' => $val['pick_up_id']) )->find();
  52. $val['pick_name'] = $pick_up_info['pick_name'];
  53. }
  54. $pick_order_count = M('pick_order')->where( array('pick_member_id' => $val['member_id']) )->count();
  55. //name
  56. $val['pick_order_count'] = $pick_order_count;
  57. $val['member_info'] = M('member')->field('name,avatar')->where( array('member_id' => $val['member_id']) )->find();
  58. $list[$key] = $val;
  59. }
  60. return array(
  61. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  62. 'list'=>$list,
  63. 'page'=>$show
  64. );
  65. }
  66. }
  67. ?>