1
This commit is contained in:
parent
29b999dd71
commit
0ed0793757
@ -188,19 +188,35 @@ class UserController extends BaseAuthedController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isValidSex($sex)) {
|
if (!isValidSex($sex)) {
|
||||||
$this->_rspErr(1, '参数错误名,sex不合法');
|
$this->_rspErr(1, '参数错误,sex不合法');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!User::isValidHeadId($userInfo, $headId)) {
|
if (!User::isValidHeadId($userInfo, $headId)) {
|
||||||
$this->_rspErr(1, '参数错误名,head_id不合法');
|
$this->_rspErr(1, '参数错误,head_id不合法');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!User::isValidHeadFrame($userInfo, $headFrame)) {
|
if (!User::isValidHeadFrame($userInfo, $headFrame)) {
|
||||||
$this->_rspErr(1, '参数错误名,head_frame不合法');
|
$this->_rspErr(1, '参数错误,head_frame不合法');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$heroMeta = mt\Hero::get($heroId);
|
||||||
|
if (!$heroMeta) {
|
||||||
|
$this->_rspErr(1, '参数错误,hero_id不合法');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$heroCfg = null;
|
||||||
{
|
{
|
||||||
$list = mt\Parameter::parseList('creator_present_player', array('|', ':'));
|
$list = mt\Parameter::parseList('creator_present_player', array('|', ':'));
|
||||||
|
foreach ($list as $item) {
|
||||||
|
if ($item[0] == $heroId) {
|
||||||
|
$heroCfg = $item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$heroCfg || $heroCfg[1] <= 0) {
|
||||||
|
$this->_rspErr(1, '参数错误,hero_id不合法');
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!$nameService->useName($name)) {
|
if (!$nameService->useName($name)) {
|
||||||
$this->_rspErr(2, '名字已被占用');
|
$this->_rspErr(2, '名字已被占用');
|
||||||
@ -213,6 +229,7 @@ class UserController extends BaseAuthedController {
|
|||||||
'head_frame' => $headFrame,
|
'head_frame' => $headFrame,
|
||||||
'activated' => 1
|
'activated' => 1
|
||||||
));
|
));
|
||||||
|
Hero::addTryHero($heroMeta, $heroCfg[1]);
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
|
@ -97,7 +97,37 @@ class Hero extends BaseModel {
|
|||||||
'hero_lv' => 1,
|
'hero_lv' => 1,
|
||||||
'hero_tili' => $realHeroMeta ? $realHeroMeta['tili'] : 0,
|
'hero_tili' => $realHeroMeta ? $realHeroMeta['tili'] : 0,
|
||||||
'state' => self::GETED_STATE,
|
'state' => self::GETED_STATE,
|
||||||
#'skin_id' => $defSkin,
|
'skill_lv1' => 1,
|
||||||
|
'skill_lv2' => 1,
|
||||||
|
'rand_attr' => '[]',
|
||||||
|
'lock_type' => self::NO_LOCK,
|
||||||
|
'unlock_time' => 0,
|
||||||
|
'unlock_trade_time' => 0,
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addTryHero($heroMeta, $tryCount)
|
||||||
|
{
|
||||||
|
$realHeroMeta = mt\Hero::get($heroMeta['id']);
|
||||||
|
SqlHelper::upsert(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_hero',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'hero_id' => $heroMeta['id']
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'hero_id' => $heroMeta['id'],
|
||||||
|
'hero_lv' => 1,
|
||||||
|
'hero_tili' => $realHeroMeta ? $realHeroMeta['tili'] : 0,
|
||||||
|
'state' => self::TRY_STATE,
|
||||||
|
'try_count' => $tryCount,
|
||||||
'skill_lv1' => 1,
|
'skill_lv1' => 1,
|
||||||
'skill_lv2' => 1,
|
'skill_lv2' => 1,
|
||||||
'rand_attr' => '[]',
|
'rand_attr' => '[]',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user