From b103582188bfff98d2ccd7fbc3c827f685dbb5cf Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 3 Jun 2024 18:11:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=95=86=E5=BA=97=E6=8E=A7=E5=88=B6=E5=99=A8=E4=B8=8E=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86=E4=B8=8E=E9=94=99=E8=AF=AF=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system_store/SystemStoreController.php | 10 ++++++++-- app/admin/logic/store_product/StoreProductLogic.php | 4 +--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/admin/controller/system_store/SystemStoreController.php b/app/admin/controller/system_store/SystemStoreController.php index 169743b44..e327dc7ec 100644 --- a/app/admin/controller/system_store/SystemStoreController.php +++ b/app/admin/controller/system_store/SystemStoreController.php @@ -52,16 +52,22 @@ class SystemStoreController extends BaseAdminController $product_id=$this->request->post('product_id'); if($addList){ foreach ($addList as $key=>$value){ - StoreProductLogic::copy($product_id,$value); + StoreProductLogic::copy($product_id,$value); + if(StoreProductLogic::hasError()){ + return $this->fail(StoreProductLogic::getError()); + } } } $removeList=$this->request->post('removeList'); if($removeList){ foreach ($removeList as $key=>$value){ StoreProductLogic::store_del($product_id,$value); + if(StoreProductLogic::hasError()){ + return $this->fail(StoreProductLogic::getError()); + } } } - return $this->dataLists(new SystemStoreSourceLists()); + return $this->success('设置成功', [], 1, 1); } /** diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index 3fda22b3a..d224e87e7 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -230,7 +230,6 @@ class StoreProductLogic extends BaseLogic return true; } catch (\Exception $e) { Db::rollback(); - d($e); self::setError($e->getMessage()); return false; } @@ -246,12 +245,11 @@ class StoreProductLogic extends BaseLogic Db::startTrans(); try { StoreBranchProduct::where(['product_id' => $id, 'store_id' => $store_id])->update(['delete_time' => time()]); - StoreProductAttrValue::where(['product_id' => $id, 'store_id' => $store_id])->update(['delete_time' => time()]); + StoreBranchProductAttrValue::where(['product_id' => $id, 'store_id' => $store_id])->update(['delete_time' => time()]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); - d($e); self::setError($e->getMessage()); return false; }