root 4 лет назад
Родитель
Сommit
2497630e62
2 измененных файлов с 85 добавлено и 80 удалено
  1. 80 80
      common/helpers/bonus/BonusCalc.php
  2. 5 0
      common/helpers/bonus/CalcCache.php

+ 80 - 80
common/helpers/bonus/BonusCalc.php

@@ -171,9 +171,9 @@ class BonusCalc extends BaseObject {
             $this->clearCalcTableData();
             $t2 = microtime(true);
             echo('初始化、清空缓存及相关数据表完成,耗时:' . round($t2 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(5);
-            $t3 = microtime(true);
             $this->_updatePercent(10);
+            $t3 = microtime(true);
+            $this->_updatePercent(20);
             // 奖金部分
             if($this->_sysConfig['openFW']['VALUE']) {
                 $this->calcBonusBDStepOne();
@@ -181,65 +181,65 @@ class BonusCalc extends BaseObject {
             }
             $t4 = microtime(true);
             echo('计算服务奖'.($this->_sysConfig['openFW']['VALUE']?'完成':'关闭').',耗时:' . round($t4 - $t3, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(15);
-
-            if($this->_sysConfig['openTG']['VALUE']) {
-                $this->calcBonusTG();
-            }
-            $t5 = microtime(true);
-            echo('计算推广奖'.($this->_sysConfig['openTG']['VALUE']?'完成':'关闭').',耗时:' . round($t5 - $t4, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(20);
-
-            if($this->_sysConfig['openXF']['VALUE']) {
-                if( $this->_sysConfig['consumeRecPercent']['VALUE'] > 0 ) {
-                    $this->calcBonusXFToRec();
-                }
-                if( $this->_sysConfig['consumeSelfPercent']['VALUE'] > 0 ) {
-                    $this->calcBonusXFToSelf();
-                }
-            }
-            $t6 = microtime(true);
-            echo('计算消费奖'.($this->_sysConfig['openXF']['VALUE']?'完成':'关闭').',耗时:' . round($t6 - $t5, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(25);
-
-            if($this->_sysConfig['openYJ']['VALUE']) {
-                $this->calcBonusBdYJ();
-            }
-            $t7 = microtime(true);
-            echo('计算报单业绩奖'.($this->_sysConfig['openYJ']['VALUE']?'完成':'关闭').',耗时:' . round($t7 - $t6, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(30);
 
-            if($this->_sysConfig['fxOpenYJ']['VALUE']) {
-                $this->calcBonusFxYJ();
-            }
-            $t8 = microtime(true);
-            echo('计算复消业绩奖'.($this->_sysConfig['fxOpenYJ']['VALUE']?'完成':'关闭').',耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(35);
+            // if($this->_sysConfig['openTG']['VALUE']) {
+            //     $this->calcBonusTG();
+            // }
+            // $t5 = microtime(true);
+            // echo('计算推广奖'.($this->_sysConfig['openTG']['VALUE']?'完成':'关闭').',耗时:' . round($t5 - $t4, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            // $this->_updatePercent(20);
+
+            // if($this->_sysConfig['openXF']['VALUE']) {
+            //     if( $this->_sysConfig['consumeRecPercent']['VALUE'] > 0 ) {
+            //         $this->calcBonusXFToRec();
+            //     }
+            //     if( $this->_sysConfig['consumeSelfPercent']['VALUE'] > 0 ) {
+            //         $this->calcBonusXFToSelf();
+            //     }
+            // }
+            // $t6 = microtime(true);
+            // echo('计算消费奖'.($this->_sysConfig['openXF']['VALUE']?'完成':'关闭').',耗时:' . round($t6 - $t5, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            // $this->_updatePercent(25);
+
+            // if($this->_sysConfig['openYJ']['VALUE']) {
+            //     $this->calcBonusBdYJ();
+            // }
+            // $t7 = microtime(true);
+            // echo('计算报单业绩奖'.($this->_sysConfig['openYJ']['VALUE']?'完成':'关闭').',耗时:' . round($t7 - $t6, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            // $this->_updatePercent(30);
+
+            // if($this->_sysConfig['fxOpenYJ']['VALUE']) {
+            //     $this->calcBonusFxYJ();
+            // }
+            // $t8 = microtime(true);
+            // echo('计算复消业绩奖'.($this->_sysConfig['fxOpenYJ']['VALUE']?'完成':'关闭').',耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            // $this->_updatePercent(35);
 
 
             if($this->_sysConfig['openQY']['VALUE']) {
                 $this->calcBonusQY();
-                $this->calcBonusBdQY();
-                $this->calcBonusFxQY();
+                // $this->calcBonusBdQY();
+                // $this->calcBonusFxQY();
             }
             $t9 = microtime(true);
             echo('计算团队奖'.($this->_sysConfig['openQY']['VALUE']?'完成':'关闭').',耗时:' . round($t9 - $t8, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(40);
 
-            if($this->_sysConfig['openGX']['VALUE']) {
-                $this->calcBonusGXBefore();
-                $this->calcBonusGX();
-            }
-            $t11 = microtime(true);
-            echo('计算共享奖'.($this->_sysConfig['openGX']['VALUE']?'完成':'关闭').',耗时:' . round($t11 - $t9, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(45);
-
-            if($this->_sysConfig['openGL']['VALUE']) {
-                $this->calcBonusBdGL();
-            }
-            $t13 = microtime(true);
-            echo('计算报单管理奖'.($this->_sysConfig['openGL']['VALUE']?'完成':'关闭').',耗时:' . round($t13 - $t11, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(50);
+            // if($this->_sysConfig['openGX']['VALUE']) {
+            //     $this->calcBonusGXBefore();
+            //     $this->calcBonusGX();
+            // }
+            // $t11 = microtime(true);
+            // echo('计算共享奖'.($this->_sysConfig['openGX']['VALUE']?'完成':'关闭').',耗时:' . round($t11 - $t9, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            // $this->_updatePercent(45);
+
+            // if($this->_sysConfig['openGL']['VALUE']) {
+            //     $this->calcBonusBdGL();
+            // }
+            // $t13 = microtime(true);
+            // echo('计算报单管理奖'.($this->_sysConfig['openGL']['VALUE']?'完成':'关闭').',耗时:' . round($t13 - $t11, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            // $this->_updatePercent(50);
 
 //            if($this->_sysConfig['fxOpenGL']['VALUE']) {
 //                $this->calcBonusFxGL();
@@ -248,37 +248,37 @@ class BonusCalc extends BaseObject {
 //            echo('计算复消管理奖'.($this->_sysConfig['fxOpenGL']['VALUE']?'完成':'关闭').',耗时:' . round($t14 - $t13, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
 //            $this->_updatePercent(70);
 
-            if($this->_sysConfig['openYC']['VALUE']) {
-                $this->calcBonusYCStepOne();
-                $this->calcBonusYCStepTwo();
-            }
-            $t16 = microtime(true);
-            echo('计算荣衔奖'.($this->_sysConfig['openYC']['VALUE']?'完成':'关闭').',耗时:' . round($t16 - $t13, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(55);
-
-            if($this->_sysConfig['openVIP']['VALUE']) {
-                $this->calcBonusVIP();
-            }
-            $t17 = microtime(true);
-            echo('计算VIP奖'.($this->_sysConfig['openVIP']['VALUE']?'完成':'关闭').',耗时:' . round($t17 - $t16, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(60);
-
-            if($this->_sysConfig['openJXS']['VALUE']) {
-                $this->calcBonusStandard();
-            }
+            // if($this->_sysConfig['openYC']['VALUE']) {
+            //     $this->calcBonusYCStepOne();
+            //     $this->calcBonusYCStepTwo();
+            // }
+            // $t16 = microtime(true);
+            // echo('计算荣衔奖'.($this->_sysConfig['openYC']['VALUE']?'完成':'关闭').',耗时:' . round($t16 - $t13, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            // $this->_updatePercent(55); // 月结
+
+            // if($this->_sysConfig['openVIP']['VALUE']) {
+            //     $this->calcBonusVIP();
+            // }
+            // $t17 = microtime(true);
+            // echo('计算VIP奖'.($this->_sysConfig['openVIP']['VALUE']?'完成':'关闭').',耗时:' . round($t17 - $t16, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            // $this->_updatePercent(60);
+
+            // if($this->_sysConfig['openJXS']['VALUE']) {
+            //     $this->calcBonusStandard();
+            // }
             $t18 = microtime(true);
-            echo('计算达标奖'.($this->_sysConfig['openJXS']['VALUE']?'完成':'关闭').',耗时:' . round($t18 - $t17, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(65);
+            // echo('计算达标奖'.($this->_sysConfig['openJXS']['VALUE']?'完成':'关闭').',耗时:' . round($t18 - $t17, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            // $this->_updatePercent(65);
 
             //把奖金会员写入缓存
             $this->loopMonthBonusUserFromDbToCache();
             $t19 = microtime(true);
             echo('奖金会员写入缓存完成,耗时:' . round($t19 - $t18, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            $this->_updatePercent(70);
+            $this->_updatePercent(50);
 
             //奖金写库
             $this->loopBonusUsers();
-            $this->_updatePercent(75);
+            $this->_updatePercent(65);
             unset($calcWrite);
             $t20 = microtime(true);
             echo('奖金写库操作完成,耗时:' . round($t20 - $t19, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
@@ -395,16 +395,16 @@ class BonusCalc extends BaseObject {
         CalcBonus::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
 
         CalcBonusQY::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
-        CalcBonusBD::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
-        CalcBonusTG::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
-        CalcBonusYJ::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
-        CalcBonusGX::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
-        CalcBonusGL::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+        // CalcBonusBD::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+        // CalcBonusTG::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+        // CalcBonusYJ::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+        // CalcBonusGX::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+        // CalcBonusGL::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
         // 月结时要清空的数据
         if ($this->_isCalcMonth) {
-            CalcBonusYC::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
-            CalcBonusVIP::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
-            CalcBonusStandard::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+            // CalcBonusYC::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+            // CalcBonusVIP::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
+            // CalcBonusStandard::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
             ScoreMonth::pageDeleteAll('PERIOD_NUM='.$this->_periodNum);
         }
     }

+ 5 - 0
common/helpers/bonus/CalcCache.php

@@ -211,6 +211,11 @@ class CalcCache {
     public static function addUsers($periodNum, $offset = 0, $limit = self::LIMIT) {
 //        echo sprintf("时间:[%s]缓存用户,当前offset为:【%s】" . PHP_EOL, date('Y-m-d H:i:s', time()) , $offset);
         // 修复USER_INFO表里面已经没有PERIOD_NUM了
+        file_put_contents('awws.txt', var_export([
+            'periodNum' => $periodNum,
+            'offset' => $offset,
+            'limit' => $limit
+        ],true));
         $allData = UserInfo::findUseDbCalc()->from(UserInfo::tableName(). 'AS UI')->select('UI.USER_ID,U.STATUS')->leftJoin(User::tableName() . 'AS U', 'U.ID=UI.USER_ID')->where('1=1')->orderBy('UI.RELATION_DEEP DESC,UI.ID DESC')->offset($offset)->limit($limit)->asArray()->all();
         //$allData = User::findUseDbShopCalc()->select('ID AS USER_ID')->where('PERIOD_AT<=:PERIOD_AT AND IS_UNION=0 AND DELETED=0', [':PERIOD_AT' => $periodNum])->offset($offset)->limit($limit)->asArray()->all();
         if ($allData) {