|
@@ -0,0 +1,95 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | ThinkAdmin
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | 官方网站: http://demo.thinkadmin.top
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | 开源协议 ( https://mit-license.org )
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
|
|
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+
|
|
|
+namespace app\store\controller;
|
|
|
+
|
|
|
+use library\Controller;
|
|
|
+use library\tools\Data;
|
|
|
+use think\Db;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 评论列表
|
|
|
+ * Class GoodsCate
|
|
|
+ * @package app\store\controller
|
|
|
+ */
|
|
|
+class Comment extends Controller
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * 绑定数据表
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $table = 'StoreComment';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 评论管理
|
|
|
+ * @auth true
|
|
|
+ * @menu true
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function index()
|
|
|
+ {
|
|
|
+ $goods_id = input('goods_id');
|
|
|
+ if(empty($goods_id)){
|
|
|
+ $this->error('非法操作');
|
|
|
+ }
|
|
|
+ $this->title = '评论列表管理';
|
|
|
+ $query = $this->_query($this->table);
|
|
|
+ $where[]=['a.status','=',1];
|
|
|
+ $where[]=['a.forum_id','=',$goods_id];
|
|
|
+ $where[]=['a.forum_type','=',1];
|
|
|
+ if($this->request->request('phone')){
|
|
|
+ $where[]=['m.phone','like','%'.$this->request->request('phone').'%'];
|
|
|
+ }
|
|
|
+ if($this->request->request('name')){
|
|
|
+ $where[]=['m.name','like','%'.$this->request->request('name').'%'];
|
|
|
+ }
|
|
|
+ if($this->request->request('content')){
|
|
|
+ $where[]=['a.content','like','%'.$this->request->request('content').'%'];
|
|
|
+ }
|
|
|
+ $query
|
|
|
+ ->alias('a')
|
|
|
+ ->join('store_member m','a.user_id = m.id')
|
|
|
+ ->where($where)
|
|
|
+ ->order('a.id desc')
|
|
|
+ ->page();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**需求列表处理
|
|
|
+ * @param array $data
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ protected function _index_page_filter(array &$data)
|
|
|
+ {
|
|
|
+ $mids = array_unique(array_merge(array_column($data, 'user_id'), array_column($data, 'from_mid')));
|
|
|
+ $memberList = Db::name('StoreMember')->whereIn('id', $mids)->select();
|
|
|
+ foreach ($data as &$vo) {
|
|
|
+ if($vo['images']){
|
|
|
+ $vo['images'] = image_path($vo['images']);
|
|
|
+ }
|
|
|
+ list($vo['member'], $vo['from_member'], $vo['list']) = [[], [], []];
|
|
|
+
|
|
|
+ foreach ($memberList as $member) if ($member['id'] === $vo['user_id']) {
|
|
|
+ $vo['member'] = $member;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|