feat: 修改CapitalFlowLogic和PayNotifyLogic类中的userIncome和userExpense方法,增加新的支付类型和退款描述,优化代码格式。
This commit is contained in:
parent
b8aad3cdc2
commit
de313f1bed
@ -30,7 +30,7 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
* @param $mark
|
* @param $mark
|
||||||
* @return mixed
|
* @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 = new CapitalFlow();
|
||||||
$model->uid = $this->user['id'];
|
$model->uid = $this->user['id'];
|
||||||
@ -38,10 +38,10 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
$model->link_type = $linkType;
|
$model->link_type = $linkType;
|
||||||
$model->link_id = $linkId;
|
$model->link_id = $linkId;
|
||||||
$model->amount = $amount;
|
$model->amount = $amount;
|
||||||
if($type){
|
if ($type) {
|
||||||
$model->before_balance = $this->user['purchase_funds'];
|
$model->before_balance = $this->user['purchase_funds'];
|
||||||
$model->balance = bcadd($this->user['purchase_funds'], $amount, 2);
|
$model->balance = bcadd($this->user['purchase_funds'], $amount, 2);
|
||||||
}else{
|
} else {
|
||||||
$model->before_balance = $this->user['now_money'];
|
$model->before_balance = $this->user['now_money'];
|
||||||
$model->balance = bcadd($this->user['now_money'], $amount, 2);
|
$model->balance = bcadd($this->user['now_money'], $amount, 2);
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
* @param $mark
|
* @param $mark
|
||||||
* @return mixed
|
* @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 = new CapitalFlow();
|
||||||
$model->uid = $this->user['id'];
|
$model->uid = $this->user['id'];
|
||||||
@ -72,10 +72,10 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
$model->link_type = $linkType;
|
$model->link_type = $linkType;
|
||||||
$model->link_id = $linkId;
|
$model->link_id = $linkId;
|
||||||
$model->amount = $amount;
|
$model->amount = $amount;
|
||||||
if($payType == OrderEnum::BALANCE_PAYMEN_NO){
|
if ($payType == OrderEnum::BALANCE_PAYMEN_NO) {
|
||||||
$model->before_balance = $this->user['purchase_funds'];
|
$model->before_balance = $this->user['purchase_funds'];
|
||||||
$model->balance = bcsub($this->user['purchase_funds'], $amount, 2);
|
$model->balance = bcsub($this->user['purchase_funds'], $amount, 2);
|
||||||
}else{
|
} else {
|
||||||
$model->before_balance = $this->user['now_money'];
|
$model->before_balance = $this->user['now_money'];
|
||||||
$model->balance = bcsub($this->user['now_money'], $amount, 2);
|
$model->balance = bcsub($this->user['now_money'], $amount, 2);
|
||||||
}
|
}
|
||||||
@ -171,9 +171,10 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
return "系统增加采购款{$amount}元";
|
return "系统增加采购款{$amount}元";
|
||||||
case 'system_balance_reduce':
|
case 'system_balance_reduce':
|
||||||
return "系统减少余额{$amount}元";
|
return "系统减少余额{$amount}元";
|
||||||
|
case 'user_balance_recharge_refund':
|
||||||
|
return "用户充值退还{$amount}元";
|
||||||
default:
|
default:
|
||||||
return "订单支付{$amount}元";
|
return "订单支付{$amount}元";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -308,10 +308,10 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||||
if ($purchase_funds >= $orderRe['price']) {
|
if ($purchase_funds >= $orderRe['price']) {
|
||||||
User::where('id', $orderRe['uid'])->dec('purchase_funds', $orderRe['refund_price'])->update();
|
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 {
|
} else {
|
||||||
User::where('id', $orderRe['uid'])->dec('purchase_funds', $purchase_funds)->update();
|
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);
|
UserSignLogic::RefundRecharge($orderRe);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user