This commit is contained in:
aozhiwei 2021-12-03 14:18:05 +08:00
parent efe1187307
commit 2c47da7ce5
9 changed files with 49 additions and 8 deletions

View File

@ -19,6 +19,23 @@ class User(object):
['info',_common.UserInfo(), '用户信息']
]
},
{
'name': 'activate',
'desc': '激活用户',
'group': 'User',
'url': 'webapp/index.php?c=User&a=activate',
'params': [
_common.ReqHead(),
['name', 0, '昵称'],
['sex', 0, '性别'],
['head_id', 0, '头像id'],
['head_frame', 0, '头像框'],
],
'response': [
_common.RspHead(),
['property_chg', _common.PropertyChg(), '属性变更'],
]
},
{
'name': 'update',
'desc': '更新用户信息',

View File

@ -47,6 +47,7 @@ class UserInfo(object):
['diamond', 0, '钻石'],
['hero_id', 0, '当前使用的英雄ID'],
['first_fight', 0, '是否是第一次战斗'],
['activate', 0, '是否已激活'],
]
class Hero(object):

View File

@ -42,6 +42,8 @@ CREATE TABLE `t_user` (
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '当前上阵英雄id',
`first_fight` int(11) NOT NULL DEFAULT '0' COMMENT '是否首战',
`last_season_id` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次赛季id',
`activated` int(11) NOT NULL DEFAULT '0' COMMENT '是否已激活',
`activatetime` int(11) NOT NULL DEFAULT '0' COMMENT '激活时间',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),

View File

@ -4,23 +4,28 @@ require_once('mt/Parameter.php');
require_once('mt/Rank.php');
require_once('mt/Season.php');
require_once('models/Season.php');
require_once('services/PropertyChgService.php');
require_once('services/SeasonService.php');
use phpcommon\SqlHelper;
use models\User;
use models\Season;
class SeasonController extends BaseAuthedController {
private $propertyChgService = null;
private $userInfo = null;
private $seasonService = null;
private $currSeasonMeta = null;
private $seasonDb = null;
public function _handlePre()
{
parent::_handlePre();
$currSeasonMeta = mt\Season::getCurrentSeason();
if (!$currSeasonMeta) {
$this->currSeasonMeta = mt\Season::getCurrentSeason();
if (!$this->currSeasonMeta) {
$this->_rspErr(10, '服务器内部错误');
die();
}
@ -31,22 +36,31 @@ class SeasonController extends BaseAuthedController {
$this->userInfo = $this->_safeGetOrmUserInfo();
$this->propertyChgService->addUserChg();
}
$this->seasonDb = Season::find($this->currSeasonMeta['id']);
if (!$this->seasonDb) {
Season::add($this->currSeasonMeta['id']);
$this->seasonDb = Season::find($this->currSeasonMeta['id']);
}
if (!$this->seasonDb) {
$this->_rspErr(10, '服务器内部错误');
die();
}
}
public function info()
{
$rankMeta = mt\Rank::get($userInfo['rank']);
$rankMeta = mt\Rank::get($this->userInfo['rank']);
$this->_rspData(array(
array(
'info' => array(
'season_id' => $currSeasonMeta['id'],
'rank' => $userInfo['rank'],
'season_id' => $this->currSeasonMeta['id'],
'rank' => $this->userInfo['rank'],
'max_score' => $rankMeta ? $rankMeta['max_score'] : 0,
'noshow_score_bar' => $rankMeta ? $rankMeta['noshow_score_bar'] : 1,
'mission' => $this->getMissionInfo()
)
),
'property_chg' => $propertyChgService->toDto()
'property_chg' => $this->propertyChgService->toDto()
));
}

View File

@ -93,6 +93,10 @@ class UserController extends BaseAuthedController {
}
}
public function active()
{
}
public function update()
{
$validFields = array(

View File

@ -43,7 +43,7 @@ class Season extends BaseModel {
array(
'account_id' => myself()->_getAccountId(),
'season_id' => $seasonId,
'card_lv' => $initSeasonCard ? $initSeasonCard['id'] : 1,
'card_lv' => $initSeasonCard ? $initSeasonCard['lv'] : 1,
'card_exp' => $initSeasonCard ? $initSeasonCard['min_exp'] : 0,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()

View File

@ -20,6 +20,7 @@ class User extends BaseModel {
'diamond' => $row['diamond'],
'hero_id' => $row['hero_id'],
'first_fight' => $row['first_fight'],
'activated' => $row['activated'],
);
}
@ -39,6 +40,7 @@ class User extends BaseModel {
'diamond' => $row['diamond'],
'hero_id' => $row['hero_id'],
'first_fight' => $row['first_fight'],
'activated' => $row['activated'],
);
}

View File

@ -11,7 +11,7 @@ class SeasonCard {
return getXVal(self::getMetaList(), $id);
}
public static function getInitCard($id)
public static function getInitCard()
{
return self::get(1);
}

View File

@ -6,6 +6,7 @@ require_once('mt/Rank.php');
require_once('mt/Season.php');
require_once('models/User.php');
use mt;
use models\User;
class SeasonService extends BaseService {