|
|
@@ -272,6 +272,28 @@ class PushBaseDataToCalc extends BaseBusiness
|
|
|
'CALCULATED_AT',
|
|
|
'CREATED_AT',
|
|
|
]],
|
|
|
+ //--- 月业绩表 只有当前结算月为季度最终月时才推
|
|
|
+ 'perfMonth' => ['separately' => true, 'table' => 'AR_PERF_MONTH', 'field' => [
|
|
|
+ 'ID',
|
|
|
+ 'USER_ID',
|
|
|
+ 'FX_AMOUNT_CASH',
|
|
|
+ 'PV_PCS',
|
|
|
+ 'PV_PCS_FX',
|
|
|
+ 'PV_1L',
|
|
|
+ 'PV_2L',
|
|
|
+ 'PV_3L',
|
|
|
+ 'PV_4L',
|
|
|
+ 'PV_5L',
|
|
|
+ 'PV_1L_TOTAL',
|
|
|
+ 'PV_2L_TOTAL',
|
|
|
+ 'PV_3L_TOTAL',
|
|
|
+ 'PV_4L_TOTAL',
|
|
|
+ 'PV_5L_TOTAL',
|
|
|
+ 'CALC_MONTH',
|
|
|
+ 'CREATED_AT',
|
|
|
+ 'PV_PSS',
|
|
|
+ 'PV_PSS_TOTAL',
|
|
|
+ ]],
|
|
|
//--- 推荐网络表
|
|
|
'userRelation' => ['table' => 'AR_USER_RELATION_NEW', 'field' => [
|
|
|
'ID',
|
|
|
@@ -379,8 +401,18 @@ class PushBaseDataToCalc extends BaseBusiness
|
|
|
public function period($table, $fieldArray, $db)
|
|
|
{
|
|
|
$field = implode(',', $fieldArray);
|
|
|
- $data = Period::find()->select($field)
|
|
|
- ->where('PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum])
|
|
|
+
|
|
|
+ $where = ['PERIOD_NUM' => $this->_periodNum];
|
|
|
+
|
|
|
+ if ($this->_isCalcMonth) {
|
|
|
+ $where = ['CALC_YEAR' => $this->_calcYear, 'CALC_MONTH' => $this->_calcMonth];
|
|
|
+ if (in_array($this->_calcMonth, [3, 6, 9, 12])) {
|
|
|
+ $where['CALC_MONTH'] = [$this->_calcMonth, $this->_calcMonth - 1, $this->_calcMonth - 2];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = Period::find()->select($field)
|
|
|
+ ->where($where)
|
|
|
->asArray()->all();
|
|
|
if (!empty($data)) {
|
|
|
\Yii::$app->$db->createCommand()->batchInsert($table, $fieldArray, $data)->execute();
|
|
|
@@ -596,4 +628,31 @@ class PushBaseDataToCalc extends BaseBusiness
|
|
|
$fieldArray = self::BASE_INFO_METHODS['perfOrder']['field'] ?? [];
|
|
|
\Yii::$app->$db->createCommand()->batchInsert($table, $fieldArray, $data)->execute();
|
|
|
}
|
|
|
+
|
|
|
+ public function perfMonth($table, $fieldArray, $db)
|
|
|
+ {
|
|
|
+ if (!$this->_isCalcMonth && !in_array($this->_calcMonth, [3, 6, 9, 12])) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ $_offset = 0;
|
|
|
+ $field = implode(',', $fieldArray);
|
|
|
+
|
|
|
+ $months = $this->getMonthsForQuarterly();
|
|
|
+
|
|
|
+ //结算月
|
|
|
+ perfMonth:
|
|
|
+ $offset = $_offset * $this->_limit;
|
|
|
+ $data = PerfMonth::find()->where(['CALC_MONTH' => $months])
|
|
|
+ ->offset($offset)->limit($this->_limit)->select($field)->asArray()->all();
|
|
|
+
|
|
|
+ if (!empty($data)) {
|
|
|
+ $_offset += 1;
|
|
|
+ $fieldArray = array_keys(current($data));
|
|
|
+ \Yii::$app->$db->createCommand()->batchInsert($table, $fieldArray, $data)->execute();
|
|
|
+ $data = null;
|
|
|
+ goto perfMonth;
|
|
|
+ }
|
|
|
+ $data = null;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|