store['user']); $model = new CommentModel; $postData = $this->postData(); $where[] = ['status', '=', 0]; if(!empty($shop_supplier_ids)){ $postData["shop_supplier_ids"] = $shop_supplier_ids; $where[] = ['shop_supplier_id', 'in', $shop_supplier_ids]; //列表 $list = $model->getList($postData); //重要数据 $num = $model->getStatusNum($where); }else{ $list = ['current_page'=>1,'data'=>[],'per_page'=>15,'total'=>0]; $num = 0; } return $this->renderSuccess('', compact('list','num')); } /** * 评价详情 */ public function detail($comment_id) { // 评价详情 $data = CommentModel::detail($comment_id); return $this->renderSuccess('', compact('data')); } /** * 更新商品评论 */ public function edit($comment_id) { $model = CommentModel::detail($comment_id); // 更新记录 if ($model->edit($this->postData())) { (new CommentModel)->updateScore($model['shop_supplier_id']); return $this->renderSuccess('修改成功'); } return $this->renderError('修改失败'); } /** * 删除评价 */ public function delete($comment_id) { $model = new CommentModel(); if (!$model->setDelete($comment_id)) { return $this->renderError('删除失败'); } return $this->renderSuccess('删除成功'); } }