mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-06-07 12:38:11 +08:00
代码优化
This commit is contained in:
parent
10d90e9fb2
commit
9af866f8c3
@ -461,8 +461,8 @@ abstract class Payment
|
|||||||
'sum(used_balance-refund_balance)' => 'balance',
|
'sum(used_balance-refund_balance)' => 'balance',
|
||||||
'sum(used_integral-refund_integral)' => 'integral',
|
'sum(used_integral-refund_integral)' => 'integral',
|
||||||
])->group('channel_type')->select()->map(static function (PluginPaymentRecord $item) use (&$total) {
|
])->group('channel_type')->select()->map(static function (PluginPaymentRecord $item) use (&$total) {
|
||||||
$type = $item->getAttr('channel_type');
|
|
||||||
$total['amount'] = round($total['amount'] + $item->getAttr('amount'), 2);
|
$total['amount'] = round($total['amount'] + $item->getAttr('amount'), 2);
|
||||||
|
$type = $item->getAttr('channel_type');
|
||||||
if (!in_array($type, [self::INTEGRAL, self::BALANCE])) $type = 'payment';
|
if (!in_array($type, [self::INTEGRAL, self::BALANCE])) $type = 'payment';
|
||||||
$total[$type] = round($total[$type] + $item[$type] ?? 0, 2);
|
$total[$type] = round($total[$type] + $item[$type] ?? 0, 2);
|
||||||
});
|
});
|
||||||
@ -484,8 +484,8 @@ abstract class Payment
|
|||||||
PluginPaymentRefund::mk()->where(['record_code' => $pCode, 'refund_status' => [0, 1]])->field([
|
PluginPaymentRefund::mk()->where(['record_code' => $pCode, 'refund_status' => [0, 1]])->field([
|
||||||
'refund_account', 'sum(refund_amount) amount', 'sum(used_payment)' => 'payment', 'sum(used_balance)' => 'balance', 'sum(used_integral)' => 'integral',
|
'refund_account', 'sum(refund_amount) amount', 'sum(used_payment)' => 'payment', 'sum(used_balance)' => 'balance', 'sum(used_integral)' => 'integral',
|
||||||
])->group('refund_account')->select()->map(static function (PluginPaymentRefund $item) use (&$total) {
|
])->group('refund_account')->select()->map(static function (PluginPaymentRefund $item) use (&$total) {
|
||||||
$type = $item->getAttr('refund_account');
|
|
||||||
$total['amount'] = round($total['amount'] + $item->getAttr('amount'), 2);
|
$total['amount'] = round($total['amount'] + $item->getAttr('amount'), 2);
|
||||||
|
$type = $item->getAttr('refund_account');
|
||||||
if (!in_array($type, [self::INTEGRAL, self::BALANCE])) $type = 'payment';
|
if (!in_array($type, [self::INTEGRAL, self::BALANCE])) $type = 'payment';
|
||||||
$total[$type] = round($total[$type] + $item[$type] ?? 0, 2);
|
$total[$type] = round($total[$type] + $item[$type] ?? 0, 2);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user