diff --git a/app/common/logic/CapitalFlowLogic.php b/app/common/logic/CapitalFlowLogic.php index a49be021..2e14a6e8 100644 --- a/app/common/logic/CapitalFlowLogic.php +++ b/app/common/logic/CapitalFlowLogic.php @@ -30,7 +30,7 @@ class CapitalFlowLogic extends BaseLogic * @param $mark * @return mixed */ - public function userIncome($category, $linkType, $linkId, $amount, $mark = '',$type=0) + public function userIncome($category, $linkType, $linkId, $amount, $mark = '', $type = 0) { $model = new CapitalFlow(); $model->uid = $this->user['id']; @@ -38,10 +38,10 @@ class CapitalFlowLogic extends BaseLogic $model->link_type = $linkType; $model->link_id = $linkId; $model->amount = $amount; - if($type){ + if ($type) { $model->before_balance = $this->user['purchase_funds']; $model->balance = bcadd($this->user['purchase_funds'], $amount, 2); - }else{ + } else { $model->before_balance = $this->user['now_money']; $model->balance = bcadd($this->user['now_money'], $amount, 2); } @@ -63,7 +63,7 @@ class CapitalFlowLogic extends BaseLogic * @param $mark * @return mixed */ - public function userExpense($category, $linkType, $linkId, $amount, $mark = '',$payType=0,$store_id=0) + public function userExpense($category, $linkType, $linkId, $amount, $mark = '', $payType = 0, $store_id = 0) { $model = new CapitalFlow(); $model->uid = $this->user['id']; @@ -72,13 +72,13 @@ class CapitalFlowLogic extends BaseLogic $model->link_type = $linkType; $model->link_id = $linkId; $model->amount = $amount; - if($payType == OrderEnum::BALANCE_PAYMEN_NO){ + if ($payType == OrderEnum::BALANCE_PAYMEN_NO) { $model->before_balance = $this->user['purchase_funds']; $model->balance = bcsub($this->user['purchase_funds'], $amount, 2); - }else{ - $model->before_balance = $this->user['now_money']; - $model->balance = bcsub($this->user['now_money'], $amount, 2); - } + } else { + $model->before_balance = $this->user['now_money']; + $model->balance = bcsub($this->user['now_money'], $amount, 2); + } $model->create_time = date('Y-m-d H:i:s'); $model->type = 'out'; $model->title = $this->getTitle($category, $amount); @@ -171,9 +171,10 @@ class CapitalFlowLogic extends BaseLogic return "系统增加采购款{$amount}元"; case 'system_balance_reduce': return "系统减少余额{$amount}元"; + case 'user_balance_recharge_refund': + return "用户充值退还{$amount}元"; default: return "订单支付{$amount}元"; } } - } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 4dac5898..a6d81319 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -308,10 +308,10 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); if ($purchase_funds >= $orderRe['price']) { User::where('id', $orderRe['uid'])->dec('purchase_funds', $orderRe['refund_price'])->update(); - $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $orderRe['id'], $orderRe['refund_price'], '', 1, $orderRe['store_id']); + $capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $orderRe['refund_price'], '', 1, $orderRe['store_id']); } else { User::where('id', $orderRe['uid'])->dec('purchase_funds', $purchase_funds)->update(); - $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $orderRe['id'], $purchase_funds, '', 1, $orderRe['store_id']); + $capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $purchase_funds, '', 1, $orderRe['store_id']); } //退还 充值得兑换券 UserSignLogic::RefundRecharge($orderRe);