From 6d5ff764345a736678fbe17692bccf074272d1a3 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 5 Jun 2023 20:04:10 +0800 Subject: [PATCH] 1 --- webapp/controller/UserController.class.php | 114 +++++++++++---------- 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index aa56da74..3779bddf 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -253,6 +253,36 @@ class UserController extends BaseAuthedController { $haveHeadHeroList[rand() % count($haveHeadHeroList)]['hero_head'] : 0; } //Hero::randHero($heroUniId, $heroId); + $fields = array( + 'account_id' => $this->_getAccountId(), + 'channel' => $this->_getChannel(), + 'name' => $userName, + 'sex' => rand() % 2, + #'avatar_url' => $avatar_url, + 'gold' => $gold, + 'diamond' => $diamond, + 'head_frame' => $headFrame, + 'level' => 1, + 'exp' => 0, + 'rank' => $initRankMeta ? $initRankMeta['id'] : 1, + 'history_best_rank' => $initRankMeta ? $initRankMeta['id'] : 1, + 'score' => $initRankMeta ? $initRankMeta['rank_score'] : 0, + 'history_best_score' => $initRankMeta ? $initRankMeta['rank_score'] : 0, + 'head_id' => $headId, + 'hero_id' => $heroId, + 'last_season_id' => $currSeasonMeta ? $currSeasonMeta['id'] : 0, + 'head_list' => json_encode($headList), + 'head_frame_list' => json_encode($headFrameList), + 'score_modifytime' => $this->_getNowTime(), + 'best_rank_modifytime' => $this->_getNowTime(), + 'createtime' => $this->_getNowTime(), + 'modifytime' => $this->_getNowTime(), + 'last_login_time' => $this->_getNowTime(), + ); + if ($this->_getChannel() == BC_CHANNEL) { + $fields['address'] = $this->_getOpenId(); + } + SqlHelper::upsert ($this->_getSelfMysql(), 't_user', @@ -261,32 +291,7 @@ class UserController extends BaseAuthedController { ), array( ), - array( - 'account_id' => $this->_getAccountId(), - 'channel' => $this->_getChannel(), - 'name' => $userName, - 'sex' => rand() % 2, - #'avatar_url' => $avatar_url, - 'gold' => $gold, - 'diamond' => $diamond, - 'head_frame' => $headFrame, - 'level' => 1, - 'exp' => 0, - 'rank' => $initRankMeta ? $initRankMeta['id'] : 1, - 'history_best_rank' => $initRankMeta ? $initRankMeta['id'] : 1, - 'score' => $initRankMeta ? $initRankMeta['rank_score'] : 0, - 'history_best_score' => $initRankMeta ? $initRankMeta['rank_score'] : 0, - 'head_id' => $headId, - 'hero_id' => $heroId, - 'last_season_id' => $currSeasonMeta ? $currSeasonMeta['id'] : 0, - 'head_list' => json_encode($headList), - 'head_frame_list' => json_encode($headFrameList), - 'score_modifytime' => $this->_getNowTime(), - 'best_rank_modifytime' => $this->_getNowTime(), - 'createtime' => $this->_getNowTime(), - 'modifytime' => $this->_getNowTime(), - 'last_login_time' => $this->_getNowTime(), - ) + $fields ); $awardService = new services\AwardService(); $propertyChgService = new services\PropertyChgService(); @@ -821,33 +826,38 @@ class UserController extends BaseAuthedController { private function createNewUserV2($userName){ $currSeasonMeta = mt\RankSeason::getCurrentSeason(); - SqlHelper::upsert - ($this->_getSelfMysql(), - 't_user', - array( - 'account_id' => $this->_getAccountId() - ), - array( - ), - array( - 'account_id' => $this->_getAccountId(), - 'channel' => $this->_getChannel(), - 'name' => $userName, - 'sex' => rand() % 2, - 'gold' => 0, - 'diamond' => 0, - 'level' => 1, - 'rank' => 0, - 'score' => 0, - 'exp' => 0, - 'last_season_id' => $currSeasonMeta ? $currSeasonMeta['id'] : 0, - 'score_modifytime' => $this->_getNowTime(), - 'best_rank_modifytime' => $this->_getNowTime(), - 'createtime' => $this->_getNowTime(), - 'modifytime' => $this->_getNowTime(), - 'last_login_time' => $this->_getNowTime(), - ) + $fields = array( + 'account_id' => $this->_getAccountId(), + 'channel' => $this->_getChannel(), + 'name' => $userName, + 'sex' => rand() % 2, + 'gold' => 0, + 'diamond' => 0, + 'level' => 1, + 'rank' => 0, + 'score' => 0, + 'exp' => 0, + 'last_season_id' => $currSeasonMeta ? $currSeasonMeta['id'] : 0, + 'score_modifytime' => $this->_getNowTime(), + 'best_rank_modifytime' => $this->_getNowTime(), + 'createtime' => $this->_getNowTime(), + 'modifytime' => $this->_getNowTime(), + 'last_login_time' => $this->_getNowTime(), ); + if ($this->_getChannel() == BC_CHANNEL) { + $fields['address'] = $this->_getOpenId(); + } + + SqlHelper::upsert + ($this->_getSelfMysql(), + 't_user', + array( + 'account_id' => $this->_getAccountId() + ), + array( + ), + $fields + ); } private function updateLastSeason($userInfo){