diff --git a/app/admin/logic/store_order/StoreOrderLogic.php b/app/admin/logic/store_order/StoreOrderLogic.php index 9eae12c4b..61cc44f0d 100644 --- a/app/admin/logic/store_order/StoreOrderLogic.php +++ b/app/admin/logic/store_order/StoreOrderLogic.php @@ -145,7 +145,7 @@ class StoreOrderLogic extends BaseLogic } //现金支付 if ($detail['pay_type'] = PayEnum::CASH_PAY) { - PayNotifyLogic::cash_refund($params['order_id']); + // PayNotifyLogic::cash_refund($params['order_id']); self::refundProduct($detail, $params); return '退款成功'; @@ -189,6 +189,7 @@ class StoreOrderLogic extends BaseLogic { $refund_price = $params['refund_price']; $refund_num = 0; + $updateData=[]; foreach ($params['product_arr'] as $k => $v) { $find = StoreOrderCartInfo::where('oid', $detail['id'])->where('product_id', $v['product_id'])->find(); if ($find) { @@ -208,6 +209,12 @@ class StoreOrderLogic extends BaseLogic $value['update_time'] = strtotime($value['update_time']); StoreFinanceFlowProduct::create($value); } + $updateData[] = [ + 'id' => $v['product_id'], + 'store_id' => $find['store_id'], + 'stock' => ['inc',$v['cart_num']], + 'sales' => ['dec', $v['cart_num']] + ]; } } $village_uid = StoreFinanceFlow::where('order_id', $detail['id'])->where('financial_type', 14)->value('other_uid'); @@ -217,6 +224,7 @@ class StoreOrderLogic extends BaseLogic $detail['refund_price']=$refund_price; StoreOrder::where('id', $detail['id'])->inc('refund_price',$refund_price)->inc('refund_num',$refund_num)->update(); CommissionnLogic::setStore($detail, $village_uid, $brigade_uid, $transaction_id); + (new StoreBranchProduct())->saveAll($updateData); } }