|
|
@@ -280,7 +280,7 @@ class BonusCalc extends BaseObject {
|
|
|
// 调用存储过程,计算蓝星管理奖金
|
|
|
$this->calcBsProcedure();
|
|
|
// 将有蓝星管理奖金的用户加入到有奖金缓存用户中
|
|
|
-
|
|
|
+ $this->calcBonusBsGLYJ();
|
|
|
$this->calcBonusBsGL();
|
|
|
$this->calcBonusBsYJ();
|
|
|
$t18temp = microtime(true);
|
|
|
@@ -1613,6 +1613,59 @@ class BonusCalc extends BaseObject {
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 蓝星管理奖金未拆分
|
|
|
+ * @param int $offset
|
|
|
+ * @return bool
|
|
|
+ * @throws \yii\db\Exception
|
|
|
+ */
|
|
|
+ public function calcBonusBsGLYJ(int $offset = 0) {
|
|
|
+ if( !$this->_isCalcMonth ) {
|
|
|
+ // 不是结算月,则不进行计算
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 从缓存获取分页有收入的会员信息
|
|
|
+ $allData = CalcBonusBS::findUseDbCalc()
|
|
|
+ ->where('PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum])
|
|
|
+ ->groupBy('USER_ID')
|
|
|
+ ->offset($offset)
|
|
|
+ ->limit($this->_limit)
|
|
|
+ ->asArray()
|
|
|
+ ->all();
|
|
|
+ if ($allData) {
|
|
|
+ foreach ($allData as $user) {
|
|
|
+ // 添加到有奖励信息的数据中
|
|
|
+ CalcCache::addHasBonusUsers($user['USER_ID'], $this->_periodNum);
|
|
|
+ //CalcCache::addHasMonthBonusUsers($user['USER_ID'], $this->_periodNum);
|
|
|
+ $fxStatus = $this->_isMonthPerfLimit($user['USER_ID']);
|
|
|
+ if ($fxStatus) {
|
|
|
+ //扣除相应的复消积分和管理费
|
|
|
+ $deductData = $this->deduct($user['USER_ID'], $user['ORI_BONUS']);
|
|
|
+ // 把对碰后的奖金存入缓存中
|
|
|
+ CalcCache::bonus($user['USER_ID'], $this->_periodNum, 'BONUS_BS', $user['ORI_BONUS'], $deductData);
|
|
|
+ $realBonusBs = $deductData['surplus']; // 扣除管理费和复消积分后的实发蓝星奖金
|
|
|
+ $manageTax = $deductData['manageTax']; // 管理费
|
|
|
+ $point = $deductData['reConsumePoints'];// 复消积分
|
|
|
+ } else {
|
|
|
+ // 如果未满足月消费,则不扣除管理费和复消积分了
|
|
|
+ CalcCache::bonus($user['USER_ID'], $this->_periodNum, 'BONUS_BS', $user['ORI_BONUS']);
|
|
|
+ $realBonusBs = $user['ORI_BONUS'];
|
|
|
+ $manageTax = 0; // 管理费
|
|
|
+ $point = 0;// 复消积分
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新蓝星奖金存储过程的实发金额数据
|
|
|
+ CalcBonusBS::updateAll(['AMOUNT' => $realBonusBs, 'MANAGE_TAX' => $manageTax, 'RECONSUME_POINTS' => $point],
|
|
|
+ 'USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM',
|
|
|
+ [':USER_ID' => $user['USER_ID'], ':PERIOD_NUM' => $this->_periodNum]);
|
|
|
+ }
|
|
|
+ return $this->calcBonusBsGLYJ($offset + $this->_limit);
|
|
|
+ }
|
|
|
+ unset($allData);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 蓝星管理奖金
|
|
|
* @param int $offset
|