动态评论回复添加
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user