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; }