diff --git a/app/admin/controller/warehouse_product_storege/WarehouseProductStoregeController.php b/app/admin/controller/warehouse_product_storege/WarehouseProductStoregeController.php index cfa6f487f..cca57105b 100644 --- a/app/admin/controller/warehouse_product_storege/WarehouseProductStoregeController.php +++ b/app/admin/controller/warehouse_product_storege/WarehouseProductStoregeController.php @@ -47,21 +47,19 @@ class WarehouseProductStoregeController extends BaseAdminController // } - // /** - // * @notes 编辑仓库商品存储 - // * @return \think\response\Json - // * @author admin - // * @date 2024/08/01 10:22 - // */ - // public function edit() - // { - // $params = (new WarehouseProductStoregeValidate())->post()->goCheck('edit'); - // $result = WarehouseProductStoregeLogic::edit($params); - // if (true === $result) { - // return $this->success('编辑成功', [], 1, 1); - // } - // return $this->fail(WarehouseProductStoregeLogic::getError()); - // } + /** + * @notes 编辑仓库商品存储 + * @return \think\response\Json + * @author admin + * @date 2024/08/01 10:22 + */ + public function edit() + { + $params = $this->request->post(); + $result = WarehouseProductStoregeLogic::edit($params); + return $this->success('编辑成功', [], 1, 1); + + } // /** diff --git a/app/admin/logic/warehouse_product_storege/WarehouseProductStoregeLogic.php b/app/admin/logic/warehouse_product_storege/WarehouseProductStoregeLogic.php index 2bd0c5e6d..f993e40f0 100644 --- a/app/admin/logic/warehouse_product_storege/WarehouseProductStoregeLogic.php +++ b/app/admin/logic/warehouse_product_storege/WarehouseProductStoregeLogic.php @@ -6,7 +6,7 @@ namespace app\admin\logic\warehouse_product_storege; use app\common\model\warehouse_product_storege\WarehouseProductStorege; use app\common\logic\BaseLogic; use think\facade\Db; - +use Webman\Exception\BusinessException; /** * 仓库商品存储逻辑 @@ -39,7 +39,20 @@ class WarehouseProductStoregeLogic extends BaseLogic */ public static function edit(array $params): bool { - return true; + Db::startTrans(); + try { + $find=WarehouseProductStorege::where('id',$params['id'])->find(); + if($find){ + $find->save(['nums'=>$params['nums']]); + } + Db::commit(); + return true; + + } catch (\Throwable $th) { + Db::rollback(); + throw new BusinessException($th->getMessage()); + } + return false; }