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

feat: UN-71: 奖金管理-封期管理:结算按钮规则调整.

kevin 1 год назад
Родитель
Сommit
a8b1bfca1d
2 измененных файлов с 27 добавлено и 25 удалено
  1. 0 7
      backendApi/modules/v1/controllers/BonusController.php
  2. 27 18
      common/models/Period.php

+ 0 - 7
backendApi/modules/v1/controllers/BonusController.php

@@ -8,7 +8,6 @@
 
 namespace backendApi\modules\v1\controllers;
 
-use backendApi\modules\v1\models\Admin;
 use backendApi\modules\v1\models\exportForms\BonusExportForm;
 use backendApi\modules\v1\models\lists\bonus\BalanceList;
 use backendApi\modules\v1\models\lists\bonus\FlowBalanceList;
@@ -40,8 +39,6 @@ use backendApi\modules\v1\models\lists\bonus\TraceUpYcList;
 use backendApi\modules\v1\models\lists\bonus\TraceUpYjList;
 use backendApi\modules\v1\models\lists\bonus\UserPerfList;
 use common\helpers\Cache;
-use common\helpers\Date;
-use common\helpers\LoggerTool;
 use common\helpers\Tool;
 use common\helpers\user\Info;
 use common\helpers\user\Perf;
@@ -58,16 +55,12 @@ use common\models\User;
 use common\models\UserInfo;
 use common\models\UserNetwork;
 use common\models\UserPerf;
-use common\models\UserPerfAdjustment;
 use Yii;
 use common\helpers\Form;
-use common\models\Config;
 use common\models\FlowBonus;
-use common\models\FlowExchangePoints;
 use common\models\forms\PeriodForm;
 use common\models\forms\UserBonusForm;
 use common\models\Period;
-use Exception;
 use yii\web\HttpException;
 
 class BonusController extends BaseController {

+ 27 - 18
common/models/Period.php

@@ -540,30 +540,39 @@ class Period extends \common\components\ActiveRecord
      * @param $periodNum
      * @return bool
      */
-    public function isCanCalc($periodNum = null){
+    public function isCanCalc($periodNum = null) {
+        // 当前时间在当前期月份范围内、且没有挂网可以结算
         $period = $this->setPeriodNum($periodNum);
-        // 查看该期是否已经封期
-        if(!$period['IS_CLOSED']){
+        if ($period['IS_SENT'] == self::SEND_FINISH) {
             return false;
         }
-        // 还没有生成业绩单,不能封期
-        if(!$period['IS_PERFED'] || $period['IS_PERFED'] == self::PERF_FAIL){
-            return false;
-        }
-        if($period['IS_SENT'] == self::SEND_FINISH){
+        if ((time() < $period['START_TIME']) || (time() > $period['START_TIME'])) {
             return false;
         }
-//        $previousPeriod = static::findOneAsArray(['PERIOD_NUM'=>$this->periodNum-1]);
-//        if($previousPeriod){
-//            // 查看上一期是否已经挂网,上一期挂网了,本期才能结算
-//            if(!$previousPeriod['IS_SENT']){
-//                return false;
-//            }
+
+
+        // 查看该期是否已经封期
+//        if(!$period['IS_CLOSED']){
+//            return false;
+//        }
+//        // 还没有生成业绩单,不能封期
+//        if(!$period['IS_PERFED'] || $period['IS_PERFED'] == self::PERF_FAIL){
+//            return false;
+//        }
+//        if($period['IS_SENT'] == self::SEND_FINISH){
+//            return false;
+//        }
+////        $previousPeriod = static::findOneAsArray(['PERIOD_NUM'=>$this->periodNum-1]);
+////        if($previousPeriod){
+////            // 查看上一期是否已经挂网,上一期挂网了,本期才能结算
+////            if(!$previousPeriod['IS_SENT']){
+////                return false;
+////            }
+////        }
+//        //上1期奖金未发放,限制不能结算
+//        if(!$this->isLastSent($this->periodNum)){
+//            return false;
 //        }
-        //上1期奖金未发放,限制不能结算
-        if(!$this->isLastSent($this->periodNum)){
-            return false;
-        }
 
         return true;
     }