|
|
@@ -13,7 +13,6 @@ namespace common\models;
|
|
|
* @property string $PERIOD_NUM 业绩期
|
|
|
* @property int $CALC_MONTH 结算月份
|
|
|
* @property int $CREATE_AT 创建时间
|
|
|
- * @property string $GRAND_TOTAL_PV 工作室用户累计获得的小组PV
|
|
|
*/
|
|
|
class StorePerfLog extends \common\components\ActiveRecord
|
|
|
{
|
|
|
@@ -50,7 +49,6 @@ class StorePerfLog extends \common\components\ActiveRecord
|
|
|
'PERIOD_NUM' => '业绩期',
|
|
|
'CALC_MONTH' => '结算月份',
|
|
|
'CREATE_AT' => '创建时间',
|
|
|
- 'GRAND_TOTAL_PV' => '工作室用户累计获得的小组PV'
|
|
|
];
|
|
|
}
|
|
|
|
|
|
@@ -64,27 +62,19 @@ class StorePerfLog extends \common\components\ActiveRecord
|
|
|
*/
|
|
|
public static function addOrUpdate($periodNum, $calcMonth, $userId, $data, $appendPv = 0) {
|
|
|
$info = StorePerfLog::findUseDbCalc()
|
|
|
- ->select('ID,GRAND_TOTAL_PV')
|
|
|
+ ->select('ID')
|
|
|
->where('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM AND CALC_MONTH=:CALC_MONTH',
|
|
|
[':USER_ID'=>$userId,':PERIOD_NUM' => $periodNum, ':CALC_MONTH' => $calcMonth]
|
|
|
)
|
|
|
->asArray()
|
|
|
->one();
|
|
|
if (empty($info)) {
|
|
|
- if ($data['IS_STUDIO'] == 1) {
|
|
|
- $data['GRAND_TOTAL_PV'] = $data['MONTH_PV'];
|
|
|
- }
|
|
|
StorePerfLog::insertOne($data);
|
|
|
} else {
|
|
|
// 如果循环到此用户有业绩单,则将此用户的PV更新为自己业绩单的值
|
|
|
if ($data['MONTH_PV'] > 0) {
|
|
|
StorePerfLog::updateAll(['MONTH_PV' => $data['MONTH_PV']], 'ID=:ID', [':ID' => $info['ID']]);
|
|
|
}
|
|
|
- if ($data['IS_STUDIO'] == 1) {
|
|
|
- // 累加总PV
|
|
|
- $totalPv = $info['GRAND_TOTAL_PV'] + $appendPv;
|
|
|
- StorePerfLog::updateAll(['GRAND_TOTAL_PV' => $totalPv], 'ID=:ID', [':ID' => $info['ID']]);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
return true;
|