调试财务溯源

This commit is contained in:
lewis 2025-03-20 15:04:32 +08:00
parent ccfd1f3556
commit 09a6c25259
2 changed files with 4 additions and 2 deletions

View File

@ -99,7 +99,7 @@ class DeliveryServiceLogic extends BaseLogic
public static function addPurchaseFunds($uid, $amount) public static function addPurchaseFunds($uid, $amount)
{ {
$model = DeliveryService::findOrEmpty($uid); $model = DeliveryService::where('uid', $uid)->findOrEmpty();
if (!$model->isEmpty()) { if (!$model->isEmpty()) {
$model->purchase_funds_total = bcadd($model->purchase_funds_total, $amount, 2); $model->purchase_funds_total = bcadd($model->purchase_funds_total, $amount, 2);
$model->current_purchase_funds = bcadd($model->current_purchase_funds, $amount, 2); $model->current_purchase_funds = bcadd($model->current_purchase_funds, $amount, 2);
@ -109,7 +109,7 @@ class DeliveryServiceLogic extends BaseLogic
public static function subPurchaseFunds($uid, $amount) public static function subPurchaseFunds($uid, $amount)
{ {
$model = DeliveryService::findOrEmpty($uid); $model = DeliveryService::where('uid', $uid)->findOrEmpty();
if (!$model->isEmpty()) { if (!$model->isEmpty()) {
$model->current_purchase_funds = bcsub($model->current_purchase_funds, $amount, 2); $model->current_purchase_funds = bcsub($model->current_purchase_funds, $amount, 2);
$model->save(); $model->save();

View File

@ -2,6 +2,7 @@
namespace app\admin\logic\warehouse_product; namespace app\admin\logic\warehouse_product;
use app\admin\logic\delivery_service\DeliveryServiceLogic;
use app\admin\logic\product_source_link\ProductSourceLinkLogic; use app\admin\logic\product_source_link\ProductSourceLinkLogic;
use app\admin\logic\product_source_link_info\ProductSourceLinkInfoLogic; use app\admin\logic\product_source_link_info\ProductSourceLinkInfoLogic;
use app\admin\logic\store_branch_product\StoreBranchProductLogic; use app\admin\logic\store_branch_product\StoreBranchProductLogic;
@ -130,6 +131,7 @@ class WarehouseProductLogic extends BaseLogic
'warehouse_id' => $params['warehouse_id'], 'warehouse_id' => $params['warehouse_id'],
'link_id' => $res['id'], 'link_id' => $res['id'],
]); ]);
DeliveryServiceLogic::subPurchaseFunds($params['buyer_id'], $params['total_price']);
return $res; return $res;
} catch (\Throwable $e) { } catch (\Throwable $e) {
throw new BusinessException($e->getMessage()); throw new BusinessException($e->getMessage());