Browse Source

Merge branch 'bugfix/2047-memberLevel' into dev

# Conflicts:
#	common/models/Order.php
kevin_zhangl 3 năm trước cách đây
mục cha
commit
9a0a9c92cd

+ 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不符
             }
 
             //需要修改密码

+ 1 - 1
common/components/SwooleAsyncTimer.php

@@ -52,7 +52,7 @@ class SwooleAsyncTimer extends SwooleAsyncTimerComponent implements SocketInterf
         // 自动执行任务队列中的任务
         Queue::instance()->consumeTask();
         // 实时监听计算系统修改的period表字段
-        CalcConsole::listenCalcPeriod();
+//        CalcConsole::listenCalcPeriod();
         CalcConsole::listenAutoPerfPeriod();
         return true;
     }

+ 1 - 0
common/config/main.php

@@ -27,6 +27,7 @@ return [
 //        'dbShop' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema']], $mainConfig['dbShop']),
         'dbLog' => array_merge(['class' => 'yii\mongodb\Connection',], $mainConfig['dbLog']),
         'dbCalc' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalc']),
+        'dbCalcServer' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalcServer']),
 //        'dbShopCalc' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema'],], $mainConfig['dbShopCalc']),
         'dbNetPoint' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbNetPoint']),
         // 'cache' => [

+ 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']]);

+ 3 - 3
common/helpers/bonus/Calc/BaseBusiness.php

@@ -11,9 +11,9 @@ class BaseBusiness
 
     protected $_periodNum = 0;
 
-    protected $_calc_db_name = 'dbCalc';
+    protected $_calc_db_name = 'dbCalcServer';
 
-    const CALC_DB_NAME = 'dbCalc';
+    const CALC_DB_NAME = 'dbCalcServer';
 
     protected $_limit = 10000;
 
@@ -77,4 +77,4 @@ class BaseBusiness
         $calcMonth2 = date('Ym', strtotime('+' . ($this->_calcMonth - 2) . ' month', $startTime));
         return [$calcMonth1, $calcMonth2];
     }
-}
+}

+ 2 - 2
common/helpers/bonus/Calc/BasePerfBusiness.php

@@ -10,7 +10,7 @@ class BasePerfBusiness extends BaseBusiness
 {
     protected $_periodNum = 0;
 
-    protected $_calc_db_name = 'dbCalc';
+    protected $_calc_db_name = 'dbCalcServer';
 
     protected $_limit = 10000;
 
@@ -30,4 +30,4 @@ class BasePerfBusiness extends BaseBusiness
             Period::updateAll(['IS_PERFING' => 0, 'IS_PERFED' => Period::PERF_FAIL, 'PERFED_AT' => 0], 'PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum]);
         }
     }
-}
+}

+ 6 - 7
common/helpers/bonus/Calc/CalcConsole.php

@@ -8,7 +8,7 @@ use common\models\Period;
 
 class CalcConsole extends BaseBusiness
 {
-    const  CALC_DB_NAME = 'dbCalc';
+    const  CALC_DB_NAME = 'dbCalcServer';
 
     public static function listenCalcPeriod()
     {
@@ -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;
             }
         }
@@ -163,4 +162,4 @@ if (empty($period)){
         }
         return true;
     }
-}
+}

+ 3 - 2
common/helpers/bonus/Calc/PushBaseDataToCalc.php

