This commit is contained in:
aozhiwei 2022-01-04 19:17:36 +08:00
parent 5ed06adc39
commit 29b999dd71
5 changed files with 94 additions and 1 deletions

View File

@ -45,6 +45,7 @@ class User(object):
['sex', 0, '性别'],
['head_id', 0, '头像id'],
['head_frame', 0, '头像框'],
['hero_id', 0, '试用的英雄id'],
],
'response': [
_common.RspHead(),

View File

@ -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`
--

View File

@ -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;

View File

@ -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());

View File

@ -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) {