Comment.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace app\mall\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 商品评价
  7. * Class Comment
  8. * @package app\mall\controller
  9. */
  10. class Comment extends Controller
  11. {
  12. /**
  13. * 绑定数据表
  14. * @var string
  15. */
  16. protected $table = 'OrderComment';
  17. /**
  18. * 列表
  19. * @auth true
  20. * @menu true
  21. * @throws \think\Exception
  22. * @throws \think\db\exception\DataNotFoundException
  23. * @throws \think\db\exception\ModelNotFoundException
  24. * @throws \think\exception\DbException
  25. * @throws \think\exception\PDOException
  26. */
  27. public function index()
  28. {
  29. $this->title = '列表';
  30. $where = [];
  31. $where[] = ['c.is_deleted','=',0];
  32. if($good_name = input('goods_name')) $where[] = ['g.name','like','%'.$good_name.'%'];
  33. if($user_name = input('user_name')) $where[] = ['m.name','like','%'.$user_name.'%'];
  34. $query = $this->_query($this->table)
  35. ->field('c.*,m.name user_name,m.headimg,g.cover,g.name goods_name')
  36. ->alias('c')
  37. ->leftJoin('StoreMember m','c.user_id = m.id')
  38. ->leftJoin('StoreGoods g','c.goods_id = g.id')
  39. ->where($where);
  40. $query->order('c.id desc')->page();
  41. }
  42. /**
  43. * 数据列表处理
  44. * @auth true
  45. * @menu true
  46. * @param array $data
  47. * @throws \think\db\exception\DataNotFoundException
  48. * @throws \think\db\exception\ModelNotFoundException
  49. * @throws \think\exception\DbException
  50. */
  51. protected function _index_page_filter(&$data)
  52. {
  53. }
  54. /**
  55. * 删除
  56. * @auth true
  57. * @menu true
  58. * @throws \think\Exception
  59. * @throws \think\exception\PDOException
  60. */
  61. public function del()
  62. {
  63. $this->_save($this->table, ['is_deleted' => 1]);
  64. }
  65. /**
  66. * 表单数据处理
  67. * @auth true
  68. * @menu true
  69. * @param array $data
  70. */
  71. protected function _form_filter(&$data)
  72. {
  73. if($this->request->isGet()){
  74. }
  75. }
  76. }