GoodscommentModel.class.php 5.0 KB

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