Merge pull request 'feat(order): 修改订单逻辑,优化财务流水查询' (#78) from dev into main

Reviewed-on: #78
This commit is contained in:
mkm 2024-08-02 11:23:46 +08:00
commit 7cad2bf8a2

View File

@ -616,18 +616,18 @@ class OrderLogic extends BaseLogic
$order['store_id'] = $params['store_id'];
}
$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) {
if ($v['other_uid'] > 0) {
$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();
if ($spread_find) {
$financeFlowLogic->updateStatusUser($spread_find['id'], $order['spread_uid'], $spread_find['number'], $order['id']);
}
}
// $spread_find = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 12, 'other_uid' => $order['spread_uid']])->find();
// if ($spread_find) {
// $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;
$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);