Просмотр исходного кода

Merge branch 'master' into feature/2034-brook-calcBonus

brook 3 лет назад
Родитель
Сommit
21315a2dcd

+ 4 - 4
backendApi/modules/v1/models/LoginForm.php

@@ -112,21 +112,21 @@ class LoginForm extends Model {
         try{
             $this->getUser();
             if(!$this->_user){
-                throw new Exception('账号不存在');
+                throw new Exception('The account does not exist'); // 账号不存在
             }
             if(!$this->_user['IS_ENABLE']){
                 $this->_updateFailTimes($transaction,'账号已经被锁定,无法登录');
-                throw new Exception('账号已经被锁定,无法登录');
+                throw new Exception('The account has been locked and cannot be logged in'); // 账号已经被锁定,无法登录
             }
             if (!$this->_user->validatePassword($this->password)) {
                 $this->_updateFailTimes($transaction,'用户名或者密码错误');
-                throw new Exception('用户名或者密码错误');
+                throw new Exception('Incorrect user name or password'); // 用户名或者密码错误
             }
             //验证IP
             $bindIp = trim($this->_user['BIND_IP']);
             if(!empty($bindIp) && !(new LoginIpChecker(Yii::$app->request->getUserIP(), $bindIp))->validate()){
                 $this->_updateFailTimes($transaction,'登录IP与此账号绑定的IP不符');
-                throw new Exception('登录IP与此账号绑定的IP不符'.$bindIp);
+                throw new Exception('The login IP does not match the IP bound to this account'.$bindIp); // 登录IP与此账号绑定的IP不符
             }
 
             //需要修改密码

+ 15 - 12
common/helpers/bonus/BonusSend.php

@@ -579,28 +579,31 @@ class BonusSend extends BaseObject {
             ->offset($offset)
             ->limit($this->_limit)
             ->all();
+            LoggerTool::info($allData);
             //@todo 用户级别不变则不更新
             $defaultEmpLv = EmployLevel::getDefaultLevelId();
             if ($allData) {
                 $transaction = Yii::$app->db->beginTransaction();
                 try {
                     foreach ($allData as $data) {
-                        //@todo 用户级别不变则不更新
-                        if( $data['LAST_EMP_LV'] === $defaultEmpLv ) continue;
-                        $nowBsEmpLv = $data['LAST_EMP_LV']; // 当前蓝星奖计算(即管理奖) 的等级
+                        // 蓝星奖计算的最新聘级
+                        $latestEmpLv = $data['LEVEL_ID'];    // 本期计算最新管理级别
+                        $latestEmpLvSort = $empLv[$latestEmpLv]; // 当前蓝星计算的聘级 级别值
+                        if ($defaultEmpLv == $latestEmpLv) {
+                            continue;
+                        }
+                        // 用户存储的最高聘级
                         $user = CalcCache::getUserInfo($data['USER_ID'], $this->_periodNum);
-                        $userEmpLv = $user['EMP_LV']; // 用户的历史最高聘级
-                        $userEmpLvSort = $empLv[$userEmpLv]; // 历史最高聘级的 级别值
-                        $nowBsEmpLvSort = $empLv[$nowBsEmpLv]; // 当前蓝星计算的聘级 级别值
-                        if ($nowBsEmpLvSort > $userEmpLvSort) {
-                            // 如果当前期的级别值大于历史最高级别,则更新用户表里的最高聘级
-                            User::updateAll(['EMP_LV' => $nowBsEmpLv], 'ID=:USER_ID', [':USER_ID' => $data['USER_ID']]);
+                        $highestEmpLv = $user['EMP_LV']; // 用户的历史最高聘级
+                        $highestEmpLvSort = $empLv[$highestEmpLv]; // 历史最高聘级的 级别值
+                        // 如果当前期的聘级高于用户表的最高聘级,则进行更新
+                        if ($latestEmpLvSort > $highestEmpLvSort) {
+                            User::updateAll(['EMP_LV' => $latestEmpLv], 'ID=:USER_ID', [':USER_ID' => $data['USER_ID']]);
                             User::deleteBaseInfoFromRedis($data['USER_ID']);
                         }
-
-                        // 更新最新级别
+                        // 更新最新用户表级别
                         User::updateAll([
-                            'LAST_EMP_LV' => $nowBsEmpLv,
+                            'LAST_EMP_LV' => $latestEmpLv,
                             'LAST_EMP_LV_UPDATED_AT' => time(),
                             'LAST_EMP_LV_UPDATED_PERIOD' => $this->_periodNum
                         ], 'ID=:USER_ID', [':USER_ID' => $data['USER_ID']]);

+ 4 - 5
common/helpers/bonus/Calc/CalcConsole.php

@@ -114,20 +114,19 @@ if (empty($period)){
         }
         if (2 == $period['IS_PREPARE'] && 1 == $period['IS_PERFED']) {
             //拉取期业绩
-            CalcRecord::record($period['PERIOD_NUM'], '第' . $period['PERIOD_NUM'] . '期的业绩数据已生成');
-            CalcRecord::record($period['PERIOD_NUM'], '开始获取第' . $period['PERIOD_NUM'] . '期的期业绩数据');
+            CalcRecord::record($period['PERIOD_NUM'], '第' . $period['PERIOD_NUM'] . '期的预计算业绩数据已生成');
+            CalcRecord::record($period['PERIOD_NUM'], '开始获取第' . $period['PERIOD_NUM'] . '期的预计算期业绩数据');
 
             Period::updatePeriodIsProcessing($period['PERIOD_NUM'], Period::IS_PROCESSING);
             $res = (new PullPerfDataFromCalc($period['PERIOD_NUM']))->start();
             if (200 == $res['code']) {
                 Period::updatePeriodIsProcessing($period['PERIOD_NUM'], Period::NOT_PROCESSING);
-                CalcRecord::record($period['PERIOD_NUM'], '第' . $period['PERIOD_NUM'] . '期的期业绩数据已获取55');
-                \Yii::$app->$db->createCommand()->update('AR_PERIOD', ['IS_PERFED' => 3], 'PERIOD_NUM=:PERIOD_NUM', ['PERIOD_NUM' => $period['PERIOD_NUM']])->execute();
+                CalcRecord::record($period['PERIOD_NUM'], '第' . $period['PERIOD_NUM'] . '期的预计算期业绩数据已获取');
                 return $res;
             } else {
                 //结束计算状态
                 Period::updatePeriodIsProcessing($period['PERIOD_NUM'], Period::NOT_PROCESSING);
-                CalcRecord::record($period['PERIOD_NUM'], '第' . $period['PERIOD_NUM'] . '期的期业绩数据获取失败,原因:' . $res['msg']);
+                CalcRecord::record($period['PERIOD_NUM'], '第' . $period['PERIOD_NUM'] . '期的预计算期业绩数据获取失败,原因:' . $res['msg']);
                 return $res;
             }
         }