|
@@ -12,6 +12,7 @@ use common\models\PerfPeriod;
|
|
|
use common\models\Period;
|
|
use common\models\Period;
|
|
|
use common\models\PerfMonth;
|
|
use common\models\PerfMonth;
|
|
|
use common\models\ServeProcess;
|
|
use common\models\ServeProcess;
|
|
|
|
|
+use common\models\User;
|
|
|
use common\models\UserNetwork;
|
|
use common\models\UserNetwork;
|
|
|
use yii\base\Exception;
|
|
use yii\base\Exception;
|
|
|
use yii\base\StaticInstanceTrait;
|
|
use yii\base\StaticInstanceTrait;
|
|
@@ -168,7 +169,13 @@ class CalcServePerfCalc {
|
|
|
ServeProcess::recordProcess($t7, $t8, $this->_periodNum, '本月业绩入库完成');
|
|
ServeProcess::recordProcess($t7, $t8, $this->_periodNum, '本月业绩入库完成');
|
|
|
}
|
|
}
|
|
|
$this->_updatePercent(100);
|
|
$this->_updatePercent(100);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //十二、期业绩表,增加是否活跃字段
|
|
|
|
|
+ $this->loopUpdatePeriodActive();
|
|
|
$t9 = microtime(true);
|
|
$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);
|
|
|
|
|
+
|
|
|
ServeProcess::recordProcess($t6, $t7, $this->_periodNum, '计算业绩业绩结算全部完成');
|
|
ServeProcess::recordProcess($t6, $t7, $this->_periodNum, '计算业绩业绩结算全部完成');
|
|
|
echo(date('Y-m-d H:i:s',time()).'计算业绩业绩结算全部完成,共耗时:' . round($t9 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
echo(date('Y-m-d H:i:s',time()).'计算业绩业绩结算全部完成,共耗时:' . round($t9 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
@@ -642,4 +649,31 @@ class CalcServePerfCalc {
|
|
|
// 把数据写入数据库中
|
|
// 把数据写入数据库中
|
|
|
Period::updateAll(['PERF_PERCENT' => $percent], 'PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum]);
|
|
Period::updateAll(['PERF_PERCENT' => $percent], 'PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum]);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 期业绩表,增加是否活跃字段判断,就用isPerfActive 方法进行判断。
|
|
|
|
|
+ public function loopUpdatePeriodActive($offset = 0) {
|
|
|
|
|
+ echo sprintf("时间:[%s]更新期业绩表活跃状态字段,当前offset为:【%s】" . PHP_EOL, date('Y-m-d H:i:s', time()) , $offset);
|
|
|
|
|
+ $allData = PerfPeriod::findUseDbCalc()
|
|
|
|
|
+ ->where('PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum])
|
|
|
|
|
+ ->offset($offset)
|
|
|
|
|
+ ->limit($this->_limit)
|
|
|
|
|
+ ->asArray()
|
|
|
|
|
+ ->all();
|
|
|
|
|
+ if ($allData) {
|
|
|
|
|
+ foreach ($allData as $data) {
|
|
|
|
|
+ $isActive = User::isPerfActive($data['USER_ID'], $this->_periodNum, $this->_calcYearMonth);
|
|
|
|
|
+ // 期结算结果
|
|
|
|
|
+ PerfPeriod::updateAll(['IS_ACTIVE' => $isActive], 'USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM',
|
|
|
|
|
+ [
|
|
|
|
|
+ ':USER_ID' => $data['USER_ID'],
|
|
|
|
|
+ ':PERIOD_NUM' => $this->_periodNum
|
|
|
|
|
+ ]
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ unset($allData);
|
|
|
|
|
+ return $this->loopUpdatePeriodActive($offset + $this->_limit);
|
|
|
|
|
+ }
|
|
|
|
|
+ unset($allData);
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|