更新修改用户余额支付日志流水记录逻辑修改

This commit is contained in:
liu 2024-06-18 11:49:53 +08:00
parent 84d056bfaf
commit b67259a91e
3 changed files with 15 additions and 9 deletions

View File

@ -132,6 +132,10 @@ class OrderEnum
const REFUND_STATUS_FINISH = 2;
const CANCEL_SALE = 3;
//判断资金流水是否余额支付
const BALANCE_PAYMEN_NO = 1;
/**
* @notes 获取支付类型
* @param bool $value

View File

@ -2,6 +2,7 @@
namespace app\common\logic;
use app\common\enum\OrderEnum;
use app\common\model\finance\CapitalFlow;
class CapitalFlowLogic extends BaseLogic
@ -55,21 +56,22 @@ class CapitalFlowLogic extends BaseLogic
* @param $mark
* @return mixed
*/
public function userExpense($category, $linkType, $linkId, $amount, $mark = '',$payType=0)
public function userExpense($store_id=0,$category, $linkType, $linkId, $amount, $mark = '',$payType=0)
{
$model = new CapitalFlow();
$model->uid = $this->user['id'];
$model->category = $category;
$model->store_id = $store_id;
$model->link_type = $linkType;
$model->link_id = $linkId;
$model->amount = $amount;
// if($payType == 1){
if($payType == OrderEnum::BALANCE_PAYMEN_NO){
$model->before_balance = $this->user['now_money'];
$model->balance = $this->user['now_money'];
// }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);

View File

@ -78,7 +78,7 @@ class PayNotifyLogic extends BaseLogic
$user->save();
$capitalFlowDao = new CapitalFlowLogic($user);
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']);
$capitalFlowDao->userExpense($order['store_id'],'user_order_pay', 'order', $order['id'], $order['pay_price']);
// self::afterPay($order);
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
@ -112,7 +112,7 @@ class PayNotifyLogic extends BaseLogic
$user->save();
$capitalFlowDao = new CapitalFlowLogic($user);
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']);
$capitalFlowDao->userExpense($order['store_id'],'user_order_purchase_pay', 'order', $order['id'], $order['pay_price'],'',1);
if ($user['user_ship'] == 1) {
VipLogic::dealVipAmount($order, PayEnum::PURCHASE_FUNDS);
}
@ -151,7 +151,7 @@ class PayNotifyLogic extends BaseLogic
} else {
$capitalFlowDao = new CapitalFlowLogic($user);
//微信支付和用户余额无关
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1);
$capitalFlowDao->userExpense($order['store_id'],'user_order_pay', 'order', $order['id'], $order->pay_price, '', 1);
}