|
|
@@ -24,6 +24,7 @@ use common\models\CalcBonusVilla;
|
|
|
use common\models\PerfMonth;
|
|
|
use common\models\PerfPeriod;
|
|
|
use common\models\Period;
|
|
|
+use common\models\ServeProcess;
|
|
|
use common\models\StarCrownLevel;
|
|
|
use yii\base\BaseObject;
|
|
|
use yii\base\StaticInstanceTrait;
|
|
|
@@ -116,14 +117,17 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
// 初始化结算任务
|
|
|
$this->initCalcTask();
|
|
|
$t2 = microtime(true);
|
|
|
+ ServeProcess::recordProcess($t1, $t2, $this->_periodNum, '奖金计算初始化配置', 'bonus');
|
|
|
// 设置结算状态
|
|
|
$this->setCalcStatus('start');
|
|
|
// 清空所有本期结算用到的缓存
|
|
|
CalcCache::clearCalcBonusCache($this->_periodNum);
|
|
|
$t3 = microtime(true);
|
|
|
+ ServeProcess::recordProcess($t2, $t3, $this->_periodNum, '设置结算状态,清空缓存', 'bonus');
|
|
|
// 清空相关表数据
|
|
|
$this->clearCalcTableData();
|
|
|
$t4 = microtime(true);
|
|
|
+ ServeProcess::recordProcess($t3, $t4, $this->_periodNum, '清空相关表数据', 'bonus');
|
|
|
echo('初始化、清空缓存及相关数据表完成,耗时:' . round($t4 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
$this->_updatePercent(10);
|
|
|
// 蓝星奖放到最前面 奖金计算开始
|
|
|
@@ -137,6 +141,9 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
// $this->calcBonusBsYJ();
|
|
|
// // 将有【蓝星管理奖金】的用户加入到有奖金缓存用户中
|
|
|
// $this->calcBonusBsGL();
|
|
|
+ if ($this->_isCalcMonth) {
|
|
|
+ ServeProcess::recordProcess($t4, time(), $this->_periodNum, '计算蓝星奖', 'bonus');
|
|
|
+ }
|
|
|
}
|
|
|
$t5 = microtime(true);
|
|
|
echo('计算蓝星奖'.($this->_sysConfig['openGL']['VALUE']?'完成':'关闭').',耗时:' . round($t5 - $t4, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
@@ -144,6 +151,7 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
if($this->_sysConfig['openFW']['VALUE']) {
|
|
|
$this->calcBonusBDStepOne();
|
|
|
$this->calcBonusBDStepTwo();
|
|
|
+ ServeProcess::recordProcess($t5, time(), $this->_periodNum, '计算服务奖', 'bonus');
|
|
|
}
|
|
|
$t6 = microtime(true);
|
|
|
echo('计算服务奖'.($this->_sysConfig['openFW']['VALUE']?'完成':'关闭').',耗时:' . round($t6 - $t5, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
@@ -152,6 +160,7 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
// 销售奖/推广奖
|
|
|
if($this->_sysConfig['openTG']['VALUE']) {
|
|
|
$this->calcBonusTG();
|
|
|
+ ServeProcess::recordProcess($t6, time(), $this->_periodNum, '计算推广奖', 'bonus');
|
|
|
}
|
|
|
$t7 = microtime(true);
|
|
|
echo('计算推广奖'.($this->_sysConfig['openTG']['VALUE']?'完成':'关闭').',耗时:' . round($t7 - $t6, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
@@ -160,6 +169,7 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
// 绩效奖/团队奖
|
|
|
if($this->_sysConfig['openQY']['VALUE']) {
|
|
|
$this->calcBonusQY();
|
|
|
+ ServeProcess::recordProcess($t7, time(), $this->_periodNum, '计算团队奖', 'bonus');
|
|
|
}
|
|
|
$t8 = microtime(true);
|
|
|
echo('计算团队奖'.($this->_sysConfig['openQY']['VALUE']?'完成':'关闭').',耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
@@ -169,23 +179,34 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
// $t21 = microtime(true);
|
|
|
// echo('计算旅游奖' . ($this->_sysConfig['openTourism']['VALUE'] ? '完成' : '关闭') . ',耗时:' . round($t21 - $t20, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
// $this->_updatePercent(68);
|
|
|
-
|
|
|
- $this->calcBonusVilla();
|
|
|
+ if($this->_sysConfig['openVilla']['VALUE']) {
|
|
|
+ $this->calcBonusVilla();
|
|
|
+ ServeProcess::recordProcess($t8, time(), $this->_periodNum, '计算房奖', 'bonus');
|
|
|
+ }
|
|
|
$t22 = microtime(true);
|
|
|
echo('计算房奖' . ($this->_sysConfig['openVilla']['VALUE'] ? '完成' : '关闭').',耗时:' . round($t22 - $t8, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL . PHP_EOL);
|
|
|
$this->_updatePercent(45);
|
|
|
|
|
|
- $this->calcBonusGarage();
|
|
|
+ if($this->_sysConfig['openGarage']['VALUE']) {
|
|
|
+ $this->calcBonusGarage();
|
|
|
+ ServeProcess::recordProcess($t22, time(), $this->_periodNum, '计算车奖', 'bonus');
|
|
|
+ }
|
|
|
$t23 = microtime(true);
|
|
|
echo('计算车奖' . ($this->_sysConfig['openGarage']['VALUE'] ? '完成' : '关闭').',耗时:' . round($t23 - $t22, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL . PHP_EOL);
|
|
|
$this->_updatePercent(55);
|
|
|
|
|
|
// 计算季度奖
|
|
|
- $this->calcQuarter();
|
|
|
+ if($this->_sysConfig['openQuarter']['VALUE']) {
|
|
|
+ $this->calcQuarter();
|
|
|
+ ServeProcess::recordProcess($t23, time(), $this->_periodNum, '计算季度奖-调用存储过程', 'bonus');
|
|
|
+ }
|
|
|
$t24 = microtime(true);
|
|
|
echo('计算季度奖' . ($this->_sysConfig['openQuarter']['VALUE'] ? '开启调用存储过程' : '关闭').',耗时:' . round($t24 - $t23, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL . PHP_EOL);
|
|
|
// 将用户写入缓存
|
|
|
- $this->calcQuarterUser();
|
|
|
+ if($this->_sysConfig['openQuarter']['VALUE']) {
|
|
|
+ $this->calcQuarterUser();
|
|
|
+ ServeProcess::recordProcess($t23, time(), $this->_periodNum, '计算季度奖-存入奖金会员', 'bonus');
|
|
|
+ }
|
|
|
$this->_updatePercent(65);
|
|
|
$t25 = microtime(true);
|
|
|
echo('计算季度奖' . ($this->_sysConfig['openQuarter']['VALUE'] ? '完成' : '关闭').',耗时:' . round($t25 - $t24, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL . PHP_EOL);
|
|
|
@@ -194,9 +215,11 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
$this->loopBonusUsers();
|
|
|
$this->_updatePercent(75);
|
|
|
$t30 = microtime(true);
|
|
|
+ ServeProcess::recordProcess($t25, $t30, $this->_periodNum, '奖金写库', 'bonus');
|
|
|
echo('奖金写库操作完成,耗时:' . round($t30 - $t25, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
|
|
|
Period::updateCalcProcess(3, $this->_periodNum);
|
|
|
+ ServeProcess::recordProcess($t30, time(), $this->_periodNum, '标记为计算完成', 'bonus');
|
|
|
$this->_updatePercent(100);
|
|
|
$t35 = microtime(true);
|
|
|
echo('结算全部完成,共耗时:' . round($t35 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL . PHP_EOL);
|