|
|
@@ -279,7 +279,7 @@ class PerfCalc {
|
|
|
// modify 聘级字段改成蓝星奖的 奖衔级别(蓝星奖的等级).不在使用荣衔奖金.聘级的等级切换成蓝星奖等级,
|
|
|
// 此等级会影响团队将的封顶.
|
|
|
// $this->loopCalcEmpLevel();
|
|
|
- $t8 = microtime(true);
|
|
|
+ // $t8 = microtime(true);
|
|
|
// echo('计算聘级完成,耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
//$this->_updatePercent(90);
|
|
|
|
|
|
@@ -290,7 +290,8 @@ class PerfCalc {
|
|
|
$this->_updatePercent(90);
|
|
|
|
|
|
// 店服务奖/月节点
|
|
|
- $this->storePerf();
|
|
|
+ $this->calcStProcedure();
|
|
|
+// $this->storePerf();
|
|
|
$t8 = microtime(true);
|
|
|
echo('店服务业绩计算,耗时:' . round($t8 - $t7, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
|
|
|
$this->_updatePercent(95);
|
|
|
@@ -1272,6 +1273,42 @@ class PerfCalc {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 执行店服务奖业绩存储过程
|
|
|
+ * @throws \yii\db\Exception
|
|
|
+ */
|
|
|
+ public function calcStProcedure(): bool
|
|
|
+ {
|
|
|
+ if (!$this->_isCalcMonth) {
|
|
|
+ // 不是结算月,则不进行计算
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $result = \Yii::$app->db->createCommand("CALL CALC_STORE_PV(:periodNum)")
|
|
|
+ ->bindValue(':periodNum' , $this->_periodNum )
|
|
|
+ ->execute();
|
|
|
+
|
|
|
+ if ($result) {
|
|
|
+ $condition = 'PERIOD_NUM=:PERIOD_NUM AND CALC_MONTH=:CALC_MONTH';
|
|
|
+ $params = [
|
|
|
+ ':PERIOD_NUM' => $this->_periodNum,
|
|
|
+ ':CALC_MONTH' => $this->_calcYearMonth,
|
|
|
+ ];
|
|
|
+ // 有业绩的会员放入缓存
|
|
|
+ $records = StorePerfLog::find()
|
|
|
+ ->where($condition, $params)
|
|
|
+ ->select('USER_ID, MONTH_PV')
|
|
|
+ ->asArray()
|
|
|
+ ->all();
|
|
|
+
|
|
|
+ foreach ($records as $record) {
|
|
|
+ CalcCache::addHasPerfUsers($record['USER_ID'], $this->_periodNum);
|
|
|
+ CalcCache::nowPeriodPerf($record['USER_ID'], $this->_periodNum, ['STORE_PV_GRAND' => $record['MONTH_PV']]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 店服务奖,循环结算月所有数据,并计算小组业绩
|
|
|
* @param int $offset
|