@@ -24,7 +24,7 @@ class PushBaseDataToCalc extends BaseBusiness
 {
     const BASE_INFO_METHODS = [
         //--- 用户表
-        'user'             => ['separately' => true, 'table' => 'AR_USER', 'field' => [
+        'user'             => ['table' => 'AR_USER', 'field' => [
             'ID',
             'USER_NAME',
             'REAL_NAME',
@@ -37,6 +37,7 @@ class PushBaseDataToCalc extends BaseBusiness
             'DEC_ID',
             'DEC_ROLE_ID',
             'LAST_DEC_LV',
+            'LAST_EMP_LV',
             'IS_STUDIO',
             'LAST_CROWN_LV',
             'DELETED',
@@ -655,4 +656,4 @@ class PushBaseDataToCalc extends BaseBusiness
         $data = null;
         return true;
     }
-}
+}

+ 3 - 3
frontendApi/config/menu.php

@@ -81,7 +81,7 @@ return [
             ['name'=>'My account', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'index', 'routePath'=>'bonus/index', 'show'=>1,],//我的账户
 //            ['name'=>'最新奖金', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'new', 'routePath'=>'bonus/new', 'show'=>1,'allow'=>'newBonusSwitch'],
             ['name'=>'My bonus', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'other', 'routePath'=>'bonus/other', 'show'=>1,'allow'=>'pastBonusSwitch'],//往期奖金
-            ['name'=>'团队查询', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'teams', 'routePath'=>'bonus/teams', 'show'=>1,],
+            ['name'=>'Team inquiry', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'teams', 'routePath'=>'bonus/teams', 'show'=>1,], // 团队查询
             ['name'=>'Historical cumulative bonus', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'other', 'routePath'=>'bonus/historical-cumulative-bonus', 'show'=>1,'allow'=>'pastBonusSwitch'],//历史累积奖金
             //['name'=>'实时业绩', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'real-time-perf', 'routePath'=>'bonus/real-time-perf', 'show'=>1,],
            // ['name'=>'房产积分', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'fc-point', 'routePath'=>'bonus/fc-point', 'show'=>1,],
@@ -119,7 +119,7 @@ return [
         'routePath'=>'article',
         'show'=>1,
         'child'=>[
-			
+
         ]
     ],
 //    'message'=>[
@@ -148,4 +148,4 @@ return [
             ['name'=>'Shipping Address', 'class'=>'', 'icon'=>'', 'controller'=>'config', 'action'=>'receive-address-list', 'routePath'=>'config/receive-address-list', 'show'=>1,],//收货地址管理
         ]
     ],
-];
+];

+ 12 - 12
frontendApi/modules/v1/controllers/BonusController.php

@@ -130,11 +130,11 @@ class BonusController extends BaseController {
         $user[0] = [
             'number' => $userInfo['USER_NAME'],
             'name' => $userInfo['REAL_NAME'],
-            'perf_status' => '0', // 0  未达标  1为已达标
-            'perf_status_name' => '不达标',
             'user_perf' => 0, // 个人业绩
             'team_perf' => 0, // 团队新增累计业绩
-            'total_perf' => 0 // 合计业绩
+            'total_perf' => 0, // 合计业绩
+            'perf_status' => '0', // 0  未达标  1为已达标
+            'perf_status_name' => 'Fail',
         ];
         if (!empty($data)) {
             $userCheck = PerfMonth::checkStatus($data['PV_PCS']+$data['PV_PSS']);
@@ -142,7 +142,7 @@ class BonusController extends BaseController {
             $user[0]['team_perf'] = $data['PV_PSS'];
             $user[0]['total_perf'] = $data['PV_PCS']+$data['PV_PSS'];
             $user[0]['perf_status'] = $userCheck ? '1' : $user[0]['perf_status'];
-            $user[0]['perf_status_name'] = $userCheck ? '达标' : $user[0]['perf_status_name'];
+            $user[0]['perf_status_name'] = $userCheck ? 'Pass' : $user[0]['perf_status_name'];
         }
         $teamInfo = [];
         $calcAt = PerfMonth::find()->select(['CREATED_AT'])->where('CALC_MONTH=:CALC_MONTH', ['CALC_MONTH'=>$month])->asArray()->one();
@@ -167,13 +167,13 @@ class BonusController extends BaseController {
                 $teamInfo[]['perf_status'] = $relationCheck ? '1' : '0';
                 if ($relationCheck) {
                     $userStatusFlag = true; // 只要有一个达标,则个人就达标
-                    $teamInfo[$k]['number'] = '';
-                    $teamInfo[$k]['name'] = '';
-                    $teamInfo[$k]['user_perf'] = '';
-                    $teamInfo[$k]['team_perf'] = '';
-                    $teamInfo[$k]['total_perf'] = '';
+                    $teamInfo[$k]['number'] = $v['USER_NAME'];
+                    $teamInfo[$k]['name'] = $v['REAL_NAME'];
+                    $teamInfo[$k]['user_perf'] = $relationPerf['PV_PCS'];
+                    $teamInfo[$k]['team_perf'] = $relationPerf['PV_PSS'];
+                    $teamInfo[$k]['total_perf'] = $relationPerf['PV_PCS']+$relationPerf['PV_PSS'];
                     $teamInfo[$k]['perf_status'] = '1';
-                    $teamInfo[$k]['perf_status_name'] = '达标';
+                    $teamInfo[$k]['perf_status_name'] = 'Pass';
                 } else {
                     $teamInfo[$k]['number'] = $v['USER_NAME'];
                     $teamInfo[$k]['name'] = $v['REAL_NAME'];
@@ -181,13 +181,13 @@ class BonusController extends BaseController {
                     $teamInfo[$k]['team_perf'] = $relationPerf['PV_PSS'];
                     $teamInfo[$k]['total_perf'] = $relationPerf['PV_PCS']+$relationPerf['PV_PSS'];
                     $teamInfo[$k]['perf_status'] = '0';
-                    $teamInfo[$k]['perf_status_name'] = '不达标';
+                    $teamInfo[$k]['perf_status_name'] = 'Fail';
                 }
             }
         }
         if ($userStatusFlag === true) {
             $user[0]['perf_status'] = '1';
-            $user[0]['perf_status_name'] = '达标';
+            $user[0]['perf_status_name'] = 'Pass';
         }
 
         return static::notice(['user' => $user,'team'=>$teamInfo,'calcAt' => $calcAt['CREATED_AT']]);

+ 3 - 3
frontendEle/src/router/index.js

@@ -486,10 +486,10 @@ export const constantRouterMap = [
         component: _import('bonus/teams'),
         name: 'bonus_teams',
         meta: {
-          title: '团队查询',
+          title: 'Team inquiry', // 团队查询
           breadcrumb: [
-            {title: '首页', path: '/dashboard/index'},
-            {title: '奖金管理', path: '/bonus/index'},
+            {title: 'Dashboard', path: '/dashboard/index'},
+            {title: 'Bonus management', path: '/bonus/index'},
           ],
         },
       },

+ 27 - 27
frontendEle/src/views/bonus/teams.vue

@@ -6,7 +6,7 @@
     style="width: 100%"
     :cell-style="tableCellStyle"
     >
-    <el-table-column label="个人情况">
+    <el-table-column label="Personal details"><!-- 个人情况 -->
       <el-table-column
       type="index"
       :index="indexMethod"
@@ -16,33 +16,33 @@
         </el-table-column>
         <el-table-column
           prop="number"
-          label="会员编号"
-          >
+          label="Member code"
+          ><!-- 会员编号 -->
         </el-table-column>
         <el-table-column
           prop="name"
-          label="会员姓名"
-          >
+          label="Member name"
+          ><!-- 会员姓名 -->
         </el-table-column>
         <el-table-column
           prop="perf_status_name"
-          label="状态"
-          >
+          label="Status"
+          ><!-- 状态 -->
         </el-table-column>
         <el-table-column
           prop="user_perf"
-          label="个人业绩"
-          >
+          label="Personal BV"
+          ><!-- 个人业绩 -->
         </el-table-column>
          <el-table-column
           prop="team_perf"
-          label="累计业绩"
-          >
+          label="PGS"
+          ><!-- 累计业绩 -->
         </el-table-column>
          <el-table-column
           prop="total_perf"
-          label="合计"
-          >
+          label="Total BV"
+          ><!-- 合计 -->
         </el-table-column>
       </el-table-column>
 
@@ -54,7 +54,7 @@
     style="width: 100%;margin-top:20px;"
     :cell-style="tableCellStyle"
    >
-    <el-table-column label="团队情况">
+    <el-table-column label="Team details"><!-- 团队情况 -->
       <el-table-column
       type="index"
       :index="indexMethod"
@@ -64,40 +64,40 @@
         </el-table-column>
          <el-table-column
           prop="number"
-          label="会员编号"
-          >
+          label="Member code"
+          ><!-- 会员编号 -->
         </el-table-column>
         <el-table-column
           prop="name"
-          label="会员姓名"
-          >
+          label="Member name"
+          ><!-- 会员姓名 -->
         </el-table-column>
         <el-table-column
           class="dsdd"
           prop="perf_status_name"
-          label="状态"
-          >
+          label="Status"
+          ><!-- 状态 -->
         </el-table-column>
         <el-table-column
           prop="user_perf"
-          label="个人业绩"
-          >
+          label="Personal BV"
+          ><!-- 个人业绩 -->
         </el-table-column>
          <el-table-column
           prop="team_perf"
-          label="累计业绩"
-          >
+          label="PGS"
+          ><!-- 累计业绩 -->
         </el-table-column>
          <el-table-column
           prop="total_perf"
-          label="合计"
-          >
+          label="Total BV"
+          ><!-- 合计 -->
         </el-table-column>
       </el-table-column>
 
   </el-table>
   <el-descriptions  :column="2"  >
-  <el-descriptions-item label="最新计算时间" >{{getWatTime(calcTime)}}</el-descriptions-item>
+  <el-descriptions-item label="Latest calculation time" >{{getWatTime(calcTime)}}</el-descriptions-item><!-- 最新计算时间 -->
 </el-descriptions>
   </div>
 </template>

+ 18 - 0
sql/upgrade/2175.sql

@@ -0,0 +1,18 @@
+alter table AR_PERIOD add IS_PROCESSING tinyint(1) not null DEFAULT 0  COMMENT '是否计算中';
+
+alter table AR_PERIOD add AUTO_EXEC tinyint(1) not null DEFAULT 0 COMMENT  '一键计算标识';
+
+alter table AR_PERIOD add START_EXEC_TIME int(11) unsigned  not null DEFAULT 0  COMMENT '开始计算的时间';
+alter table AR_PERF_ORDER add PAY_TYPE varchar(32) not null DEFAULT ''  COMMENT '支付方式 cash现金支付  point复消点数  exchange兑换点数';
+
+ALTER TABLE `AR_PERIOD`  ADD COLUMN `IS_PREPARE` tinyint(1) NOT NULL DEFAULT 0 AFTER `IS_PROCESSING`;
+
+update AR_CONFIG set VALUE='1' where CONFIG_NAME='openGL';
+
+CREATE TABLE `AR_CALC_RECORD` (
+  `ID` varchar(32) NOT NULL,
+  `PERIOD_NUM` int(11) NOT NULL,
+  `TEXT` varchar(5000) DEFAULT NULL,
+  `CREATED_AT` int(10) NOT NULL,
+  PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

+ 6 - 0
vendor/yiisoft/yii2/web/ErrorHandler.php

@@ -206,6 +206,12 @@ class ErrorHandler extends \yii\base\ErrorHandler
             'message' => $exception->getMessage(),
             'code' => $exception->getCode(),
         ];
+        if ($exception instanceof HttpException) {
+            $array['status'] = $exception->statusCode;
+        }
+        if (YII_DEBUG) {
+            $array['type'] = get_class($exception);
+        }
 
         return $array;
     }