From 05971dd21faab649c3184513111fb071e2a269a0 Mon Sep 17 00:00:00 2001 From: reidier Date: Mon, 14 Sep 2026 11:08:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(category):=20=E8=A7=A3=E5=86=B3=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BC=BA=E5=B0=91=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E5=AD=97=E6=AE=B5=E9=AA=8C=E8=AF=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加栏目存在性检查确保更新操作的安全性 - 补充website_id和module_id字段的自动获取逻辑 - 防止因字段缺失导致的数据不一致问题 --- app/controller/backend/CategoryController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controller/backend/CategoryController.php b/app/controller/backend/CategoryController.php index d21f8c8..d5dde5e 100644 --- a/app/controller/backend/CategoryController.php +++ b/app/controller/backend/CategoryController.php @@ -244,6 +244,13 @@ class CategoryController extends BaseController if(!empty($param['parent_map'])){ $param = $this->getMapCateData($param); } + // 临时调整 + $tempCate = $Category->getCategory(['id'=>$param['id'],'seller_id'=>$this->admin['seller_id']])['data']; + if(empty($tempCate)){ + return jsonReturn(-1, '栏目不存在'); + } + $param['website_id'] = $tempCate['website_id']; + $param['module_id'] = $tempCate['module_id']; validate(CategoryValidate::class)->scene('update')->check($param); } catch (ValidateException $e) { return jsonReturn(-1, $e->getError());