瀏覽代碼

feature/NG-27: Qualified bonus regulations 奖金合格制度:活动期间购买指定商品,BV≥27即可维持活跃度.

kevin 1 年之前
父節點
當前提交
9f8db20193
共有 2 個文件被更改,包括 10 次插入7 次删除
  1. 4 0
      common/helpers/bonus/CalcServePerfCalc.php
  2. 6 7
      common/models/User.php

+ 4 - 0
common/helpers/bonus/CalcServePerfCalc.php

@@ -638,6 +638,10 @@ class CalcServePerfCalc {
     }
 
     // 期业绩表,增加是否活跃字段判断,就用isPerfActive 方法进行判断。
+
+    /**
+     * @throws \yii\db\Exception
+     */
     public function loopUpdatePeriodActive($offset = 0) {
         echo sprintf("时间:[%s]更新期业绩表活跃状态字段,当前offset为:【%s】" . PHP_EOL, date('Y-m-d H:i:s', time()) , $offset);
         $allData = PerfPeriod::findUseDbCalc()

+ 6 - 7
common/models/User.php

@@ -470,12 +470,11 @@ class User extends \common\components\ActiveRecord
 //        return $pv >= $sysConfig['monthPcsPvFxCondition']['VALUE'] ? 1 : 0;
 //    }
 
-    // 判断会员是否活跃:1. 当月消费30BV. 2.任意水机+150粒的EKSP. (满足任意条件即可)
-
     /**
+     * 判断会员是否活跃:1. 当月消费30BV. 2.任意水机+150粒的EKSP. (满足任意条件即可)
      * @throws Exception
      */
-    public static function isPerfActive($userId, $periodNum, $calcYearMonth): bool
+    public static function isPerfActive($userId, $periodNum, $calcYearMonth): int
     {
         $sysConfig = Cache::getSystemConfig();
 
@@ -485,7 +484,7 @@ class User extends \common\components\ActiveRecord
             ->SUM('PV_PCS');
 
         if ($pv >= $sysConfig['monthPcsPvFxCondition']['VALUE']) {
-            return true;
+            return 1;
         }
 
         $periodObj = Period::instance();
@@ -502,7 +501,7 @@ class User extends \common\components\ActiveRecord
                 ['USER_ID' => $userId, 'P_CALC_MONTH' => $calcMonth, 'PERIOD_NUM' => $periodNum, ':SKU_CODE' => 'HES150N'])
             ->count();
         if (!$orderEKSP) {
-            return false;
+            return 0;
         }
 
         // 所有分期商品
@@ -515,9 +514,9 @@ class User extends \common\components\ActiveRecord
                 ['USER_ID' => $userId, 'P_CALC_MONTH' => $calcMonth, 'PERIOD_NUM' => $periodNum])
             ->count();
         if (!$orderInstalment) {
-            return false;
+            return 0;
         }
 
-        return true;
+        return 1;
     }
 }