From 8f7d02222b0e9a878dc8575d553ce4c0d253a80e Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 11 Jan 2025 17:19:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(warehouse):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E4=BA=A7=E5=93=81=E6=95=B0=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加对产品数量修改为 0 的特殊处理 - 确保在减少仓库数量时,能够正确增加库存数量 --- .../logic/warehouse_product/WarehouseProductLogic.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/admin/logic/warehouse_product/WarehouseProductLogic.php b/app/admin/logic/warehouse_product/WarehouseProductLogic.php index a1aa5a254..d068a06ab 100644 --- a/app/admin/logic/warehouse_product/WarehouseProductLogic.php +++ b/app/admin/logic/warehouse_product/WarehouseProductLogic.php @@ -211,8 +211,13 @@ class WarehouseProductLogic extends BaseLogic $nums=bcsub($params['nums'], $res['nums'],2); self::incProductDecStorege($res, $nums,$admin_id); }else{ - $nums=bcsub($res['nums'],$params['nums'],2); - self::decProductIncStorege($res, $nums,$admin_id); + if($params['nums']==0){ + $nums=$params['nums']; + self::decProductIncStorege($res, $nums,$admin_id); + }else{ + $nums=bcsub($res['nums'],$params['nums'],2); + self::decProductIncStorege($res, $nums,$admin_id); + } } $datas = [ 'total_price' => $params['total_price'], From 9ed74f26cfa1f10062ffa5c26432240ef54a8477 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 13 Jan 2025 10:38:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(cash=5Fflow):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=B5=84=E9=87=91=E6=B5=81=E6=B0=B4=E6=8F=92=E5=85=A5=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 CashFlowLogic 类的 insert 方法中添加 source_mark 参数,用于记录资金来源标记 - 在 PayNotifyLogic 类中,订单支付成功后调用 CashFlowLogic 的 insert 方法,传入订单编号作为 source_mark - 这些修改增加了资金流水记录的详细信息,有助于后续的财务对账和分析 --- app/common/logic/CashFlowLogic.php | 3 ++- app/common/logic/PayNotifyLogic.php | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/common/logic/CashFlowLogic.php b/app/common/logic/CashFlowLogic.php index 3c15d154e..f4daff58d 100644 --- a/app/common/logic/CashFlowLogic.php +++ b/app/common/logic/CashFlowLogic.php @@ -8,7 +8,7 @@ use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow; class CashFlowLogic extends BaseLogic { - public function insert($storeId, $amount) + public function insert($storeId, $amount,$source_mark='') { $model = new StoreCashFinanceFlow(); $find = $model->where(['store_id' => $storeId])->whereDay('create_time')->where('status', 0)->find(); @@ -21,6 +21,7 @@ class CashFlowLogic extends BaseLogic $model->cash_price = $amount; $model->receivable = $amount; $model->remark = '银行转账请备注:'.mt_rand(1000, 9999); + $model->source_mark = $source_mark; $model->status = YesNoEnum::NO; //收银台收了默认算完成了 $model->save(); } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index dd60215b9..b835ae9fa 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -495,6 +495,8 @@ class PayNotifyLogic extends BaseLogic if ($order['other_uid'] > 0) { $uid = $order['other_uid']; } + $cashFlowLogic = new CashFlowLogic(); + $cashFlowLogic->insert($order['store_id'], $order['price'],$orderSn); PushService::push('wechat_mmp_' . $uid, $uid, ['type' => 'INDUSTRYMEMBERS', 'msg' => '订单支付成功', 'data' => ['id' => $order['id'], 'paid' => 1]]); PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'INDUSTRYMEMBERS', 'msg' => '订单支付成功', 'data' => ['id' => $order['id'], 'paid' => 1]]); From 0caae6937162904421a5b581f6be82ffc62bf774 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 13 Jan 2025 10:43:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat(CashFlowLogic):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=8E=B0=E9=87=91=E6=B5=81=E6=9D=A5=E6=BA=90=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在现金流记录存在时,将新的来源标记添加到原有标记之后 - 仅在来源标记存在时执行添加操作 --- app/common/logic/CashFlowLogic.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/common/logic/CashFlowLogic.php b/app/common/logic/CashFlowLogic.php index f4daff58d..fa399f66a 100644 --- a/app/common/logic/CashFlowLogic.php +++ b/app/common/logic/CashFlowLogic.php @@ -15,6 +15,9 @@ class CashFlowLogic extends BaseLogic if ($find) { $find->cash_price = bcadd($find->cash_price, $amount, 2); $find->receivable = bcadd($find->receivable, $amount, 2); + if($source_mark){ + $find->source_mark =$find->source_mark.','.$source_mark; + } $find->save(); } else { $model->store_id = $storeId;