root 3 лет назад
Родитель
Сommit
a9b39f4aea
3 измененных файлов с 351 добавлено и 166 удалено
  1. 25 38
      common/helpers/bonus/CalcServePerfCalc.php
  2. 326 0
      common/models/ServeLog.php
  3. 0 128
      common/models/ServeProcess.php

+ 25 - 38
common/helpers/bonus/CalcServePerfCalc.php

@@ -11,6 +11,7 @@ use common\models\PerfOrder;
 use common\models\PerfPeriod;
 use common\models\Period;
 use common\models\PerfMonth;
+use common\models\ServeLog;
 use common\models\ServeProcess;
 use common\models\User;
 use common\models\UserNetwork;
@@ -76,98 +77,83 @@ class CalcServePerfCalc {
      */
     public function calcStep($periodNum = null) {
         try {
-            $requestTime = time();
-            // if (empty($periodNum)) {
-            //     echo('触发时间:【'.$requestTime.'】'.'定时器执行累计业绩计算 ,内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            // } else {
-            //     echo('触发时间:【'.$requestTime.'】'.'手动触发累计业绩计算 ,内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            // }
             //一、查询此业绩状态,是否能进行计算
             $calcIng = $this->isCalcIng($periodNum);
-            ServeProcess::recordRequest($requestTime, $this->_periodNum, '', true);
             if ($calcIng !== true) {
-                //echo('触发时间:【'.date('Y-m-d H:i:s', time()).'】'.'业绩期表中,此期状态不正确');
-                //ServeProcess::recordRequest($requestTime, $this->_periodNum, '业绩期表中,此期状态不正确');
                 return false;
             } else {
                 // 将IS_PREPARE改成2,计算中
                 Period::updateCalcProcess(2, $this->_periodNum);
-                ServeProcess::recordRequest($requestTime, $this->_periodNum, '调整IS_PREPARE值为2,计算开始');
             }
-            
-            // 记录初始化数据,用户总数,业绩单业绩总pv值.
-            ServeProcess::recordDataInfo(time(), $this->_periodNum);
+
+            $this->initCalcTask();
+
+            // 日志----记录开始,业绩期,结算年月
+            ServeLog::periodMonth($this->_periodNum, $this->_calcYearMonth);
+
+            // 日志----记录推送过来的基础数据
+            ServeLog::basicData($this->_periodNum, $this->_calcYearMonth);
 
             $t1 = microtime(true);
             //二、初始化
-            $this->initCalcTask();
             echo '业绩期为:'.$this->_periodNum;
-            
             Period::updatePercent(10, $this->_periodNum);
-            ServeProcess::recordProcess($t1, time(), $this->_periodNum, '初始化---初始化配置');
-
-            $initT2 = microtime(true);
+            
             //三、 设置结算状态
             $this->setCalcStatus('start', $this->_periodNum);
-            ServeProcess::recordProcess($initT2, time(), $this->_periodNum, '初始化---设置结算状态');
-
-            $initT3 = microtime(true);
+            
             //四、 清空所有本期结算用到的缓存
             CalcCache::clearAll($this->_periodNum);
-            ServeProcess::recordProcess($initT3, time(), $this->_periodNum, '初始化---清空业绩缓存');
 
-            $initT4 = microtime(true);
             //五、 清空会员推荐和接点关系缓存
             CalcCache::clearNetCache();
-            ServeProcess::recordProcess($initT4, time(), $this->_periodNum, '初始化---清空会员推荐和接点关系缓存');
 
-            $initT5 = microtime(true);
             //六、 清空相关表数据
+            // 日志----清除业绩表
+            ServeLog::clearPerf($this->_periodNum, $this->_calcYearMonth);
             $this->clearTableData();
             $this->_updatePercent(15);
-            ServeProcess::recordProcess($initT5, time(), $this->_periodNum, '初始化---清空相关表数据');
 
             $t2 = microtime(true);
             echo(date('Y-m-d H:i:s',time()).'初始化、清空缓存及相关数据表完成,耗时:' . round($t2 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            ServeProcess::recordProcess($t1, $t2, $this->_periodNum, '初始化---初始化、清空缓存及相关数据表完成');
             
             //七、 添加缓存中用户数据
+            // 日志----开始缓存用户
+            ServeLog::noParamsLog($this->_periodNum, $this->_calcYearMonth, '缓存用户信息-开始');
             CalcCache::addUsers($this->_periodNum);
+            // 日志----缓存用户结束
+            ServeLog::cacheUserTotal($this->_periodNum, $this->_calcYearMonth);
+
             $t3 = microtime(true);
             echo(date('Y-m-d H:i:s',time()).'计算业绩向缓存中加入用户完成,耗时:' . round($t3 - $t2, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            ServeProcess::recordProcess($t2, $t3, $this->_periodNum, '计算业绩向缓存中加入用户完成');
             $this->_updatePercent(20);
 
             // 八、循环累计用户各项业绩数据
             $this->loopGrandPerf();
             $t4 = microtime(true);
             echo(date('Y-m-d H:i:s',time()).'累计用户业绩完成' . round($t4 - $t3, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            ServeProcess::recordProcess($t3, $t4, $this->_periodNum, '累计用户业绩完成');
             $this->_updatePercent(60);
             
             // 九、本期业绩入库
             $this->loopWriteNowPerf();
             $t6 = microtime(true);
             echo(date('Y-m-d H:i:s',time()).'本期业绩入库完成,耗时:' . round($t6 - $t4, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            ServeProcess::recordProcess($t4, $t6, $this->_periodNum, '本期业绩入库完成');
+            //日志----记录期业绩数据
+            ServeLog::perfPeriodInfo($this->_periodNum, $this->_calcYearMonth);
             $this->_updatePercent(70);
 
             //十、计算月业绩表中的数据
             $this->loopCalcMonthPerfTableData();
             $t7 = microtime(true);
             echo(date('Y-m-d H:i:s',time()).'计算月业绩表中的数据完成,耗时:' . round($t7 - $t6, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            if($this->_isCalcMonth) {
-                ServeProcess::recordProcess($t6, $t7, $this->_periodNum, '计算月业绩表中的数据完成');
-            }
             $this->_updatePercent(80);
 
             //十一、本月业绩入库
             $this->loopWriteMonthPerf();
             $t8 = microtime(true);
             echo(date('Y-m-d H:i:s',time()).'本月业绩入库完成,耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
-            if($this->_isCalcMonth) {
-                ServeProcess::recordProcess($t7, $t8, $this->_periodNum, '本月业绩入库完成');
-            }
+            //日志----记录月期业绩数据
+            ServeLog::perfMonthInfo($this->_periodNum, $this->_calcYearMonth);
             $this->_updatePercent(90);
             
 
@@ -176,9 +162,10 @@ class CalcServePerfCalc {
             $t9 = microtime(true);
             echo(date('Y-m-d H:i:s',time()).'期业绩表活跃状态更新完成,耗时:' . round($t9 - $t8, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(100);
-
-            ServeProcess::recordProcess($t6, $t7, $this->_periodNum, '计算业绩业绩结算全部完成');
+            //日志----记录期业绩表活跃多少人
+            ServeLog::perfPeriodActive($this->_periodNum, $this->_calcYearMonth);
             echo(date('Y-m-d H:i:s',time()).'计算业绩业绩结算全部完成,共耗时:' . round($t9 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
+            ServeLog::noParamsLog($this->_periodNum, $this->_calcYearMonth, '业绩计算完毕');
         } catch (\Exception $e) {
             $this->errorCalcTask();
             var_dump($e->getMessage());

+ 326 - 0
common/models/ServeLog.php

@@ -0,0 +1,326 @@
+<?php
+
+namespace common\models;
+
+use common\helpers\snowflake\SnowFake;
+use Exception;
+use Yii;
+
+/**
+ * This is the model class for table "{{%SERVE_LOG}}".
+ *
+ * @property string $ID
+ * @property string $PERIOD_NUM 业绩期
+ * @property string $LOG_DESCRIBE 日志信息
+ * @property string $CREATE_AT 创建时间
+ * @property string $CALC_MONTH 结算年月
+ */
+class ServeLog extends \common\components\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return '{{%SERVE_LOG}}';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['PERIOD_NUM', 'CALC_MONTH', 'CREATE_AT'], 'required'],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'PERIOD_NUM' => '业绩期',
+            'LOG_DESCRIBE' => '描述信息',
+            'CALC_MONTH' => '总人数',
+            'CREATE_AT' => '总业绩',
+        ];
+    }
+
+    // =============================业绩相关日志==========================================================================
+    /**
+     * 无逻辑日志,直接传文案
+     * @param int $periodNum
+     * @param int $calcMonth 业绩期
+     */
+    public static function noParamsLog($periodNum, $calcMonth, $desc) {
+        $logData[] = [
+            'PERIOD_NUM' => $periodNum,
+            'CALC_MONTH' => $calcMonth,
+            'LOG_DESCRIBE' => $desc,
+            'CREATE_AT' => time()
+        ];
+
+        ServeLog::batchInsert($logData);
+        return true;
+    }
+    
+    // 第一步,记录期数结算年月
+    /**
+     * 记录业绩期,结算年月
+     * @param int $periodNum
+     * @param int $calcMonth 业绩期
+     */
+    public static function periodMonth($periodNum, $calcMonth) {
+        $logData[] = [
+            'PERIOD_NUM' => $periodNum,
+            'CALC_MONTH' => $calcMonth,
+            'LOG_DESCRIBE' => "期数:$periodNum,结算年月:$calcMonth,开始计算业绩",
+            'CREATE_AT' => time()
+        ];
+
+        ServeLog::batchInsert($logData);
+        return true;
+    }
+
+    /**
+     * 记录推送过来的基础数据
+     * @param int $periodNum
+     * @param int $calcMonth 业绩期
+     */
+    public static function basicData($periodNum, $calcMonth) {
+        $userCount = User::find()->where('1=1')->count('ID');
+        $infoCount = UserInfo::find()->where('1=1')->count('ID');
+        $networkConut = UserNetwork::find()->where('1=1')->count('ID');
+        $userPerfConut = UserPerf::find()->where('1=1')->count('ID');
+        $calcBonusQyConut = CalcBonusQY::find()->where('1=1')->count('ID');
+        $perfPeriodCount = PerfPeriod::find()->where('1=1')->count('ID');
+        $perfOrderCount = PerfOrder::find()->where('1=1')->count('ID');
+        $relationCount = UserRelation::find()->where('1=1')->count('ID');
+        $periodCount = Period::find()->where('1=1')->count('ID');
+        $perfMonthCount = PerfMonth::find()->where('1=1')->count('ID');
+        $desc = "记录推送基础数据信息:AR_USER-推送用户总条数:$userCount;AR_USER_INFO-推送用户信息总条数:$infoCount;
+        AR_USER_NETWORK_NEW-推送安置网络总条数:$networkConut;AR_USER_PERF-推送用户结余业绩总条数:$userPerfConut;
+        AR_CALC_BONUS_QY-推送团队奖总条数:$calcBonusQyConut;AR_PERF_PERIOD-推送期业绩总条数:$perfPeriodCount;
+        AR_PERIOD-推送业绩期总条数:$periodCount;AR_USER_RELATION_NEW-推送开拓网络总条数:$relationCount;
+        AR_PERF_MONTH-推送月业绩表总条数:$perfMonthCount;AR_PERF_ORDER-推送业绩单总条数:$perfOrderCount";
+        $logData[] = [
+            'PERIOD_NUM' => $periodNum,
+            'CALC_MONTH' => $calcMonth,
+            'LOG_DESCRIBE' => $desc,
+            'CREATE_AT' => time()
+        ];
+
+        ServeLog::batchInsert($logData);
+        return true;
+    }
+
+    /**
+     * 记录清除的期业绩和月业绩
+     * @param int $periodNum
+     * @param int $calcMonth 业绩期
+     */
+    public static function clearPerf($periodNum, $calcMonth) {
+        $perfPeriodCount = PerfPeriod::find()
+        ->where('PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM'=>$periodNum])
+        ->count('ID');
+        $perfMonthCount = PerfMonth::find()
+        ->where('CALC_MONTH=:CALC_MONTH', [':CALC_MONTH'=>$calcMonth])
+        ->count('ID');
+        $desc = "清除业绩数据:AR_PERF_PERIOD-清除期业绩表总条数:$perfPeriodCount;AR_PERF_MONTH-清除月业绩表总条数:$perfMonthCount";
+        $logData[] = [
+            'PERIOD_NUM' => $periodNum,
+            'CALC_MONTH' => $calcMonth,
+            'LOG_DESCRIBE' => $desc,
+            'CREATE_AT' => time()
+        ];
+
+        ServeLog::batchInsert($logData);
+        return true;
+    }
+
+    /**
+     * 记录缓存用户数据
+     * @param int $periodNum
+     * @param int $calcMonth 业绩期
+     */
+    public static function cacheUserTotal($periodNum, $calcMonth) {
+        $allUserCount = 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')
+        ->count('UI.USER_ID');
+        $activeUserCount = UserInfo::findUseDbCalc()
+        ->from(UserInfo::tableName(). 'AS UI')
+        ->select('UI.USER_ID,U.STATUS')
+        ->leftJoin(User::tableName() . 'AS U', 'U.ID=UI.USER_ID')
+        ->where('U.STATUS=1')
+        ->count('UI.USER_ID');
+        $total = $allUserCount+$activeUserCount;
+        $desc = "缓存用户信息-结束,缓存数量:$total";
+        $logData[] = [
+            'PERIOD_NUM' => $periodNum,
+            'CALC_MONTH' => $calcMonth,
+            'LOG_DESCRIBE' => $desc,
+            'CREATE_AT' => time()
+        ];
+
+        ServeLog::batchInsert($logData);
+        return true;
+    }
+
+    /**
+     * 记录期业绩数据
+     * @param int $periodNum
+     * @param int $calcMonth 业绩期
+     */
+    public static function perfPeriodInfo($periodNum, $calcMonth) {
+        $data = PerfPeriod::findUseSlaves()
+        ->select('SUM(PV_PCS) AS TOTAL_PV_PCS, COUNT(ID) AS TOTAL_NUM')
+        ->where('PERIOD_NUM=:PERIOD_NUM', ['PERIOD_NUM'=>$periodNum])
+        ->asArray()
+        ->one();
+        $num = $data['TOTAL_NUM'];
+        $total_pvpcs = $data['TOTAL_NUM'];
+        $desc = "期业绩计算完成:AR_PERF_PERIOD-期业绩总条数:$num,期业绩个人消费PV总数:$total_pvpcs";
+        $logData[] = [
+            'PERIOD_NUM' => $periodNum,
+            'CALC_MONTH' => $calcMonth,
+            'LOG_DESCRIBE' => $desc,
+            'CREATE_AT' => time()
+        ];
+
+        ServeLog::batchInsert($logData);
+        return true;
+    }
+
+    /**
+     * 记录月业绩数据
+     * @param int $periodNum
+     * @param int $calcMonth 业绩期
+     */
+    public static function perfMonthInfo($periodNum, $calcMonth) {
+        $data = PerfMonth::findUseSlaves()
+        ->select('SUM(PV_PCS) AS TOTAL_PV_PCS, COUNT(ID) AS TOTAL_NUM')
+        ->where('CALC_MONTH=:CALC_MONTH', ['CALC_MONTH'=>$calcMonth])
+        ->asArray()
+        ->one();
+        $num = $data['TOTAL_NUM'];
+        $total_pvpcs = $data['TOTAL_NUM'];
+        $desc = "月业绩计算完成:AR_PERF_MONTH-月业绩表总条数:$num,月业绩个人消费总数:$total_pvpcs";
+        $logData[] = [
+            'PERIOD_NUM' => $periodNum,
+            'CALC_MONTH' => $calcMonth,
+            'LOG_DESCRIBE' => $desc,
+            'CREATE_AT' => time()
+        ];
+
+        ServeLog::batchInsert($logData);
+        return true;
+    }
+
+    /**
+     * 记录期业绩活跃数据
+     * @param int $periodNum
+     * @param int $calcMonth 业绩期
+     */
+    public static function perfPeriodActive($periodNum, $calcMonth) {
+        $data = PerfPeriod::findUseSlaves()
+        ->select('COUNT(ID) AS TOTAL_NUM')
+        ->where('PERIOD_NUM=:PERIOD_NUM AND IS_ACTIVE=1', ['PERIOD_NUM'=>$periodNum])
+        ->asArray()
+        ->one();
+        $num = $data['TOTAL_NUM'];
+        $desc = "期业绩更新活跃状态,活跃人数:$num";
+        $logData[] = [
+            'PERIOD_NUM' => $periodNum,
+            'CALC_MONTH' => $calcMonth,
+            'LOG_DESCRIBE' => $desc,
+            'CREATE_AT' => time()
+        ];
+
+        ServeLog::batchInsert($logData);
+        return true;
+    }
+
+    
+    
+    
+    
+    
+    
+    
+    
+    // =============================奖金相关日志=====================================================================================
+    
+    // ------以下为记录操作流程
+    // 记录请求时间
+    public static function recordRequest($time, $periodNum, $desc = '', $needCheck = false) {
+        // 查询此期是否存在计算中,如果在计算中则不用记录
+        if ($needCheck) {
+            $hasPerpare = Period::findUseSlaves()
+            ->select('ID')
+            ->where('PERIOD_NUM=:PERIOD_NUM AND IS_PREPARE=1', [':PERIOD_NUM'=>$periodNum])
+            ->asArray()
+            ->one();
+            if (empty($hasPerpare)) {
+                return true;
+            }
+        }
+        $logData[] = [
+            'ID' => SnowFake::instance()->generateId(),
+            'PERIOD_NUM' => $periodNum ?: 0,
+            'TASK_TYPE' => 'serve',
+            'TASK_DESCRIBE' => $desc ?: '请求服务开始',
+            'START_AT' => $time
+        ];
+
+        ServeProcess::batchInsert($logData);
+        return true;
+    }
+
+    // 记录计算基础数据
+    public static function recordDataInfo($time, $periodNum) {
+        $userCount = User::find()->where('1=1')->count('ID'); // user表总数
+        $perfSum = PerfOrder::find()->where('1=1')->sum('PV');// 业绩单总业绩
+        $infoCount = UserInfo::find()->where('1=1')->count('ID'); // userinfo表总数
+        $networkConut = UserNetwork::find()->where('1=1')->count('ID'); // UserNetwork总数
+        $relationCount = UserRelation::find()->where('1=1')->count('ID'); // UserRelation
+        $logData[] = [
+            'ID' => SnowFake::instance()->generateId(),
+            'PERIOD_NUM' => $periodNum ?: 0,
+            'TASK_TYPE' => 'serve',
+            'TASK_DESCRIBE' => '统计业务系统数据信息',
+            'START_AT' => $time,
+            'CALC_USER_TOTAL' => $userCount > 0 ? $userCount : 0,
+            'CALC_PERF_TOTAL' => $perfSum > 0 ? $perfSum : 0,
+            'CALC_USERINFO_TOTAL' => $infoCount > 0 ? $infoCount : 0,
+            'CALC_NETWORK_TOTAL' => $networkConut > 0 ? $networkConut : 0,
+            'CALC_RELATION_TOTAL' => $relationCount > 0 ? $relationCount :0
+        ];
+
+        ServeProcess::batchInsert($logData);
+    }
+
+    // 记录流程
+    public static function recordProcess($start, $end, $periodNum, $desc, $type='perf') {
+        try {
+            $logData[] = [
+                'ID' => SnowFake::instance()->generateId(),
+                'PERIOD_NUM' => $periodNum ?: 0,
+                'TASK_TYPE' => $type,
+                'START_AT' => $start,
+                'END_AT' => $end,
+                'TASK_DESCRIBE' => $desc,
+            ];
+
+            ServeProcess::batchInsert($logData);
+        } catch (Exception $e) {
+            var_dump($e->getMessage());
+        }
+    }
+}

+ 0 - 128
common/models/ServeProcess.php

@@ -1,128 +0,0 @@
-<?php
-
-namespace common\models;
-
-use common\helpers\snowflake\SnowFake;
-use Exception;
-use Yii;
-
-/**
- * This is the model class for table "{{%SERVE_PROCESS}}".
- *
- * @property string $ID
- * @property string $TASK_TYPE 任务类型 serve_statistical 服务统计信息,比如总人数,总业绩 perf 业绩单信息 bonus 奖金信息
- * @property string $START_AT 开始时间
- * @property string $END_AT 结束时间
- * @property string $PERIOD_NUM 业绩期
- * @property string $TASK_DESCRIBE 描述信息
- * @property string $USE_MEMORY 使用内存大小
- * @property string $USE_TIME 耗时
- * @property string $CALC_USER_TOTAL 总人数
- * @property string $CALC_PERF_TOTAL 业绩单中总业绩
- *  @property string $CREATE_AT 创建时间
- */
-class ServeProcess extends \common\components\ActiveRecord
-{
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName()
-    {
-        return '{{%SERVE_PROCESS}}';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            [['PERIOD_NUM', 'TASK_TYPE'], 'required'],
-            [['ID'], 'unique'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels()
-    {
-        return [
-            'ID' => 'ID',
-            'TASK_TYPE' => '任务类型', // 记录类型 serve 服务统计信息,比如总人数,总业绩 perf 业绩单信息 bonus 奖金信息
-            'START_AT' => '开始时间',
-            'END_AT' => '结束时间',
-            'PERIOD_NUM' => '业绩期',
-            'TASK_DESCRIBE' => '描述信息',
-            'CALC_USER_TOTAL' => '总人数',
-            'CALC_PERF_TOTAL' => '总业绩',
-        ];
-    }
-
-    // ------以下为记录操作流程
-    // 记录请求时间
-    public static function recordRequest($time, $periodNum, $desc = '', $needCheck = false) {
-        // 查询此期是否存在计算中,如果在计算中则不用记录
-        if ($needCheck) {
-            $hasPerpare = Period::findUseSlaves()
-            ->select('ID')
-            ->where('PERIOD_NUM=:PERIOD_NUM AND IS_PREPARE=1', [':PERIOD_NUM'=>$periodNum])
-            ->asArray()
-            ->one();
-            if (empty($hasPerpare)) {
-                return true;
-            }
-        }
-        $logData[] = [
-            'ID' => SnowFake::instance()->generateId(),
-            'PERIOD_NUM' => $periodNum ?: 0,
-            'TASK_TYPE' => 'serve',
-            'TASK_DESCRIBE' => $desc ?: '请求服务开始',
-            'START_AT' => $time
-        ];
-
-        ServeProcess::batchInsert($logData);
-        return true;
-    }
-
-    // 记录计算基础数据
-    public static function recordDataInfo($time, $periodNum) {
-        $userCount = User::find()->where('1=1')->count('ID'); // user表总数
-        $perfSum = PerfOrder::find()->where('1=1')->sum('PV');// 业绩单总业绩
-        $infoCount = UserInfo::find()->where('1=1')->count('ID'); // userinfo表总数
-        $networkConut = UserNetwork::find()->where('1=1')->count('ID'); // UserNetwork总数
-        $relationCount = UserRelation::find()->where('1=1')->count('ID'); // UserRelation
-        $logData[] = [
-            'ID' => SnowFake::instance()->generateId(),
-            'PERIOD_NUM' => $periodNum ?: 0,
-            'TASK_TYPE' => 'serve',
-            'TASK_DESCRIBE' => '统计业务系统数据信息',
-            'START_AT' => $time,
-            'CALC_USER_TOTAL' => $userCount > 0 ? $userCount : 0,
-            'CALC_PERF_TOTAL' => $perfSum > 0 ? $perfSum : 0,
-            'CALC_USERINFO_TOTAL' => $infoCount > 0 ? $infoCount : 0,
-            'CALC_NETWORK_TOTAL' => $networkConut > 0 ? $networkConut : 0,
-            'CALC_RELATION_TOTAL' => $relationCount > 0 ? $relationCount :0
-        ];
-
-        ServeProcess::batchInsert($logData);
-    }
-
-    // 记录流程
-    public static function recordProcess($start, $end, $periodNum, $desc, $type='perf') {
-        try {
-            $logData[] = [
-                'ID' => SnowFake::instance()->generateId(),
-                'PERIOD_NUM' => $periodNum ?: 0,
-                'TASK_TYPE' => $type,
-                'START_AT' => $start,
-                'END_AT' => $end,
-                'TASK_DESCRIBE' => $desc,
-            ];
-
-            ServeProcess::batchInsert($logData);
-        } catch (Exception $e) {
-            var_dump($e->getMessage());
-        }
-    }
-}