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

去掉不需要的业绩计算和奖金项

zxiansheng 4 лет назад
Родитель
Сommit
5c71d1fe5c
2 измененных файлов с 81 добавлено и 77 удалено
  1. 76 72
      common/helpers/bonus/BonusCalc.php
  2. 5 5
      common/helpers/bonus/PerfCalc.php

+ 76 - 72
common/helpers/bonus/BonusCalc.php

@@ -183,63 +183,63 @@ class BonusCalc extends BaseObject {
             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();
-            }
+            // 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);
+            // 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);
+            $this->_updatePercent(65);
 
-            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,42 +248,46 @@ 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();
-            }
-            $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);
-
-            //把奖金会员写入缓存
+            // 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);
+
+            // 1. 封期 2. 执行 存储过程,月奖要插入到AR_CALC_MONTH_BONUS_USER表中. 这里直接入库
+            // 存储过程分2部分,一部分插入到月奖表中. 一部分计算真正奖金数据.分2部分进行执行.
+            //把奖金会员写入缓存 - 把往期有月奖金的会员加到本期有奖会员缓存列表中
+            // 比如如果重复执行,将此用户放到有奖金用户缓存中,统一插入.
             $this->loopMonthBonusUserFromDbToCache();
             $t19 = microtime(true);
             echo('奖金会员写入缓存完成,耗时:' . round($t19 - $t18, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(70);
 
             //奖金写库
+            // 这里增加新的奖金入库操作.
             $this->loopBonusUsers();
             $this->_updatePercent(75);
             unset($calcWrite);
             $t20 = microtime(true);
             echo('奖金写库操作完成,耗时:' . round($t20 - $t19, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
 
-            //把本期奖金会员入库
+            //把本期奖金会员入库 - 把缓存中的月奖用户信息存到数据库.存储过程的入库不在这里进行,这里代码取的缓存,存储过程没有缓存,在上面进行入库
             $this->loopMonthBonusUserToDb();
             $t21 = microtime(true);
             echo('奖金会员入库完成,耗时:' . round($t21 - $t20, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);

+ 5 - 5
common/helpers/bonus/PerfCalc.php

@@ -171,12 +171,12 @@ class PerfCalc {
             echo('本月业绩入库完成,耗时:' . round($t7 - $t6, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(95);
 
-            //达标业绩
-            $this->loopCalcPerfByStandardFXOrder();
-            //达标业绩入库
-            $this->loopWriteStandardPerf();
+            // //达标业绩
+            // $this->loopCalcPerfByStandardFXOrder();
+            // //达标业绩入库
+            // $this->loopWriteStandardPerf();
             $t8 = microtime(true);
-            echo('本月业绩入库完成,耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            //echo('本月业绩入库完成,耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(100);