From 29b999dd711f873abaca9eff80f2018f8cff3084 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 4 Jan 2022 19:17:36 +0800 Subject: [PATCH] 1 --- doc/User.py | 1 + sql/gamedb.sql | 51 +++++++++++++++++++++- webapp/controller/UserController.class.php | 4 ++ webapp/models/Hero.php | 17 ++++++++ webapp/mt/Parameter.php | 22 ++++++++++ 5 files changed, 94 insertions(+), 1 deletion(-) diff --git a/doc/User.py b/doc/User.py index 3ce9c780..6e611b9a 100644 --- a/doc/User.py +++ b/doc/User.py @@ -45,6 +45,7 @@ class User(object): ['sex', 0, '性别'], ['head_id', 0, '头像id'], ['head_frame', 0, '头像框'], + ['hero_id', 0, '试用的英雄id'], ], 'response': [ _common.RspHead(), diff --git a/sql/gamedb.sql b/sql/gamedb.sql index c962ef4c..cf29fae2 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -73,7 +73,6 @@ CREATE TABLE `t_hero` ( `state` int(11) NOT NULL DEFAULT '0' COMMENT '0:已购买 1:体验中', `skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '皮肤id', `hero_lv` int(11) NOT NULL DEFAULT '0' COMMENT '英雄等级', - `hero_exp` int(11) NOT NULL DEFAULT '0' COMMENT '英雄等级', `quality` int(11) NOT NULL DEFAULT '0' COMMENT '品阶', `skill_lv1` int(11) NOT NULL DEFAULT '0' COMMENT '必杀技等级', `skill_lv2` int(11) NOT NULL DEFAULT '0' COMMENT '躲避技能等级', @@ -131,6 +130,56 @@ CREATE TABLE `t_bag` ( ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `t_gun` +-- + +DROP TABLE IF EXISTS `t_gun`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_gun` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', + `gun_id` int(11) NOT NULL DEFAULT '0' COMMENT '枪id', + `state` int(11) NOT NULL DEFAULT '0' COMMENT '0:已购买 1:体验中', + `gun_lv` int(11) NOT NULL DEFAULT '0' COMMENT '枪等级', + `quality` int(11) NOT NULL DEFAULT '0' COMMENT '品阶', + `try_count` int(11) NOT NULL DEFAULT '0' COMMENT '剩余体验次数 当state=1时才有意义', + `lock_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:无锁 1:升级 2:升阶', + `unlock_time` int(11) NOT NULL DEFAULT '0' COMMENT '解锁时间', + `unlock_trade_time` int(11) NOT NULL DEFAULT '0' COMMENT '出售解锁时间', + `rand_attr` mediumblob COMMENT '随机属性', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_chip` +-- + +DROP TABLE IF EXISTS `t_chip`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_chip` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', + `chip_id` int(11) NOT NULL DEFAULT '0' COMMENT '芯片id', + `state` int(11) NOT NULL DEFAULT '0' COMMENT '0:已购买 1:体验中', + `try_count` int(11) NOT NULL DEFAULT '0' COMMENT '剩余体验次数 当state=1时才有意义', + `lock_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:无锁 1:升级 2:升阶', + `unlock_time` int(11) NOT NULL DEFAULT '0' COMMENT '解锁时间', + `unlock_trade_time` int(11) NOT NULL DEFAULT '0' COMMENT '出售解锁时间', + `rand_attr` mediumblob COMMENT '随机属性', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `t_gun_skin` -- diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 95b491ba..c626b846 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -171,6 +171,7 @@ class UserController extends BaseAuthedController { $sex = getReqVal('sex', 0); $headId = getReqVal('head_id', 0); $headFrame = getReqVal('head_frame', 0); + $heroId = getReqVal('hero_id', 0); $userInfo = $this->_getOrmUserInfo(); if ($userInfo['activated']) { @@ -198,6 +199,9 @@ class UserController extends BaseAuthedController { $this->_rspErr(1, '参数错误名,head_frame不合法'); return; } + { + $list = mt\Parameter::parseList('creator_present_player', array('|', ':')); + } if (!$nameService->useName($name)) { $this->_rspErr(2, '名字已被占用'); return; diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index d074966b..ef73ea4d 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -33,6 +33,23 @@ class Hero extends BaseModel { return $row; } + public static function getValidHero($heroId) + { + $row = SqlHelper::ormSelectOne( + myself()->_getSelfMysql(), + 't_hero', + array( + 'account_id' => myself()->_getAccountId(), + 'hero_id' => $heroId, + 'state' => self::GETED_STATE, + ) + ); + if ($row) { + $row['hero_uniid'] = $row['idx']; + } + return $row; + } + public static function toDto($row) { $attr = emptyReplace(json_decode($row['rand_attr'], true), array()); diff --git a/webapp/mt/Parameter.php b/webapp/mt/Parameter.php index 82ee9176..cc40938f 100644 --- a/webapp/mt/Parameter.php +++ b/webapp/mt/Parameter.php @@ -46,6 +46,28 @@ class Parameter { return $values; } + public static function parseList($name, $separators) + { + $values = array(); + $val = self::getVal($name, null); + if (!empty($val) && count($separators) > 0) { + function parse($data, $separators, $i, &$arr) { + $strs = explode($separators[$i], $data); + foreach ($strs as $str) { + if ($i + 1 < count($separators)) { + $item = array(); + parse($str, $separators, $i + 1, $item); + array_push($arr, $item); + } else { + array_push($arr, $str); + } + } + } + parse($val, $separators, 0, $values); + } + return $values; + } + protected static function getMetaList() { if (!self::$metaList) {