|
|
@@ -259,12 +259,9 @@ class Balance {
|
|
|
$exchangeRate = 1; // TODO:奖金发放美元
|
|
|
// redis加锁(防止并发余额数值不准确出错)
|
|
|
switch ($type) {
|
|
|
- case 'userBonus':
|
|
|
+ case 'bonus':
|
|
|
$lockKey = self::BONUS_BALANCE_LOCK_KEY . $userId;
|
|
|
break;
|
|
|
- case 'userPerformanceBonus':
|
|
|
- $lockKey = self::USER_PERFORMANCE_BONUS_BALANCE_LOCK_KEY . $userId;
|
|
|
- break;
|
|
|
default:
|
|
|
throw new Exception('流水类型错误');
|
|
|
}
|
|
|
@@ -336,23 +333,9 @@ class Balance {
|
|
|
'ORDER_SN' => $params['ORDER_SN'] ?? '',
|
|
|
];
|
|
|
|
|
|
- if (strtolower($type) == 'reconsume_points' || strtolower($type) == 'cf' || strtolower($type) == 'lx'
|
|
|
- || strtolower($type) == 'exchange_points'
|
|
|
- ) {
|
|
|
- unset($flowInsertData['CALC_ID']);
|
|
|
- unset($flowInsertData['TRANSFER_SN']);
|
|
|
- unset($flowInsertData['SORT']);
|
|
|
- }
|
|
|
+ // 写入流水
|
|
|
if (strtolower($type) == 'bonus') {
|
|
|
FlowBonus::insertOne($flowInsertData);
|
|
|
- } elseif (strtolower($type) == 'exchange_points') {
|
|
|
- //记录和扣除期数的积分
|
|
|
- if( $amount > 0 ) {
|
|
|
- self::addPeriodExchangePoints($userId, $periodNum, (!$issueBonus ? $amount / $exchangeRate : $amount));
|
|
|
- }else {
|
|
|
- self::deductPeriodExchangePoints($userId, abs($amount));
|
|
|
- }
|
|
|
- FlowExchangePoints::insertOne($flowInsertData);
|
|
|
}
|
|
|
|
|
|
unset($flowInsertData, $userInfo, $oneUserBonus);
|