From dbd56251a9bc12d8560297b14e1f8e4ff33342ba Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Thu, 16 Nov 2023 16:21:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=B7=BB=E5=8A=A0=E5=AE=A1=E6=A0=B8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/store/product/ProductReplyDao.php | 7 ++++- .../admin/store/StoreProductReply.php | 26 ++++++++++++++++++- .../api/store/product/StoreReply.php | 2 ++ route/admin/product.php | 3 +++ route/merchant/product.php | 3 +++ 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/app/common/dao/store/product/ProductReplyDao.php b/app/common/dao/store/product/ProductReplyDao.php index aef1192..164247d 100644 --- a/app/common/dao/store/product/ProductReplyDao.php +++ b/app/common/dao/store/product/ProductReplyDao.php @@ -55,6 +55,8 @@ class ProductReplyDao extends BaseDao $query->where('product_type', 'product_type'); })->when(isset($where['is_del']) && $where['is_del'] !== '', function ($query) use ($where) { $query->where('is_del', $where['is_del']); + })->when(isset($where['status']) && $where['status'] !== '', function ($query) use ($where) { + $query->where('status', $where['status']); })->order('sort DESC'); } @@ -65,6 +67,9 @@ class ProductReplyDao extends BaseDao ->when(isset($where['is_reply']) && $where['is_reply'] !== '', function ($query) use ($where) { $query->where('A.is_reply', $where['is_reply']); }) + ->when(isset($where['status']) && $where['status'] !== '', function ($query) use ($where) { + $query->where('A.status', $where['status']); + }) ->when(isset($where['nickname']) && $where['nickname'] !== '', function ($query) use ($where) { $query->whereLike('A.nickname', "%{$where['nickname']}%"); }) @@ -85,7 +90,7 @@ class ProductReplyDao extends BaseDao }) ->order('A.sort DESC, A.create_time DESC') ->where('A.is_del', 0) - ->field('A.reply_id,A.is_reply,A.uid,A.product_score,A.service_score,A.postage_score,A.comment,A.pics,A.create_time,A.merchant_reply_content,A.nickname,A.avatar,B.store_name,B.image,B.product_id,A.sort'); + ->field('A.reply_id,A.status,A.is_reply,A.uid,A.product_score,A.service_score,A.postage_score,A.comment,A.pics,A.create_time,A.merchant_reply_content,A.nickname,A.avatar,B.store_name,B.image,B.product_id,A.sort'); } /** diff --git a/app/controller/admin/store/StoreProductReply.php b/app/controller/admin/store/StoreProductReply.php index 0429876..d99f8e7 100644 --- a/app/controller/admin/store/StoreProductReply.php +++ b/app/controller/admin/store/StoreProductReply.php @@ -52,7 +52,7 @@ class StoreProductReply extends BaseController public function lst() { [$page, $limit] = $this->getPage(); - $where = $this->request->params(['keyword', 'nickname', 'is_reply', 'date', 'product_id']); + $where = $this->request->params(['keyword', 'nickname', 'is_reply', 'date', 'product_id', 'status']); $where['mer_id'] = $this->request->merId() ?: ''; return \app('json')->success($this->repository->getList($where, $page, $limit)); } @@ -151,4 +151,28 @@ class StoreProductReply extends BaseController $this->repository->update($id, $data); return app('json')->success('修改成功'); } + + + /** + * Common: 评论审核 + * Author: wu-hui + * Time: 2023/11/16 16:09 + * @param $replyId + * @return mixed + */ + public function examine($replyId){ + try{ + $this->repository->update($replyId,[ + 'status' => 1 + ]); + + return app('json')->success('审核成功'); + }catch(\Exception $e){ + return app('json')->error($e->getMessage()); + } + + } + + + } diff --git a/app/controller/api/store/product/StoreReply.php b/app/controller/api/store/product/StoreReply.php index 316df0c..51f4dbc 100644 --- a/app/controller/api/store/product/StoreReply.php +++ b/app/controller/api/store/product/StoreReply.php @@ -42,6 +42,8 @@ class StoreReply extends BaseController $where['type'] = $this->request->param('type'); $where['product_id'] = $id; + $where['status'] = 1;// 仅显示审核通过的评论 + return app('json')->success($this->repository->getApiList($where,$page, $limit)); } diff --git a/route/admin/product.php b/route/admin/product.php index 2e76a7e..be99254 100644 --- a/route/admin/product.php +++ b/route/admin/product.php @@ -234,6 +234,9 @@ Route::group(function () { Route::delete('delete/:id', '/delete')->name('systemProductReplyDelete')->option([ '_alias' => '删除', ]); + Route::get('examine/:replyId', '/examine')->name('systemProductReplyExamine')->option([ + '_alias' => '审核', + ]); })->prefix('admin.store.StoreProductReply')->option([ '_path' => '/product/comment', '_auth' => true, diff --git a/route/merchant/product.php b/route/merchant/product.php index b440d8e..39150f9 100644 --- a/route/merchant/product.php +++ b/route/merchant/product.php @@ -252,6 +252,9 @@ Route::group(function () { Route::post('reply/:id', '/reply')->name('merchantProductReplyReply')->option([ '_alias' => '回复', ]); + Route::get('examine/:replyId', '/examine')->name('merchantProductReplyExamine')->option([ + '_alias' => '审核', + ]); })->prefix('admin.store.StoreProductReply')->option([ '_path' => '/product/reviews', '_auth' => true,