|
|
@@ -595,35 +595,34 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
|
|
|
// 查询会员产生时,填写的报单中心
|
|
|
$bonusUserId = DecOrder::find()->where('TO_USER_ID=:TO_USER_ID', [':TO_USER_ID' => $userId])->select('DEC_ID')->orderBy('CREATED_AT DESC')->scalar();
|
|
|
- LoggerTool::debug(json_encode(['$bonusUserId', $bonusUserId]));
|
|
|
|
|
|
//判断parent的报单中心级别 和 服务奖比例
|
|
|
//计算级别之后更新过userInfo的缓存,缓存中级别发生了变化
|
|
|
-// $bonusUserInfo = CalcCache::getUserInfo($bonusUserId, $this->_periodNum);
|
|
|
-// $isDec = $bonusUserInfo['IS_DEC'];
|
|
|
-// if ($isDec == 0) {
|
|
|
-// return self::LOOP_CONTINUE; // 如果不是报单中心则跳过循环
|
|
|
-// }
|
|
|
+ $bonusUserInfo = CalcCache::getUserInfo($bonusUserId, $this->_periodNum);
|
|
|
+ $isDec = $bonusUserInfo['IS_DEC'];
|
|
|
+ if ($isDec == 0) {
|
|
|
+ return self::LOOP_CONTINUE; // 如果不是报单中心则跳过循环
|
|
|
+ }
|
|
|
|
|
|
-// $decRoleId = $bonusUserInfo['DEC_ROLE_ID'];
|
|
|
-// if( !$decRoleId ) return self::LOOP_CONTINUE;
|
|
|
-// if( !isset($this->_decRoleConfig[$decRoleId]) ) return self::LOOP_CONTINUE;
|
|
|
+ $decRoleId = $bonusUserInfo['DEC_ROLE_ID'];
|
|
|
+ if( !$decRoleId ) return self::LOOP_CONTINUE;
|
|
|
+ if( !isset($this->_decRoleConfig[$decRoleId]) ) return self::LOOP_CONTINUE;
|
|
|
|
|
|
// 取报单中心级别对应的拿奖比例
|
|
|
-// $parentDecRoleLevel = $this->_decRoleConfig[$decRoleId];
|
|
|
-// $parentFwBonusPercent = $parentDecRoleLevel['FW_BONUS_PERCENT'] ?? 0;
|
|
|
-// $cacheMaxPercent = CalcCache::fwMaxBonusPercent($userId, $this->_periodNum);
|
|
|
-// $diffPercent = $parentFwBonusPercent - $cacheMaxPercent;
|
|
|
-// if( $diffPercent <= 0 ) return self::LOOP_CONTINUE;
|
|
|
-//
|
|
|
-// $fwBonus = $validPvPcs * $diffPercent / 100;
|
|
|
-// if( $fwBonus <= 0 ) return self::LOOP_CONTINUE;
|
|
|
-
|
|
|
- //给本人添加服务奖比例
|
|
|
-// CalcCache::fwMaxBonusPercent($userId, $this->_periodNum, $parentFwBonusPercent);
|
|
|
-// //记录奖金和奖金来源到缓存 并实现在缓存中奖金累加
|
|
|
-// CalcCache::saveFwBonusList($bonusUserId, $this->_periodNum, $fwBonus, ['fromUid'=>$userId, 'fromPvPcs'=>$validPvPcs]);
|
|
|
-// CalcCache::addHasFwBonusUsers($bonusUserId, $this->_periodNum);
|
|
|
+ $parentDecRoleLevel = $this->_decRoleConfig[$decRoleId];
|
|
|
+ $parentFwBonusPercent = $parentDecRoleLevel['FW_BONUS_PERCENT'] ?? 0;
|
|
|
+ $cacheMaxPercent = CalcCache::fwMaxBonusPercent($userId, $this->_periodNum);
|
|
|
+ $diffPercent = $parentFwBonusPercent - $cacheMaxPercent;
|
|
|
+ if( $diffPercent <= 0 ) return self::LOOP_CONTINUE;
|
|
|
+
|
|
|
+ $fwBonus = $validPvPcs * $diffPercent / 100;
|
|
|
+ if( $fwBonus <= 0 ) return self::LOOP_CONTINUE;
|
|
|
+
|
|
|
+ // 给本人添加服务奖比例
|
|
|
+ CalcCache::fwMaxBonusPercent($userId, $this->_periodNum, $parentFwBonusPercent);
|
|
|
+ //记录奖金和奖金来源到缓存 并实现在缓存中奖金累加
|
|
|
+ CalcCache::saveFwBonusList($bonusUserId, $this->_periodNum, $fwBonus, ['fromUid'=>$userId, 'fromPvPcs'=>$validPvPcs]);
|
|
|
+ CalcCache::addHasFwBonusUsers($bonusUserId, $this->_periodNum);
|
|
|
|
|
|
unset($userId, $validPvPcs);
|
|
|
}
|