|
|
@@ -4,6 +4,7 @@ namespace biz\stat\classes;
|
|
|
|
|
|
use biz\base\classes\BaseClass;
|
|
|
use biz\stat\models\StatRefund;
|
|
|
+use common\components\dict;
|
|
|
|
|
|
class StatRefundClass extends BaseClass
|
|
|
{
|
|
|
@@ -18,7 +19,7 @@ class StatRefundClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//退款统计 shish 20210827
|
|
|
- public static function replace($shop, $amount, $date = null)
|
|
|
+ public static function replace($shop, $payWay, $amount, $date = null)
|
|
|
{
|
|
|
$sjId = $shop->sjId ?? 0;
|
|
|
$shopId = $shop->id ?? 0;
|
|
|
@@ -33,8 +34,38 @@ class StatRefundClass extends BaseClass
|
|
|
$unique->amount = $currentAmount;
|
|
|
$unique->totalAmount = $shop->totalRefund;
|
|
|
$unique->num += 1;
|
|
|
+
|
|
|
+ $map = dict::getDict('payWay');
|
|
|
+ switch ($payWay) {
|
|
|
+ case $map['wxPay']:
|
|
|
+ $current = bcadd($unique->wx, $amount, 2);
|
|
|
+ $unique->wx = $current;
|
|
|
+ break;
|
|
|
+ case $map['alipay']:
|
|
|
+ $current = bcadd($unique->alipay, $amount, 2);
|
|
|
+ $unique->alipay = $current;
|
|
|
+ break;
|
|
|
+ case $map['balancePay']:
|
|
|
+ $current = bcadd($unique->balance, $amount, 2);
|
|
|
+ $unique->balance = $current;
|
|
|
+ break;
|
|
|
+ case $map['debtPay']:
|
|
|
+ $current = bcadd($unique->debt, $amount, 2);
|
|
|
+ $unique->debt = $current;
|
|
|
+ break;
|
|
|
+ case $map['cash']:
|
|
|
+ $current = bcadd($unique->cash, $amount, 2);
|
|
|
+ $unique->cash = $current;
|
|
|
+ break;
|
|
|
+ case $map['bankCard']:
|
|
|
+ $current = bcadd($unique->bank, $amount, 2);
|
|
|
+ $unique->bank = $current;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ }
|
|
|
+
|
|
|
$unique->save();
|
|
|
- StatRefundMonthClass::replace($shop, $amount, $time);
|
|
|
+ StatRefundMonthClass::replace($shop, $payWay, $amount, $time);
|
|
|
}
|
|
|
|
|
|
}
|