GoodscommentModel.class.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <?php
  2. /**nanodreamtech.com
  3. * 小梦科技资源nanodreamtech.com
  4. * @author fish
  5. *
  6. */
  7. namespace Seller\Model;
  8. class GoodscommentModel{
  9. public function show_comment_page($search = array()){
  10. $sql='SELECT * FROM '.C('DB_PREFIX').'order_comment where 1= 1 ';
  11. if(isset($search['goods_id']))
  12. {
  13. $sql.=" and goods_id=".$search['goods_id'];
  14. }
  15. /**
  16. $search['goods_name'] = $name;
  17. }
  18. if( !empty($order_num_alias) )
  19. {
  20. $search['order_num_alias'] = $order_num_alias;
  21. **/
  22. if( isset($search['goods_name']) && !empty($search['goods_name']) )
  23. {
  24. $sql.=" and goods_name like '%".$search['goods_name']."%'";
  25. }
  26. if( isset($search['order_num_alias']) && !empty($search['order_num_alias']) )
  27. {
  28. $sql.=" and order_num_alias like '%".$search['order_num_alias']."%'";
  29. }
  30. $count=count(M()->query($sql));
  31. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  32. $show = $Page->show();// 分页显示输出
  33. $sql.=' order by state asc,add_time desc LIMIT '.$Page->firstRow.','.$Page->listRows;
  34. $list=M()->query($sql);
  35. foreach($list as $key => $val)
  36. {
  37. // goods_id name image
  38. if(empty($val['goods_name']))
  39. {
  40. $goods_info = M('goods')->field('goods_id,name,image')->where( array('goods_id' => $val['goods_id']) )->find();
  41. $val['goods_name'] = $goods_info['name'];
  42. $val['goods_image'] = $goods_info['image'];
  43. M('order_comment')->where( array('comment_id' => $val['comment_id']) )
  44. ->save( array('goods_name' =>$val['goods_name'],'goods_image' =>$val['goods_image'] ) );
  45. }
  46. //member_id order_comment order_id
  47. if(empty($val['order_num_alias']))
  48. {
  49. $order_info = M('order')->field('order_num_alias')->where( array('order_id' => $val['order_id']) )->find();
  50. $val['order_num_alias'] = $order_info['order_num_alias'];
  51. M('order_comment')->where( array('comment_id' => $val['comment_id']) )
  52. ->save( array('order_num_alias' =>$val['order_num_alias'] ) );
  53. }
  54. if(empty($val['user_name']))
  55. {
  56. $member_info = M('member')->field('name,avatar')->where( array('member_id' => intval($val['member_id'])) )->find();
  57. $val['user_name'] = $member_info['name'];
  58. $val['avatar'] = $member_info['avatar'];
  59. M('order_comment')->where( array('comment_id' => $val['comment_id']) )
  60. ->save( array('user_name' =>$val['user_name'], 'avatar' =>$val['avatar'] ) );
  61. }
  62. $list[$key] = $val;
  63. }
  64. return array(
  65. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  66. 'list'=>$list,
  67. 'page'=>$show
  68. );
  69. /**
  70. $where = array();
  71. if(!empty($search) && isset($search['store_id'])) {
  72. $where['store_id'] = $search['store_id'];
  73. }
  74. $count=M('pick_up')->where($where)->count();
  75. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  76. $show = $Page->show();// 分页显示输出
  77. $list = M('pick_up')->where($where)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
  78. return array(
  79. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  80. 'list'=>$list,
  81. 'page'=>$show
  82. );
  83. **/
  84. }
  85. public function show_pickup_member_page( $search = array() )
  86. {
  87. $where = array();
  88. if(!empty($search) && isset($search['store_id'])) {
  89. $where['store_id'] = $search['store_id'];
  90. }
  91. if(!empty($search) && isset($search['pick_up_id'])) {
  92. $where['pick_up_id'] = $search['pick_up_id'];
  93. }
  94. //
  95. $count=M('pick_member')->where($where)->count();
  96. $Page = new \Think\Page($count,C('BACK_PAGE_NUM'));
  97. $show = $Page->show();// 分页显示输出
  98. $list = M('pick_member')->where($where)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
  99. foreach( $list as $key => $val )
  100. {
  101. if( $val['pick_up_id'] == 0)
  102. {
  103. $val['pick_name'] = '<span class="red">所有店铺</span>';
  104. }else{
  105. $pick_up_info = M('pick_up')->field('pick_name')->where( array('id' => $val['pick_up_id']) )->find();
  106. $val['pick_name'] = $pick_up_info['pick_name'];
  107. }
  108. $pick_order_count = M('pick_order')->where( array('pick_member_id' => $val['member_id']) )->count();
  109. //name
  110. $val['pick_order_count'] = $pick_order_count;
  111. $val['member_info'] = M('member')->field('name,avatar')->where( array('member_id' => $val['member_id']) )->find();
  112. $list[$key] = $val;
  113. }
  114. return array(
  115. 'empty'=>'<tr><td colspan="20">~~暂无数据</td></tr>',
  116. 'list'=>$list,
  117. 'page'=>$show
  118. );
  119. }
  120. }
  121. ?>