| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace app\admin\controller\service\order;
- use app\common\controller\Backend;
- use think\Db;
- /**
- * 评论管理
- *
- * @icon fa fa-circle-o
- */
- class Comment extends Backend
- {
- /**
- * Comment模型对象
- * @var \app\admin\model\service\order\Comment
- */
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\service\order\Comment;
- $this->view->assign("stateList", $this->model->getStateList());
- }
- public function index()
- {
- //设置过滤方法
- $this->request->filter(['strip_tags', 'trim']);
- if (false === $this->request->isAjax()) {
- return $this->view->fetch();
- }
- //如果发送的来源是 Selectpage,则转发到 Selectpage
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- [$where, $sort, $order, $offset, $limit] = $this->buildparams();
- $list = $this->model
- ->where($where)
- ->order($sort, $order)
- ->paginate($limit);
- foreach ($list as &$val)
- {
- $val->user = db('user')->where('id',$val->user_id)->field('avatar,nickname,mobile')->find();
- $val->skill = $val->skill_id?db('service_skill')->field('name,mobile,image')->where('id',$val->skill_id)->find():'';
- $val->shop = $val->shop_id?db('service_shop')->where('id',$val->shop_id)->field('name,abbr,logo_image,leader_name,leader_mobile')->find():'';
- $val->goodsname = db('service_order_detail')->where('order_id',$val->order_id)->value('name');
- }
- $result = ['total' => $list->total(), 'rows' => $list->items()];
- return json($result);
- }
- }
|