From 1580cc814b4d68c5b92b574e20c598b6d0b61f94 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 18 Oct 2022 17:35:12 +0800 Subject: [PATCH] 1 --- doc/User.py | 1 + webapp/controller/UserController.class.php | 23 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/doc/User.py b/doc/User.py index a027d34c..b5284818 100644 --- a/doc/User.py +++ b/doc/User.py @@ -133,6 +133,7 @@ class User(object): ], 'response': [ _common.RspHead(), + ['property_chg', _common.PropertyChg(), '属性变更'], ] },{ 'name': 'selectFreeItem', diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 63f2748d..43f27278 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -70,7 +70,7 @@ class UserController extends BaseAuthedController { $userInfo = $this->_getOrmUserInfo(); } } - + $this->updateLastSeason($userInfo); $this->_rspData(array( 'info' => User::show($userInfo) )); @@ -618,7 +618,11 @@ class UserController extends BaseAuthedController { ); User::update($fields); $this->_setV(TN_RANK_STATUS, 0, 0); - $this->_rspOk(); + $propertyChgService = new services\PropertyChgService(); + $propertyChgService->addUserChg(); + $this->_rspData([ + 'property_chg' => $propertyChgService->toDto(), + ]); } public function selectFreeItem(){ @@ -679,10 +683,6 @@ class UserController extends BaseAuthedController { private function createNewUserV2($userName){ $currSeasonMeta = mt\RankSeason::getCurrentSeason(); -// if (!$currSeasonMeta){ -// $time = $this->_getNowTime() + (86400*10); -// $currSeasonMeta = mt\RankSeason::getSeasonByTime($time); -// } SqlHelper::upsert ($this->_getSelfMysql(), 't_user', @@ -710,4 +710,15 @@ class UserController extends BaseAuthedController { ); } + private function updateLastSeason($userInfo){ + if (! $userInfo['last_season_id']){ + $currSeasonMeta = mt\RankSeason::getCurrentSeason(); + if ($currSeasonMeta){ + $this->_updateUserInfo(array( + 'last_season_id'=>$currSeasonMeta['id'], + )); + } + } + } + }