diff --git a/app/api/logic/DemoLogic.php b/app/api/logic/DemoLogic.php index 80835356..20886ce2 100644 --- a/app/api/logic/DemoLogic.php +++ b/app/api/logic/DemoLogic.php @@ -98,13 +98,13 @@ class DemoLogic extends BaseLogic /** * 库存回滚 */ - public static function test3($id) + public static function test3($id,$warehouse_id=1) { $arr=WarehouseProduct::where('oid', $id)->select(); foreach ($arr as $k => $v) { - $find=WarehouseProductStorege::where('product_id', $v['product_id'])->where('warehouse_id',1)->find(); + $find=WarehouseProductStorege::where('product_id', $v['product_id'])->where('warehouse_id',$warehouse_id)->find(); $nums = bcadd($find->nums, $v['nums'], 2); - $res=WarehouseProductStorege::where('id', $v['id'])->update(['nums' => $nums]); + $res=WarehouseProductStorege::where('id', $find['id'])->update(['nums' => $nums]); if($res){ SqlChannelLog('WarehouseProductStorege', $v['id'], $v['nums'], 1, Request()->url(), 1); $v->save(['delete_time'=>time()]);