动态删除 删除对应的引用topic 关系

This commit is contained in:
2025-08-19 14:38:37 +08:00
parent 9991a4bdd8
commit 4d09418cfd

View File

@@ -548,6 +548,12 @@ class UserZone extends Model
$data['is_delete'] = 2; $data['is_delete'] = 2;
$data['delete_time'] = time(); $data['delete_time'] = time();
$reslut = db::name('user_zone')->where('id', $zid)->update($data); $reslut = db::name('user_zone')->where('id', $zid)->update($data);
$top_zone = db::name('user_zone_topic')->where('zone_id',$zid)->select();
if($top_zone){
foreach ($top_zone as $v){
db::name('user_zone_topic')->where('id',$v['id'])->delete();
}
}
if ($reslut) { if ($reslut) {
return ['code' => 1, 'msg' => '删除成功', 'data' => null]; return ['code' => 1, 'msg' => '删除成功', 'data' => null];
} else { } else {