This commit is contained in:
hujiabin 2022-10-27 20:59:06 +08:00
parent b5e7ccd0be
commit 7a7c76e40a

View File

@ -43,23 +43,24 @@ class UserController extends BaseAuthedController {
$avatarUrl = '18003';
$userInfo = $this->_safeGetOrmUserInfo();
if (SERVER_ENV == _ONLINE) {
if (!$userInfo) {
$this->createNewUser($userName, $avatarUrl);
$this->addChip(); //测试数据,上线要删除
$this->addFragmentBox(); //测试数据,上线要删除
$userInfo = $this->_getOrmUserInfo();
$this->_setV(TN_RANK_STATUS, 0, 1);
}
if (!$this->loginCheck($userInfo)) {
$userInfo = $this->_getOrmUserInfo();
}
}else{
// if (SERVER_ENV == _ONLINE) {
// if (!$userInfo) {
// $this->createNewUser($userName, $avatarUrl);
// $this->addChip(); //测试数据,上线要删除
// $this->addFragmentBox(); //测试数据,上线要删除
// $userInfo = $this->_getOrmUserInfo();
// $this->_setV(TN_RANK_STATUS, 0, 1);
// }
// if (!$this->loginCheck($userInfo)) {
// $userInfo = $this->_getOrmUserInfo();
// }
// }else{
//测试服
if (!$userInfo) {
$this->createNewUserV2($userName);
$this->addChip(); //测试需要,上线要删除
$this->addFragmentBox(); //测试需要,上线要删除
$this->_addFreeItem(); //测试需要,上线要删除
$userInfo = $this->_getOrmUserInfo();
$this->_setV(TN_RANK_STATUS, 0, 1);
}
@ -70,7 +71,7 @@ class UserController extends BaseAuthedController {
$this->_updateUserInfo(array(
'last_login_time'=>myself()->_getNowTime(),
));
}
// }
$this->updateLastSeason($userInfo);
$this->_rspData(array(
'info' => User::show($userInfo),
@ -155,6 +156,29 @@ class UserController extends BaseAuthedController {
}
}
private function _addFreeItem(){
foreach (mt\Parameter::getListValue('creator_hero_id') as $heroId) {
$heroMeta = mt\Item::get($heroId);
if ($heroMeta) {
Hero::addHero($heroMeta);
}
}
$addItems =array();
foreach (mt\Parameter::getListValue('creator_present_items') as $itemsStr) {
list($itemId, $itemNum) = explode(':', $itemsStr);
if ($itemNum > 0) {
array_push($addItems,
array(
'item_id' => $itemId,
'item_num' => $itemNum
));
}
}
$awardService = new services\AwardService();
$propertyChgService = new services\PropertyChgService();
$this->_addItems($addItems, $awardService, $propertyChgService);
}
private function loginCheck($userInfo)
{
$seasonService = new services\SeasonService();