feat(order): 修改订单逻辑,优化财务流水查询

This commit is contained in:
mkm 2024-08-02 11:19:47 +08:00
parent 1df7f8740a
commit 18c58f58f5

View File

@ -616,18 +616,18 @@ class OrderLogic extends BaseLogic
$order['store_id'] = $params['store_id']; $order['store_id'] = $params['store_id'];
} }
$financeFlowLogic = new StoreFinanceFlowLogic(); $financeFlowLogic = new StoreFinanceFlowLogic();
$select_1 = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => ['in' => 14, 15, 16]])->select(); //other_uid大于0的
$select_1 = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1])->where('other_uid','>',0)->select();
foreach ($select_1 as $k => $v) { foreach ($select_1 as $k => $v) {
if ($v['other_uid'] > 0) { if ($v['other_uid'] > 0) {
$financeFlowLogic->updateStatusUser($v['id'], $v['other_uid'], $v['number'], $v['order_id']); $financeFlowLogic->updateStatusUser($v['id'], $v['other_uid'], $v['number'], $v['order_id']);
} }
} }
if ($order['spread_uid'] > 0) { // $spread_find = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 12, 'other_uid' => $order['spread_uid']])->find();
$spread_find = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 12, 'other_uid' => $order['spread_uid']])->find(); // if ($spread_find) {
if ($spread_find) { // $financeFlowLogic->updateStatusUser($spread_find['id'], $order['spread_uid'], $spread_find['number'], $order['id']);
$financeFlowLogic->updateStatusUser($spread_find['id'], $order['spread_uid'], $spread_find['number'], $order['id']); // }
}
}
$deposit = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 0, 'financial_type' => 11])->value('number') ?? 0; $deposit = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 0, 'financial_type' => 11])->value('number') ?? 0;
$money = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 2])->value('number') ?? 0; $money = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 2])->value('number') ?? 0;
$financeFlowLogic->updateStatusStore($order['id'], $order['store_id'], $money, $deposit); $financeFlowLogic->updateStatusStore($order['id'], $order['store_id'], $money, $deposit);