|
|
@@ -1814,13 +1814,13 @@ class BonusCalc extends BaseObject {
|
|
|
$subQuery = CalcBonusQY::find()
|
|
|
->yearMonth($this->_calcYearMonth)
|
|
|
->where('CALC_MONTH = :CALC_MONTH AND LAST_CROWN_LV <> :NO_CROWN_LV', [':CALC_MONTH' => $this->_calcYearMonth, ':NO_CROWN_LV' => StarCrownLevel::NO_LEVEL_ID])
|
|
|
- ->select('USER_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')
|
|
|
+ ->select('USER_ID,LAST_DEC_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')
|
|
|
->joinWith(['starCrown' => function($query) {
|
|
|
$query->select(['LEVEL_NAME', 'SORT']);
|
|
|
}])
|
|
|
->having(1)
|
|
|
->orderBy('USER_ID ASC, SORT DESC');
|
|
|
- $userStarCrownObj = (new Query())->from(['u' => $subQuery])->select('USER_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')->groupBy('USER_ID')->indexBy('USER_ID')->all();
|
|
|
+ $userStarCrownObj = (new Query())->from(['u' => $subQuery])->select('USER_ID,LAST_DEC_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')->groupBy('USER_ID')->indexBy('USER_ID')->all();
|
|
|
|
|
|
// 奖金点数综合
|
|
|
$bonusPointComplex = 0;
|
|
|
@@ -1835,10 +1835,10 @@ class BonusCalc extends BaseObject {
|
|
|
$insertBonusData[] = [
|
|
|
'ID' => SnowFake::instance()->generateId(),
|
|
|
'USER_ID' => $item['USER_ID'],
|
|
|
- 'LAST_DEC_LV' => $item['LAST_DEC_LV'],
|
|
|
- 'LAST_EMP_LV' => $item['LAST_EMP_LV'],
|
|
|
- 'LAST_STATUS' => $item['LAST_STATUS'],
|
|
|
- 'LAST_CROWN_LV' => $item['LAST_CROWN_LV'],
|
|
|
+ 'LAST_DEC_LV' => $item['LAST_DEC_LV'] ?? '',
|
|
|
+ 'LAST_EMP_LV' => $item['LAST_EMP_LV'] ?? '',
|
|
|
+ 'LAST_STATUS' => $item['LAST_STATUS'] ?? 0,
|
|
|
+ 'LAST_CROWN_LV' => $item['LAST_CROWN_LV'] ?? '',
|
|
|
'AMOUNT' => 0,
|
|
|
'POINT' => $bonusPoint,
|
|
|
'PERIOD_NUM' => $this->_periodNum,
|
|
|
@@ -1918,7 +1918,7 @@ class BonusCalc extends BaseObject {
|
|
|
$userStarDirector = CalcBonusBS::find()
|
|
|
->yearMonth($this->_calcYearMonth)
|
|
|
->where('CALC_MONTH = :CALC_MONTH', [':CALC_MONTH' => $this->_calcYearMonth])
|
|
|
- ->select('USER_ID,LEVEL_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_STATUS')
|
|
|
+ ->select('USER_ID,LEVEL_ID,LAST_DEC_LV,LAST_STATUS')
|
|
|
->groupBy('USER_ID')
|
|
|
->asArray()
|
|
|
->all();
|
|
|
@@ -1928,13 +1928,13 @@ class BonusCalc extends BaseObject {
|
|
|
$subQuery = CalcBonusQY::find()
|
|
|
->yearMonth($this->_calcYearMonth)
|
|
|
->where('CALC_MONTH = :CALC_MONTH AND LAST_CROWN_LV <> :NO_CROWN_LV', [':CALC_MONTH' => $this->_calcYearMonth, ':NO_CROWN_LV' => StarCrownLevel::NO_LEVEL_ID])
|
|
|
- ->select('USER_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')
|
|
|
+ ->select('USER_ID,LAST_DEC_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')
|
|
|
->joinWith(['starCrown' => function($query) {
|
|
|
$query->select(['LEVEL_NAME', 'SORT']);
|
|
|
}])
|
|
|
->having(1)
|
|
|
->orderBy('USER_ID ASC, SORT DESC');
|
|
|
- $userStarCrownObj = (new Query())->from(['u' => $subQuery])->select('USER_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')->groupBy('USER_ID')->indexBy('USER_ID')->all();
|
|
|
+ $userStarCrownObj = (new Query())->from(['u' => $subQuery])->select('USER_ID,LAST_DEC_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')->groupBy('USER_ID')->indexBy('USER_ID')->all();
|
|
|
|
|
|
// 合并用户ID,去重
|
|
|
$bonusUsers = array_unique(array_merge(array_keys($userStarDirectorObj), array_keys($userStarCrownObj)));
|
|
|
@@ -1954,7 +1954,7 @@ class BonusCalc extends BaseObject {
|
|
|
'ID' => SnowFake::instance()->generateId(),
|
|
|
'USER_ID' => $userId,
|
|
|
'LAST_DEC_LV' => $userStarDirectorObj[$userId]['LAST_DEC_LV'] ?? ($userStarCrownObj[$userId]['LAST_DEC_LV'] ?? ''),
|
|
|
- 'LAST_EMP_LV' => $userStarDirectorObj[$userId]['LAST_EMP_LV'] ?? ($userStarCrownObj[$userId]['LAST_EMP_LV'] ?? ''),
|
|
|
+ 'LAST_EMP_LV' => $userStarDirectorObj[$userId]['LEVEL_ID'] ?? '',
|
|
|
'LAST_STATUS' => $userStarDirectorObj[$userId]['LAST_STATUS'] ?? ($userStarCrownObj[$userId]['LAST_STATUS'] ?? 1),
|
|
|
'LAST_CROWN_LV' => $userStarCrownObj[$userId]['LAST_CROWN_LV'] ?? '',
|
|
|
'AMOUNT' => 0,
|