diff --git a/doc/User.py b/doc/User.py index 6e611b9a..c18b9f72 100644 --- a/doc/User.py +++ b/doc/User.py @@ -62,7 +62,7 @@ class User(object): ['sex', 0, '更新性别(可选参数,不传就不更新)'], ['head_id', 0, '更新头像(可选参数,不传就不更新)'], ['head_frame', 0, '更新头像框(可选参数,不传就不更新)'], - ['hero_uniid', 0, '更新上阵英雄唯一id(可选参数,不传就不更新)'], + ['hero_id', 0, '更新上阵英雄id(可选参数,不传就不更新)'], ['first_fight', 0, '更新首次战斗(可选参数,不传就不更新)'] ], 'response': [ diff --git a/sql/gamedb.sql b/sql/gamedb.sql index e7f3e326..7d212fcc 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -40,7 +40,6 @@ CREATE TABLE `t_user` ( `score` int(11) NOT NULL DEFAULT '0' COMMENT '积分', `gold` int(11) NOT NULL DEFAULT '0' COMMENT '金币', `diamond` int(11) NOT NULL DEFAULT '0' COMMENT '钻石', - `hero_uniid` 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 '是否首战', `last_season_id` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次赛季id', diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 36c68a64..8a054fdb 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -26,7 +26,7 @@ class UserController extends BaseAuthedController { { //$user_name = $_REQUEST['name']; //$avatar_url = $_REQUEST['avatar_url']; - $userName = '极乐玩家'; + $userName = 'guest'; $avatarUrl = '18003'; $userInfo = $this->_safeGetOrmUserInfo(); @@ -125,7 +125,7 @@ class UserController extends BaseAuthedController { $headId = !empty($haveHeadHeroList) ? $haveHeadHeroList[rand() % count($haveHeadHeroList)]['hero_head'] : 0; } - Hero::randHero($heroUniId, $heroId); + //Hero::randHero($heroUniId, $heroId); SqlHelper::upsert ($this->_getSelfMysql(), 't_user', @@ -148,7 +148,6 @@ class UserController extends BaseAuthedController { 'history_best_rank' => $initRankMeta ? $initRankMeta['rank'] : 1, 'score' => $initRankMeta ? $initRankMeta['min_score'] : 0, 'head_id' => $headId, - 'hero_uniid' => $heroUniId, 'hero_id' => $heroId, 'last_season_id' => $currSeasonMeta ? $currSeasonMeta['id'] : 0, 'head_list' => json_encode($headList), @@ -240,7 +239,6 @@ class UserController extends BaseAuthedController { public function update() { $userInfo = $this->_getOrmUserInfo(); - $heroId = $userInfo['hero_id']; $validFields = array( 'sex' => array( 'field_name' => 'sex', @@ -287,15 +285,13 @@ class UserController extends BaseAuthedController { } } ), - 'hero_uniid' => array( - 'field_name' => 'hero_uniid', + 'hero_id' => array( + 'field_name' => 'hero_id', 'val_func' => function ($val) { return $val; }, 'valid_func' => function ($val, &$errCode, &$errMsg) use (&$heroId) { - $heroDb = Hero::find($val); - if ($heroDb) { - $heroId = $heroDb['hero_id']; + if (Hero::getValidHero($val)) { return true; } else { $errCode = 1; diff --git a/webapp/models/User.php b/webapp/models/User.php index 6b4fa2a6..f574923b 100644 --- a/webapp/models/User.php +++ b/webapp/models/User.php @@ -38,7 +38,6 @@ class User extends BaseModel { 'score' => $row['score'], 'gold' => $row['gold'], 'diamond' => $row['diamond'], - 'hero_uniid' => $row['hero_uniid'], 'hero_id' => $row['hero_id'], 'first_fight' => $row['first_fight'], 'head_list' => self::getHeadList($row), @@ -63,7 +62,6 @@ class User extends BaseModel { 'score' => $row['score'], 'gold' => $row['gold'], 'diamond' => $row['diamond'], - 'hero_uniid' => $row['hero_uniid'], 'hero_id' => $row['hero_id'], 'first_fight' => $row['first_fight'], 'head_list' => self::getHeadList($row),