From 005533fd273331d5bf0da63fd380d96331c0490c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Sat, 3 Jan 2026 16:48:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=AF=84=E8=AE=BA=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/adminapi/controller/UserZone.php | 35 ++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/application/adminapi/controller/UserZone.php b/application/adminapi/controller/UserZone.php index 1bdc9ba3..bff89595 100644 --- a/application/adminapi/controller/UserZone.php +++ b/application/adminapi/controller/UserZone.php @@ -178,8 +178,43 @@ class UserZone extends adminApi public function del_comment(){ $id = input('id', 0); $res = db::name('user_zone_comment')->where(['id'=>$id])->update(['is_delete'=> 2,'updatetime'=> time()]); + if($res){ + $zone_id = db::name('user_zone_comment')->where(['id'=>$id])->value('zone_id'); + //删除评论下的回复 + $dd = db::name('user_zone_comment')->where('pid', $id)->find(); + if($dd){ + $reslut1 = db::name('user_zone_comment')->where('pid', $id)->update(['is_delete' => 2,'updatetime' => time()]); + if (!$reslut1) { + return ['code' => 0, 'msg' => '请重试!!', 'data' => null]; + } + } + //减少评论数量 + $num = db::name('user_zone_comment')->where('pid', $id)->count(); + if($num > 0){ + $num = $num + 1; + }else{ + $num = 1; + } + $reslut2 = db::name('user_zone')->where('id', $zone_id)->setDec('comment_num', $num); + if (!$reslut2) { + return ['code' => 0, 'msg' => '请重试!!', 'data' => null]; + } + } return V($res ? 1 : 0, $res ? '删除成功' : '删除失败'); } + + public function comment_zone() + { + $id = input('id', 0); + $content = input('content', ''); + $comment_data = db::name('user_zone_comment')->where(['id'=>$id])->find(); + $zid = $comment_data['zone_id']; + $pid = $id; + $reply_to = input('reply_to', 0); + $reslut = model('api/UserZone')->comment_zone(0, $zid, $content,$pid, $reply_to); + return V($reslut['code'], $reslut['msg'], $reslut['data']); + } + //动态置顶或显示操作操作 public function zone_top_or_show(){ $id = input('id', 0);