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,