diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 98cec7915..45122cc5c 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -578,13 +578,13 @@ class PayNotifyLogic extends BaseLogic $branchProduct=StoreBranchProduct::where('product_id', $v['product_id'])->where('store_id',$v['store_id'])->find(); if($branchProduct){ $stock=bcsub($branchProduct['stock'],$v['cart_num'],2); - $branchProduct->update(['stock'=>$stock,'total_price'=>bcmul($stock,$branchProduct['purchase'],2), + StoreProduct::where('id',$branchProduct['id'])->update(['stock'=>$stock,'total_price'=>bcmul($stock,$branchProduct['purchase'],2), 'sales'=>bcmul($branchProduct['sales'],$v['cart_num'],2)]); } $storeProduct=StoreProduct::where('id', $v['product_id'])->find(); if($storeProduct){ $stock=bcsub($storeProduct['stock'],$v['cart_num'],2); - $storeProduct->update(['stock'=>$stock,'total_price'=>bcmul($stock,$storeProduct['purchase'],2), + StoreProduct::where('id', $v['product_id'])->update(['stock'=>$stock,'total_price'=>bcmul($stock,$storeProduct['purchase'],2), 'sales'=>bcmul($storeProduct['sales'],$v['cart_num'],2)]); } }