1
This commit is contained in:
parent
efe1187307
commit
2c47da7ce5
17
doc/User.py
17
doc/User.py
@ -19,6 +19,23 @@ class User(object):
|
|||||||
['info',_common.UserInfo(), '用户信息']
|
['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',
|
'name': 'update',
|
||||||
'desc': '更新用户信息',
|
'desc': '更新用户信息',
|
||||||
|
@ -47,6 +47,7 @@ class UserInfo(object):
|
|||||||
['diamond', 0, '钻石'],
|
['diamond', 0, '钻石'],
|
||||||
['hero_id', 0, '当前使用的英雄ID'],
|
['hero_id', 0, '当前使用的英雄ID'],
|
||||||
['first_fight', 0, '是否是第一次战斗'],
|
['first_fight', 0, '是否是第一次战斗'],
|
||||||
|
['activate', 0, '是否已激活'],
|
||||||
]
|
]
|
||||||
|
|
||||||
class Hero(object):
|
class Hero(object):
|
||||||
|
@ -42,6 +42,8 @@ CREATE TABLE `t_user` (
|
|||||||
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '当前上阵英雄id',
|
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '当前上阵英雄id',
|
||||||
`first_fight` int(11) NOT NULL DEFAULT '0' COMMENT '是否首战',
|
`first_fight` int(11) NOT NULL DEFAULT '0' COMMENT '是否首战',
|
||||||
`last_season_id` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次赛季id',
|
`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 '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
@ -4,23 +4,28 @@ require_once('mt/Parameter.php');
|
|||||||
require_once('mt/Rank.php');
|
require_once('mt/Rank.php');
|
||||||
require_once('mt/Season.php');
|
require_once('mt/Season.php');
|
||||||
|
|
||||||
|
require_once('models/Season.php');
|
||||||
|
|
||||||
require_once('services/PropertyChgService.php');
|
require_once('services/PropertyChgService.php');
|
||||||
require_once('services/SeasonService.php');
|
require_once('services/SeasonService.php');
|
||||||
|
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
use models\User;
|
use models\User;
|
||||||
|
use models\Season;
|
||||||
|
|
||||||
class SeasonController extends BaseAuthedController {
|
class SeasonController extends BaseAuthedController {
|
||||||
|
|
||||||
private $propertyChgService = null;
|
private $propertyChgService = null;
|
||||||
private $userInfo = null;
|
private $userInfo = null;
|
||||||
private $seasonService = null;
|
private $seasonService = null;
|
||||||
|
private $currSeasonMeta = null;
|
||||||
|
private $seasonDb = null;
|
||||||
|
|
||||||
public function _handlePre()
|
public function _handlePre()
|
||||||
{
|
{
|
||||||
parent::_handlePre();
|
parent::_handlePre();
|
||||||
$currSeasonMeta = mt\Season::getCurrentSeason();
|
$this->currSeasonMeta = mt\Season::getCurrentSeason();
|
||||||
if (!$currSeasonMeta) {
|
if (!$this->currSeasonMeta) {
|
||||||
$this->_rspErr(10, '服务器内部错误');
|
$this->_rspErr(10, '服务器内部错误');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
@ -31,22 +36,31 @@ class SeasonController extends BaseAuthedController {
|
|||||||
$this->userInfo = $this->_safeGetOrmUserInfo();
|
$this->userInfo = $this->_safeGetOrmUserInfo();
|
||||||
$this->propertyChgService->addUserChg();
|
$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()
|
public function info()
|
||||||
{
|
{
|
||||||
$rankMeta = mt\Rank::get($userInfo['rank']);
|
$rankMeta = mt\Rank::get($this->userInfo['rank']);
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
array(
|
array(
|
||||||
'info' => array(
|
'info' => array(
|
||||||
'season_id' => $currSeasonMeta['id'],
|
'season_id' => $this->currSeasonMeta['id'],
|
||||||
'rank' => $userInfo['rank'],
|
'rank' => $this->userInfo['rank'],
|
||||||
'max_score' => $rankMeta ? $rankMeta['max_score'] : 0,
|
'max_score' => $rankMeta ? $rankMeta['max_score'] : 0,
|
||||||
'noshow_score_bar' => $rankMeta ? $rankMeta['noshow_score_bar'] : 1,
|
'noshow_score_bar' => $rankMeta ? $rankMeta['noshow_score_bar'] : 1,
|
||||||
'mission' => $this->getMissionInfo()
|
'mission' => $this->getMissionInfo()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'property_chg' => $propertyChgService->toDto()
|
'property_chg' => $this->propertyChgService->toDto()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,10 @@ class UserController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function active()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public function update()
|
public function update()
|
||||||
{
|
{
|
||||||
$validFields = array(
|
$validFields = array(
|
||||||
|
@ -43,7 +43,7 @@ class Season extends BaseModel {
|
|||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'season_id' => $seasonId,
|
'season_id' => $seasonId,
|
||||||
'card_lv' => $initSeasonCard ? $initSeasonCard['id'] : 1,
|
'card_lv' => $initSeasonCard ? $initSeasonCard['lv'] : 1,
|
||||||
'card_exp' => $initSeasonCard ? $initSeasonCard['min_exp'] : 0,
|
'card_exp' => $initSeasonCard ? $initSeasonCard['min_exp'] : 0,
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime()
|
'modifytime' => myself()->_getNowTime()
|
||||||
|
@ -20,6 +20,7 @@ class User extends BaseModel {
|
|||||||
'diamond' => $row['diamond'],
|
'diamond' => $row['diamond'],
|
||||||
'hero_id' => $row['hero_id'],
|
'hero_id' => $row['hero_id'],
|
||||||
'first_fight' => $row['first_fight'],
|
'first_fight' => $row['first_fight'],
|
||||||
|
'activated' => $row['activated'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ class User extends BaseModel {
|
|||||||
'diamond' => $row['diamond'],
|
'diamond' => $row['diamond'],
|
||||||
'hero_id' => $row['hero_id'],
|
'hero_id' => $row['hero_id'],
|
||||||
'first_fight' => $row['first_fight'],
|
'first_fight' => $row['first_fight'],
|
||||||
|
'activated' => $row['activated'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class SeasonCard {
|
|||||||
return getXVal(self::getMetaList(), $id);
|
return getXVal(self::getMetaList(), $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getInitCard($id)
|
public static function getInitCard()
|
||||||
{
|
{
|
||||||
return self::get(1);
|
return self::get(1);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ require_once('mt/Rank.php');
|
|||||||
require_once('mt/Season.php');
|
require_once('mt/Season.php');
|
||||||
require_once('models/User.php');
|
require_once('models/User.php');
|
||||||
|
|
||||||
|
use mt;
|
||||||
use models\User;
|
use models\User;
|
||||||
|
|
||||||
class SeasonService extends BaseService {
|
class SeasonService extends BaseService {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user