|
|
@@ -21,11 +21,9 @@ use common\models\CalcBonusQY;
|
|
|
use common\models\CalcBonusTG;
|
|
|
use common\models\CalcBonusTourism;
|
|
|
use common\models\CalcBonusVilla;
|
|
|
-use common\models\CalcMonthBonusUser;
|
|
|
use common\models\PerfMonth;
|
|
|
use common\models\PerfPeriod;
|
|
|
use common\models\Period;
|
|
|
-use common\models\FlowBonus;
|
|
|
use common\models\StarCrownLevel;
|
|
|
use yii\base\BaseObject;
|
|
|
use yii\base\StaticInstanceTrait;
|
|
|
@@ -117,19 +115,20 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
$t1 = microtime(true);
|
|
|
// 初始化结算任务
|
|
|
$this->initCalcTask();
|
|
|
+ $t2 = microtime(true);
|
|
|
// 设置结算状态
|
|
|
$this->setCalcStatus('start');
|
|
|
// 清空所有本期结算用到的缓存
|
|
|
CalcCache::clearCalcBonusCache($this->_periodNum);
|
|
|
+ $t3 = microtime(true);
|
|
|
// 清空相关表数据
|
|
|
$this->clearCalcTableData();
|
|
|
- $t2 = microtime(true);
|
|
|
- echo('初始化、清空缓存及相关数据表完成,耗时:' . round($t2 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
+ $t4 = microtime(true);
|
|
|
+ echo('初始化、清空缓存及相关数据表完成,耗时:' . round($t4 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
$this->_updatePercent(10);
|
|
|
- $t3 = microtime(true);
|
|
|
// 蓝星奖放到最前面 奖金计算开始
|
|
|
if($this->_sysConfig['openGL']['VALUE']) {
|
|
|
- echo('计算蓝星奖开始,' . date('Y-m-d H:i:s', $t3) . PHP_EOL);
|
|
|
+ echo('计算蓝星奖开始,' . date('Y-m-d H:i:s', $t4) . PHP_EOL);
|
|
|
// 调用存储过程,计算蓝星管理奖金
|
|
|
$this->calcBsProcedure();
|
|
|
// 将有蓝星管理奖金的用户加入到有奖金缓存用户中
|
|
|
@@ -139,72 +138,68 @@ class CalcServeBonusCalc extends BaseObject {
|
|
|
// // 将有【蓝星管理奖金】的用户加入到有奖金缓存用户中
|
|
|
// $this->calcBonusBsGL();
|
|
|
}
|
|
|
- $t4 = microtime(true);
|
|
|
- echo('计算蓝星奖'.($this->_sysConfig['openGL']['VALUE']?'完成':'关闭').',耗时:' . round($t4 - $t3, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
+ $t5 = microtime(true);
|
|
|
+ echo('计算蓝星奖'.($this->_sysConfig['openGL']['VALUE']?'完成':'关闭').',耗时:' . round($t5 - $t4, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
|
|
|
if($this->_sysConfig['openFW']['VALUE']) {
|
|
|
$this->calcBonusBDStepOne();
|
|
|
$this->calcBonusBDStepTwo();
|
|
|
}
|
|
|
- echo('计算服务奖'.($this->_sysConfig['openFW']['VALUE']?'完成':'关闭').',耗时:' . round($t4 - $t3, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
+ $t6 = microtime(true);
|
|
|
+ echo('计算服务奖'.($this->_sysConfig['openFW']['VALUE']?'完成':'关闭').',耗时:' . round($t6 - $t5, 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);
|
|
|
+ $t7 = microtime(true);
|
|
|
+ echo('计算推广奖'.($this->_sysConfig['openTG']['VALUE']?'完成':'关闭').',耗时:' . round($t7 - $t6, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
$this->_updatePercent(20);
|
|
|
|
|
|
- $t6 = microtime(true);
|
|
|
// 绩效奖/团队奖
|
|
|
if($this->_sysConfig['openQY']['VALUE']) {
|
|
|
$this->calcBonusQY();
|
|
|
}
|
|
|
- $t9 = microtime(true);
|
|
|
- echo('计算团队奖'.($this->_sysConfig['openQY']['VALUE']?'完成':'关闭').',耗时:' . round($t9 - $t6, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
- $this->_updatePercent(65);
|
|
|
+ $t8 = microtime(true);
|
|
|
+ echo('计算团队奖'.($this->_sysConfig['openQY']['VALUE']?'完成':'关闭').',耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
+ $this->_updatePercent(35);
|
|
|
|
|
|
// $this->calcBonusTourism($this->_sysConfig['openTourism']);
|
|
|
- $t21 = microtime(true);
|
|
|
+ // $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();
|
|
|
$t22 = microtime(true);
|
|
|
- echo('计算房奖' . ($this->_sysConfig['openVilla']['VALUE'] ? '完成' : '关闭').',耗时:' . round($t22 - $t21, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL . PHP_EOL);
|
|
|
- $this->_updatePercent(69);
|
|
|
+ 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();
|
|
|
$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(69);
|
|
|
+ $this->_updatePercent(55);
|
|
|
|
|
|
// 计算季度奖
|
|
|
$this->calcQuarter();
|
|
|
+ $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();
|
|
|
- $t24 = microtime(true);
|
|
|
- echo('计算季度奖' . ($this->_sysConfig['openQuarter']['VALUE'] ? '完成' : '关闭').',耗时:' . round($t24 - $t23, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL . PHP_EOL);
|
|
|
-
|
|
|
- $t30 = microtime(true);
|
|
|
- echo('奖金会员写入缓存完成,耗时:' . round($t30 - $t22, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
- $this->_updatePercent(70);
|
|
|
+ $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);
|
|
|
|
|
|
// 奖金写库
|
|
|
$this->loopBonusUsers();
|
|
|
$this->_updatePercent(75);
|
|
|
- unset($calcWrite);
|
|
|
- $t31 = microtime(true);
|
|
|
- echo('奖金写库操作完成,耗时:' . round($t31 - $t30, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
+ $t30 = microtime(true);
|
|
|
+ echo('奖金写库操作完成,耗时:' . round($t30 - $t25, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
|
|
|
- $t32 = microtime(true);
|
|
|
- echo('奖金会员入库完成,耗时:' . round($t32 - $t31, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
- $this->_updatePercent(100);
|
|
|
Period::updateCalcProcess(3, $this->_periodNum);
|
|
|
+ $this->_updatePercent(100);
|
|
|
$t35 = microtime(true);
|
|
|
- echo('结算全部完成,共耗时:' . round($t35 - $t32, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL . PHP_EOL);
|
|
|
+ echo('结算全部完成,共耗时:' . round($t35 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL . PHP_EOL);
|
|
|
} catch (\Exception $e) {
|
|
|
$this->errorCalcTask();
|
|
|
$this->addError('calc', sprintf('File【%s】, Line【%s】, Msg【%s】', $e->getFile(), $e->getLine(), $e->getMessage()));
|