Bläddra i källkod

Merge branch 'feature/2606-trial-calc'

# Conflicts:
#	common/models/forms/AdminAddUserForm.php
theo 2 år sedan
förälder
incheckning
c30f5afa3c

+ 31 - 31
backendApi/modules/v1/controllers/CalcController.php

@@ -32,34 +32,34 @@ class CalcController extends BaseController
         return $behaviors;
     }
 
-    public function actionAutoPerf() {
-        $periodNum = \Yii::$app->request->get('periodNum');
-        if (!$periodNum) {
-            return static::notice('期数不存在', 400);
-        }
-        if (Period::isPreparing($periodNum)) {
-            return static::notice('预计算正在进行中请稍后', 400);
-        }
-        //设置自动计算标识
-        Period::updatePeriodIsAutoExec($periodNum, Period::MANUAL_EXEC_CALC);
-        //记录开始计算的时间
-        $calc_id = uniqid('perf_');
-        CalcOperation::record($calc_id, $periodNum);
-        Period::updateAll(['START_EXEC_TIME' => time(), 'CALC_ID' => $calc_id], ['PERIOD_NUM' => $periodNum]);
-
-        $formModel = new PeriodForm();
-        $formModel->scenario = 'autoPerf';
-
-        if ($formModel->load(Yii::$app->request->get(), '') && $formModel->autoPerf()) {
-            //设置预计算进行中标识
-            Period::updatePeriodIsPreparing($periodNum, Period::IS_PREPARING);
-            //设置redis开关
-            Yii::$app->cache->set('isPreparing', 1, 3600);
-            return static::notice('预计算已开始,请等待');
-        } else {
-            return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
-        }
-    }
+//    public function actionAutoPerf() {
+//        $periodNum = \Yii::$app->request->get('periodNum');
+//        if (!$periodNum) {
+//            return static::notice('期数不存在', 400);
+//        }
+//        if (Period::isPreparing($periodNum)) {
+//            return static::notice('预计算正在进行中请稍后', 400);
+//        }
+//        //设置自动计算标识
+//        Period::updatePeriodIsAutoExec($periodNum, Period::MANUAL_EXEC_CALC);
+//        //记录开始计算的时间
+//        $calc_id = uniqid('perf_');
+//        CalcOperation::record($calc_id, $periodNum);
+//        Period::updateAll(['START_EXEC_TIME' => time(), 'CALC_ID' => $calc_id], ['PERIOD_NUM' => $periodNum]);
+//
+//        $formModel = new PeriodForm();
+//        $formModel->scenario = 'autoPerf';
+//
+//        if ($formModel->load(Yii::$app->request->get(), '') && $formModel->autoPerf()) {
+//            //设置预计算进行中标识
+//            Period::updatePeriodIsPreparing($periodNum, Period::IS_PREPARING);
+//            //设置redis开关
+//            Yii::$app->cache->set('isPreparing', 1, 3600);
+//            return static::notice('预计算已开始,请等待');
+//        } else {
+//            return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
+//        }
+//    }
 
     /**自动计算 对应界面按钮
      * @return mixed
@@ -74,9 +74,9 @@ class CalcController extends BaseController
         if (Period::isProcessing($periodNum)) {
             return static::notice('有操作正在进行中请稍后', 400);
         }
-        if (!Period::checkClose($periodNum)) { // 如果未封期
-            return static::notice('没有封期不能计算', 400);
-        }
+//        if (!Period::checkClose($periodNum)) { // 如果未封期
+//            return static::notice('没有封期不能计算', 400);
+//        }
         //设置计算进行中标识
         Period::updatePeriodIsProcessing($periodNum, Period::IS_PROCESSING);
         //设置自动计算标识

+ 47 - 47
backendEle/src/views/bonus/period.vue

@@ -7,12 +7,12 @@
       </div>
       <el-table :data="tableData" stripe style="width: 100%;" @selection-change="handleSelectionChange"
                 :height="tool.getTableHeight()">
-        <el-table-column prop="PERIOD_NUM" label="Number of periods"><!-- 期数 -->
+        <el-table-column prop="PERIOD_NUM" label="Period No." width="100"><!-- 期数 -->
           <template slot-scope="scope">
             <el-tag type="" size="small" class="no-border">{{scope.row.PERIOD_NUM}}</el-tag>
           </template>
         </el-table-column>
-        <el-table-column label="Bonus Month" width="100"><!-- 所在结算月 -->
+        <el-table-column label="Bonus Month" width="110"><!-- 所在结算月 -->
           <template slot-scope="scope">
             <el-tag type="warning" size="small" class="no-border">{{scope.row.CALC_YEAR}}-{{scope.row.CALC_MONTH}}
             </el-tag>
@@ -29,55 +29,55 @@
             {{getWatTime(scope.row.CLOSED_AT)}}
           </template>
         </el-table-column>
-        <el-table-column label="Performance sheet progress" width="90"><!-- 业绩单进度 -->
-          <template slot-scope="scope">
-            <el-progress type="circle" :percentage="Number.parseInt(percentList['PERF_PERCENT'][scope.row.ID])"
-                         :width="50" :stroke-width="3"></el-progress>
-          </template>
-        </el-table-column>
-        <el-table-column label="Time of generating performance sheet" width="210"><!-- 生成业绩单时间 -->
+<!--        <el-table-column label="Performance sheet progress" width="90">&lt;!&ndash; 业绩单进度 &ndash;&gt;-->
+<!--          <template slot-scope="scope">-->
+<!--            <el-progress type="circle" :percentage="Number.parseInt(percentList['PERF_PERCENT'][scope.row.ID])"-->
+<!--                         :width="50" :stroke-width="3"></el-progress>-->
+<!--          </template>-->
+<!--        </el-table-column>-->
+        <el-table-column label="Time of generating performance sheet" width="230"><!-- 生成业绩单时间 -->
           <template slot-scope="scope">
             <!-- 开始 -->start:{{getWatTime(scope.row.PERF_STARTED_AT)}}<br>
             <!-- 完成 -->complete:{{getWatTime(scope.row.PERFED_AT)}}
           </template>
         </el-table-column>
-        <el-table-column label="Settlement progress" width="80"><!-- 结算进度 -->
-          <template slot-scope="scope">
-            <el-progress type="circle" :percentage="Number.parseInt(percentList['CALC_PERCENT'][scope.row.ID])"
-                         :width="50" :stroke-width="3"></el-progress>
-          </template>
-        </el-table-column>
-        <el-table-column label="Date" width="210"><!-- 结算时间 -->
+<!--        <el-table-column label="Settlement progress" width="80">&lt;!&ndash; 结算进度 &ndash;&gt;-->
+<!--          <template slot-scope="scope">-->
+<!--            <el-progress type="circle" :percentage="Number.parseInt(percentList['CALC_PERCENT'][scope.row.ID])"-->
+<!--                         :width="50" :stroke-width="3"></el-progress>-->
+<!--          </template>-->
+<!--        </el-table-column>-->
+        <el-table-column label="Settlement Date" width="230"><!-- 结算时间 -->
           <template slot-scope="scope">
             <!-- 开始 -->start:{{getWatTime(scope.row.CALCULATE_STARTED_AT)}}<br>
             <!-- 完成 -->complete:{{getWatTime(scope.row.CALCULATED_AT)}}
           </template>
         </el-table-column>
-        <el-table-column label="Network connection progress" width="80"><!-- 挂网进度 -->
-          <template slot-scope="scope">
-            <el-progress type="circle" :percentage="Number.parseInt(percentList['SENT_PERCENT'][scope.row.ID])"
-                         :width="50" :stroke-width="3"></el-progress>
-          </template>
-        </el-table-column>
-        <el-table-column label="Network connection time" width="210"><!-- 挂网时间 -->
+<!--        <el-table-column label="Network connection progress" width="80">&lt;!&ndash; 挂网进度 &ndash;&gt;-->
+<!--          <template slot-scope="scope">-->
+<!--            <el-progress type="circle" :percentage="Number.parseInt(percentList['SENT_PERCENT'][scope.row.ID])"-->
+<!--                         :width="50" :stroke-width="3"></el-progress>-->
+<!--          </template>-->
+<!--        </el-table-column>-->
+        <el-table-column label="Network connection time" width="230"><!-- 挂网时间 -->
           <template slot-scope="scope">
             <!-- 开始 -->start:{{getWatTime(scope.row.SEND_STARTED_AT)}}<br/>
             <!-- 完成 -->complete:{{getWatTime(scope.row.SENT_AT)}}
           </template>
         </el-table-column>
-        <el-table-column fixed="right" label="Action" width="180"><!-- 操作 -->
+        <el-table-column fixed="right" label="Action" width=""><!-- 操作 -->
           <template slot-scope="scope">
-            <el-button v-if="scope.row.IS_CAN_CLOSE && permission.hasPermission(`bonus/close-period`)" class="button" type="primary"
-                       @click.native="autoPerfHandle(scope.row.PERIOD_NUM)" >
-              预计算
-            </el-button>
+<!--            <el-button v-if="scope.row.IS_CAN_CLOSE && permission.hasPermission(`bonus/close-period`)" class="button" type="primary"-->
+<!--                       @click.native="trialCalcHandle(scope.row.PERIOD_NUM)" >-->
+<!--              计算-->
+<!--            </el-button>-->
+            <el-button v-if="scope.row.IS_CAN_CLOSE || scope.row.IS_CAN_PERF" type="primary" class="button"
+                       @click="dialogTableVisible = true;currentPeriod = scope.row.PERIOD_NUM;getDialogData();">
+              操作</el-button>
             <el-button v-if="scope.row.IS_CAN_CLOSE && permission.hasPermission(`bonus/close-period`)" type="primary" class="button"
                        @click.native="closeHandle(scope.row)">
               Closure period<!-- 封期 -->
             </el-button>
-            <el-button v-if="scope.row.IS_CAN_PERF" type="primary" class="button"
-                       @click="dialogTableVisible = true;currentPeriod = scope.row.PERIOD_NUM;getDialogData();">
-              操作</el-button>
             <el-button @click.native="sentHandle(scope.row)" type="primary" class="button"
                               v-if="scope.row.IS_CAN_SENT && permission.hasPermission(`bonus/send-period`)">
               <!-- 挂网 -->spread a net
@@ -373,22 +373,22 @@ export default {
       }).catch(response => {
       })
     },
-    autoPerfHandle (currentPeriod) {
-      this.$confirm('Confirm to calculate bonus data for the current period?', 'Hint', { // '确定对当前期进行生成业绩单操作?', '提示'
-        confirmButtonText: 'confirm', // 确定
-        cancelButtonText: 'cancel', // 取消
-        type: 'warning'
-      }).then(() => {
-        return network.getData(`calc/auto-perf/${currentPeriod}`)
-      }).then(response => {
-        this.$message({
-          message: response,
-          type: 'success'
-        })
-        this.getDialogData(this.currentPage, this.pageSize)
-      }).catch(response => {
-      })
-    },
+    // trialCalcHandle (currentPeriod) {
+    //   this.$confirm('Confirm to calculate bonus data for the current period?', 'Hint', { // '确定对当前期进行生成业绩单操作?', '提示'
+    //     confirmButtonText: 'confirm', // 确定
+    //     cancelButtonText: 'cancel', // 取消
+    //     type: 'warning'
+    //   }).then(() => {
+    //     return network.getData(`calc/trial-calc/${currentPeriod}`)
+    //   }).then(response => {
+    //     this.$message({
+    //       message: response,
+    //       type: 'success'
+    //     })
+    //     this.getDialogData(this.currentPage, this.pageSize)
+    //   }).catch(response => {
+    //   })
+    // },
 
     getDialogData () {
       let vueObj = this

+ 1 - 1
common/components/SwooleAsyncTimer.php

@@ -55,7 +55,7 @@ class SwooleAsyncTimer extends SwooleAsyncTimerComponent implements SocketInterf
         CalcConsole::listenCalcPeriod();
         //业务系统预计算相关启动逻辑
         CalcConsole::autoPrePerf();
-        CalcConsole::listenAutoPerfPeriod();
+//        CalcConsole::listenAutoPerfPeriod();
         return true;
     }
 

+ 40 - 100
common/helpers/bonus/Calc/CalcConsole.php

@@ -58,17 +58,17 @@ class CalcConsole extends BaseBusiness
             //开始挂网 或者 已挂网 则直接返回
             return true;
         }
-
-        if ($businessPeriod['IS_CLOSED']==0) {
-            // 如果没有封期 则直接返回
-            return true;
-        }
+//        if ($businessPeriod['IS_CLOSED']==0) {
+//            // 如果没有封期 则直接返回
+//            return true;
+//        }
 
         //用户选择是否自动执行
         $autoExec             = $businessPeriod['AUTO_EXEC'] > Period::MANUAL_EXEC_CALC;
         $businessIsCalculated = $businessPeriod['IS_CALCULATED'] == Period::CALCULATE_FINISH;
         $startExecTime        = $businessPeriod['START_EXEC_TIME'] ?? 0;
         $businessIsProcessing = $businessPeriod['IS_PROCESSING'] ?? 0;
+        $isPreparing = $businessPeriod['IS_PREPARING'];
 
         echo $businessPeriod['IS_CALCING'];
         //同步计算进度日志到业务系统
@@ -77,7 +77,7 @@ class CalcConsole extends BaseBusiness
             \Yii::$app->db->createCommand()->update('AR_PERIOD', ['IS_CALCING' => 0], 'PERIOD_NUM=' . $period['PERIOD_NUM'])->execute();
         }
 
-        if (2 == $period['IS_PREPARE'] && 1 == $period['IS_PERFED'] && $autoExec && !$businessIsProcessing) {
+        if (2 == $period['IS_PREPARE'] && 1 == $period['IS_PERFED'] && ($autoExec || $isPreparing) && !$businessIsProcessing) {
             //拉取期业绩
             CalcRecord::record($period['PERIOD_NUM'], '【期业绩】第' . $period['PERIOD_NUM'] . '期的业绩数据已生成');
             CalcRecord::record($period['PERIOD_NUM'], '【期业绩】开始获取第' . $period['PERIOD_NUM'] . '期的期业绩数据');
@@ -101,7 +101,7 @@ class CalcConsole extends BaseBusiness
             return \Yii::$app->$db->createCommand()->update('AR_PERIOD', ['IS_PREPARE' => 3], 'PERIOD_NUM=:PERIOD_NUM', ['PERIOD_NUM' => $period['PERIOD_NUM']])->execute();
         }
 
-        if (4 == $period['IS_PREPARE'] && 1 == $period['IS_CALCULATED'] && $autoExec && !$businessIsProcessing && !$businessIsCalculated) {
+        if (4 == $period['IS_PREPARE'] && 1 == $period['IS_CALCULATED'] && ($autoExec || $isPreparing) && !$businessIsProcessing && !$businessIsCalculated) {
             CalcRecord::record($period['PERIOD_NUM'], '【奖金计算】第' . $period['PERIOD_NUM'] . '期的奖金已计算完成');
             CalcRecord::record($period['PERIOD_NUM'], '【奖金计算】开始拉取第' . $period['PERIOD_NUM'] . '期的奖金数据');
 
@@ -123,6 +123,8 @@ class CalcConsole extends BaseBusiness
                 CalcOperation::closeOperation($businessPeriod['CALC_ID']);
                 //拉取计算系统的进度日志
                 self::syncLogRecord($period['PERIOD_NUM'], $db, $startExecTime);
+                //设置计算进行中标识
+                Period::updatePeriodIsPreparing($period['PERIOD_NUM'], Period::NOT_PREPARING);
                 //设置redis开关
                 Yii::$app->cache->set('isCalcing', 0);
             } else {
@@ -131,6 +133,10 @@ class CalcConsole extends BaseBusiness
                 \Yii::$app->$db->createCommand()->update('AR_PERIOD', ['CALC_ID' => ''], 'PERIOD_NUM=:PERIOD_NUM', ['PERIOD_NUM' => $period['PERIOD_NUM']])->execute();
                 CalcOperation::closeOperation($businessPeriod['CALC_ID']);
                 CalcRecord::record($period['PERIOD_NUM'], '【奖金计算】第' . $period['PERIOD_NUM'] . '期的奖金数据获取失败,原因:' . $res['msg']);
+                //设置计算进行中标识
+                Period::updatePeriodIsPreparing($period['PERIOD_NUM'], Period::NOT_PREPARING);
+                //设置redis开关
+                Yii::$app->cache->set('isCalcing', 0);
                 return $res;
             }
             return true;
@@ -139,114 +145,48 @@ class CalcConsole extends BaseBusiness
         return true;
     }
 
-    public static function autoPrePerf(){ // 自动预结
+    public static function autoPrePerf(){ // 定时计
         $nowTs = time();
         $currentPeriod = Period::find()->where('START_TIME< :NOW_TIME',['NOW_TIME'=>$nowTs])->where('END_TIME>= :NOW_TIME',['NOW_TIME'=>$nowTs-6])->asArray()->one();
         $periodNum = $currentPeriod['PERIOD_NUM'];
         if (
             Period::isPreparing($periodNum)
-            || $currentPeriod['IS_MONTH'] == 0
+//            || $currentPeriod['IS_MONTH'] == 0
         ) {
             return;
         }
-        if($nowTs+86400>$currentPeriod['END_TIME'] ){
-            $nowMin = date("i", $nowTs);
-            $nowSec = date("s", $nowTs);
-            if(($nowMin!=0 || $nowSec >= 5 ) || Period::isPreparing($periodNum)){ // 当不是整点小时,当计算中,不计算
-                return;
-            }
-            print_r($periodNum."该预结算".$nowMin.PHP_EOL.$nowSec);
-            //设置计算进行中标识
-            Period::updatePeriodIsPreparing($periodNum, Period::IS_PREPARING);
-            //设置自动计算标识
-            Period::updatePeriodIsAutoExec($periodNum, Period::MANUAL_EXEC_CALC);
-            //记录开始计算的时间
-            $calc_id = uniqid('calc_');
-            CalcOperation::record($calc_id, $periodNum);
-            Period::updateAll(['START_EXEC_TIME' => time(), 'CALC_ID' => $calc_id], ['PERIOD_NUM' => $periodNum]);
-            $formModel = new PeriodForm();
-            $formModel->scenario = 'autoPerf';
-
-            if($formModel->load(['periodNum'=>$periodNum], '') && $formModel->autoPrePerf()) {
-                echo('自动计算已开始,请等待'.PHP_EOL);
-                //设置redis开关
-                Yii::$app->cache->set('isPreparing', 1, 3600);
-                CalcRecord::record($periodNum, '【定时计算】第' . $periodNum . '期,定时计算开始');
-            } else {
-                echo('自动计算未开始'.PHP_EOL);
-                CalcRecord::record($periodNum, '【定时计算】第' . $periodNum . '期,定时计算未开始');
-            }
-            return;
-        }else{
+
+        $nowDate = date("d", $nowTs);
+        $nowMin = date("i", $nowTs);
+        $nowSec = date("s", $nowTs);
+        if($nowDate >1 && $nowDate <= 15 || (($nowMin!=0 || $nowSec >= 5 ) || Period::isPreparing($periodNum)) ){ // 当不是整点小时,当计算中,不计算
             return;
         }
-    }
 
-    public static function listenAutoPerfPeriod() // 拉取预结算的结果
-    {
-        // 先检查redis的开关
-        $preparingSwitch = Yii::$app->cache->get('isPreparing') ? 1 : 0;
-        if(!$preparingSwitch){
-            return true;
-        }
-        $db        = self::CALC_DB_NAME;
-        $allPeriod = \Yii::$app->$db->createCommand("SELECT * FROM AR_PERIOD order by PERIOD_NUM desc")->queryAll();
-        $period    = [];
-        foreach ($allPeriod as $v) {
-            if ($v['IS_PREPARE'] > 0) {
-                $period = $v;
-                break;
-            }
-        }
-        if (empty($period)) {
-            return true;
-        }
-        $businessPeriod = Period::find()->where(['PERIOD_NUM' => $period['PERIOD_NUM']])->asArray()->one();
+        print_r($periodNum."该预结算".$nowMin.PHP_EOL.$nowSec);
 
-        if(!$period['CALC_ID'] || $period['CALC_ID'] != $businessPeriod['CALC_ID']) { // 如果计算ID不符,则退出
-            return true;
-        }
+        //设置计算进行中标识
+        Period::updatePeriodIsPreparing($periodNum, Period::IS_PREPARING);
+        //设置自动计算标识
+        Period::updatePeriodIsAutoExec($periodNum, Period::AUTO_EXEC_CALC);
+        //记录开始计算的时间
+        $calc_id = uniqid('calc_');
+        CalcOperation::record($calc_id, $periodNum);
+        Period::updateAll(['START_EXEC_TIME' => time(), 'CALC_ID' => $calc_id], ['PERIOD_NUM' => $periodNum]);
+        $formModel = new PeriodForm();
+        $formModel->scenario = 'autoPerf';
 
-        $startExecTime = $businessPeriod['START_EXEC_TIME'] ?? 0;
-        if (
-            $businessPeriod['SEND_STARTED_AT'] > 0 || $businessPeriod['IS_SENT'] > 0 // 已挂网
-            || 1 != $businessPeriod['IS_PREPARING'] // 未在预计算中
-            || $period['PERFED_AT'] < $businessPeriod['START_EXEC_TIME'] // 计算服务中的计算时间,早于业务系统开始计算时间,说明是旧的,不拉取
-        ){
-            return false;
+        if($formModel->load(['periodNum'=>$periodNum], '') && $formModel->autoPrePerf()) {
+            echo('自动计算已开始,请等待'.PHP_EOL);
+            //设置redis开关
+            Yii::$app->cache->set('isCalcing', 1, 3600);
+            CalcRecord::record($periodNum, '【定时计算】第' . $periodNum . '期,定时计算开始');
+        } else {
+            echo('自动计算未开始'.PHP_EOL);
+            CalcRecord::record($periodNum, '【定时计算】第' . $periodNum . '期,定时计算未开始');
         }
-        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'] . '期的预计算期业绩数据');
+        return;
 
-            Period::updatePeriodIsPreparing($period['PERIOD_NUM'], Period::IS_PREPARING);
-            $res = (new PullPerfDataFromCalc($period['PERIOD_NUM']))->start();
-            if (200 == $res['code']) {
-//                Period::updatePeriodIsProcessing($period['PERIOD_NUM'], Period::NOT_PROCESSING);
-                //设置预计算标识
-                Period::updatePeriodIsPreparing($period['PERIOD_NUM'], Period::NOT_PREPARING);
-                CalcRecord::record($period['PERIOD_NUM'], '【期业绩】第' . $period['PERIOD_NUM'] . '期的预计算期业绩数据已获取');
-                \Yii::$app->$db->createCommand()->update('AR_PERIOD', ['CALC_ID' => ''], 'PERIOD_NUM=:PERIOD_NUM', ['PERIOD_NUM' => $period['PERIOD_NUM']])->execute();
-                CalcOperation::closeOperation($businessPeriod['CALC_ID']);
-                self::syncLogRecord($period['PERIOD_NUM'], $db, $startExecTime);
-                Yii::$app->cache->set('isPreparing', 0);
-                return $res;
-            } else {
-                //结束计算状态
-//                Period::updatePeriodIsProcessing($period['PERIOD_NUM'], Period::NOT_PROCESSING);
-                //设置预计算标识
-                Period::updatePeriodIsPreparing($period['PERIOD_NUM'], Period::NOT_PREPARING);
-                \Yii::$app->$db->createCommand()->update('AR_PERIOD', ['CALC_ID' => ''], 'PERIOD_NUM=:PERIOD_NUM', ['PERIOD_NUM' => $period['PERIOD_NUM']])->execute();
-                CalcOperation::closeOperation($businessPeriod['CALC_ID']);
-                CalcRecord::record($period['PERIOD_NUM'], '【期业绩】第' . $period['PERIOD_NUM'] . '期的预计算期业绩数据获取失败,原因:' . $res['msg']);
-                return $res;
-            }
-        }
-        return true;
     }
 
     /**

+ 5 - 5
common/models/forms/PeriodForm.php

@@ -73,11 +73,11 @@ class PeriodForm extends Model
                 $this->addError($attributes, '所传期数不可封期');
             }
         }
-        elseif($this->scenario == 'perf') {
-            if(!$periodObj->isCanPerf($this->periodNum)){
-                $this->addError($attributes, '所传期数不可生成业绩单');
-            }
-        }
+//        elseif($this->scenario == 'perf') {
+//            if(!$periodObj->isCanPerf($this->periodNum)){
+//                $this->addError($attributes, '所传期数不可生成业绩单');
+//            }
+//        }
         elseif($this->scenario == 'calc') {
             if(!$periodObj->isCanCalc($this->periodNum)){
                 $this->addError($attributes, '所传期数不可结算');

+ 1 - 3
frontendApi/modules/v1/controllers/BonusController.php

@@ -135,9 +135,7 @@ class BonusController extends BaseController {
             return static::notice(['user' => [],'team'=>[]]);
         }
         // 判断当前时间,是否临近封期,否则隐藏
-        $nowTs = time();
-        $currentPeriodEnd = Period::getEndTime($periodNum);
-        if ($nowTs + 432000 <= $currentPeriodEnd || $currentPeriodEnd < $nowTs || ($periodNum % 2)) {
+        if ($periodNum % 2!=0) {
             return static::notice(['user' => [],'team'=>[]]);
         }
         $userInfo = User::getEnCodeInfo($userId);