From c9cf904059d2ce0040d17b593c250e14f17138c3 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 25 Nov 2021 17:00:31 +0800 Subject: [PATCH] 1 --- doc/Hero.py | 13 + doc/_common.py | 11 + sql/gamedb.sql | 522 +-------------------- webapp/controller/HeroController.class.php | 155 +----- webapp/models/Hero.php | 26 +- webapp/models/HeroSkin.php | 49 ++ 6 files changed, 99 insertions(+), 677 deletions(-) create mode 100644 webapp/models/HeroSkin.php diff --git a/doc/Hero.py b/doc/Hero.py index 84861ac6..4dd5f221 100644 --- a/doc/Hero.py +++ b/doc/Hero.py @@ -19,6 +19,19 @@ class Hero(object): ['!hero_list', _common.Hero, '英雄列表'] ] }, + { + 'name': 'skinList', + 'desc': '获取英雄皮肤列表', + 'group': 'Hero', + 'url': 'webapp/index.php?c=Hero&a=skinList', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['!skin_list', _common.HeroSkin, '英雄皮肤列表'] + ] + }, { 'desc': 'buyHero', 'group': 'Hero', diff --git a/doc/_common.py b/doc/_common.py index 2907cfdc..ccc85fd3 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -136,6 +136,17 @@ class Hero(object): ['yoke_total_exp', 0, '羁绊获得的总经验'], ] +class HeroSkin(object): + + def __init__(self): + self.fields = [ + ['skin_id', 0, '英雄皮肤id'], + ['skin_state', 0, '英雄皮肤状态 0=已经购,1 = 试用状态'], + ['get_from', 0, '获得方式 0 = 系统赠送 1 = 金币购买'], + ['consume_num,', 0, '消耗货币的具体数量'], + ['trytime', 0, '试用开始时间'], + ] + class RobotInfo(object): def __init__(self): diff --git a/sql/gamedb.sql b/sql/gamedb.sql index a933595f..2510cea4 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -18,525 +18,6 @@ CREATE TABLE `version` ( UNIQUE KEY `version` (`version`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; --- --- Table structure for table `user` --- - -DROP TABLE IF EXISTS `user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `user` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `user_name` tinyblob COMMENT '用户名字', - `avatar_url` varchar(256) NOT NULL DEFAULT '' COMMENT '用户头像', - `game_times` int(11) NOT NULL DEFAULT '0' COMMENT '游戏场次', - `win_times` int(11) NOT NULL DEFAULT '0' COMMENT '胜场', - `kills` int(11) NOT NULL DEFAULT '0' COMMENT '所有击杀', - `harm` int(11) NOT NULL DEFAULT '0' COMMENT '所有伤害', - `add_HP` int(11) NOT NULL DEFAULT '0' COMMENT '所有治疗量', - `alive_time` int(11) NOT NULL DEFAULT '0' COMMENT '所有生存时间', - `coin_num` bigint NOT NULL COMMENT '角色金币', - `integral` bigint NOT NULL COMMENT '角色积分', - `kill_his` int(11) NOT NULL DEFAULT '0' COMMENT '最高击杀', - `alive_time_his` int(11) NOT NULL DEFAULT '0' COMMENT '最长生存时间', - `harm_his` int(11) NOT NULL DEFAULT '0' COMMENT '最高伤害', - `add_HP_his` int(11) NOT NULL DEFAULT '0' COMMENT '最多治疗量', - `act_share_status` int(11) NOT NULL DEFAULT '0' COMMENT '分享好礼活动状态', - `act_share_time` int(11) NOT NULL DEFAULT '0'COMMENT '分享好礼活动时间', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `first_fight` int(11) NOT NULL DEFAULT '0' COMMENT '是否是第一次战斗', - `collect_status` int(11) NOT NULL DEFAULT '0' COMMENT '收藏状态', - `keys_num` int(11) NOT NULL DEFAULT '0' COMMENT '钥匙数量', - `battle_re_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日战斗奖励次数', - `shop_flush_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日商店刷新次数', - `kefu_status` int(11) NOT NULL DEFAULT '0' COMMENT '客服奖励状态(0:未领取,1:已领取)', - `sign_sum` int(11) NOT NULL DEFAULT '0' COMMENT '签到总天数', - `box_num` int(11) NOT NULL DEFAULT '0' COMMENT '空投宝箱数量', - `diamond_num` bigint NOT NULL DEFAULT '0' COMMENT '钻石数量', - `diamond_shop_flush_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日钻石商店刷新次数', - `pass_status` int(11) NOT NULL DEFAULT '0' COMMENT '周奖励状态', - `score` int(11) NOT NULL DEFAULT '0' COMMENT '通行证积分', - `season_status` int(11) NOT NULL DEFAULT '0' COMMENT '赛季奖励状态', - `first_gift` int(11) NOT NULL DEFAULT '0' COMMENT '首充礼包领取状态', - `season_time` int(11) NOT NULL DEFAULT '0' COMMENT '赛季结束时间', - `free_coin` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费金币', - `free_diamond` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费钻石', - `season_end_score` int(11) NOT NULL DEFAULT '0' COMMENT '赛季结算积分', - `kill_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '击杀更新时间', - `win_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '胜场更新时间', - `rank_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '排位积分更新时间', - `vip_score` int(11) NOT NULL DEFAULT '0' COMMENT 'vip积分', - `first_login` int(11) NOT NULL DEFAULT '0' COMMENT '是否第一次登陆', - `daily_first_login` int(11) NOT NULL DEFAULT '0' COMMENT '每天是否第一次登陆', - `daily_time` int(11) NOT NULL DEFAULT '0' COMMENT '每日刷新时间', - `free_box` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱', - `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '刷新活动时间', - `season_games` int(11) NOT NULL DEFAULT '0' COMMENT '赛季场次总数', - `season_win` int(11) NOT NULL DEFAULT '0' COMMENT '赛季胜利场次', - `sea_max_kill` int(11) NOT NULL DEFAULT '0' COMMENT '赛季最高击杀', - `sea_max_hart` int(11) NOT NULL DEFAULT '0' COMMENT '赛季最高伤害', - `sea_avg_kill` int(11) NOT NULL DEFAULT '0' COMMENT '赛季场均淘汰', - `free_dou_lot_ticket` int(11) NOT NULL DEFAULT '0' COMMENT '免费十倍抽奖券', - `daily_order1` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱1', - `daily_order2` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱2', - `daily_order3` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱3', - `first_bee` int(11) NOT NULL DEFAULT '0' COMMENT '首次蜜蜂抽奖', - `newhand` int(11) NOT NULL DEFAULT '0' COMMENT '新手奖励状态', - `coin_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日兑换金币次数', - `newInfo` mediumblob NOT NULL COMMENT '新手引导信息', - `first_day_ad` int(11) NOT NULL DEFAULT '0' COMMENT '每日看广告次数', - `share_video_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日分享视频次数', - `act_video_status` int(11) NOT NULL DEFAULT '0' COMMENT '分享录频奖励领取状态', - `act_ad_status` int(11) NOT NULL DEFAULT '0' COMMENT '观看广告奖励领取状态', - `share_video_sums` int(11) NOT NULL DEFAULT '0' COMMENT '分享录频次数', - `biogame_times` int(11) NOT NULL DEFAULT '0' COMMENT '生化模式场次', - `shop_view_times` int(11) NOT NULL DEFAULT '0' COMMENT '商店看广告次数', - `new_first_equip` int(11) NOT NULL DEFAULT '0' COMMENT '新玩家结算武器', - `newhand2` int(11) NOT NULL DEFAULT '0' COMMENT '精英礼包领取状态', - `game_times2` int(11) NOT NULL DEFAULT '0' COMMENT '精英礼包战斗场次', - `view_times2` int(11) NOT NULL DEFAULT '0' COMMENT '精英礼包视频场次', - `guildcoin_num` int(11) NOT NULL DEFAULT '0' COMMENT '战队货币', - `new_second_equip` int(11) NOT NULL DEFAULT '2' COMMENT '新玩家隔天结算武器', - `sum_coin` double NOT NULL DEFAULT '0' COMMENT '累计充值金额', - `recharge_times_total` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值次数', - `rmb_num` int(11) NOT NULL DEFAULT '0' COMMENT '点券数量', - `max_single_recharge` int(11) NOT NULL DEFAULT '0' COMMENT '最大单次充值数量', - `passcard` int(11) NOT NULL DEFAULT '0' COMMENT '购买进阶手册状态', - `rmb_lot_ticket` int(11) NOT NULL DEFAULT '0' COMMENT '充值券数量', - `daily_max_single` int(11) NOT NULL DEFAULT '0' COMMENT '每日最大单次充值数量', - `free_lot_ticket` int(11) NOT NULL DEFAULT '0' COMMENT '免费抽奖券', - `head_kuang_id` int(11) NOT NULL DEFAULT '0' COMMENT '头像框id', - `daily_score` int(11) NOT NULL DEFAULT '0' COMMENT '每日经验', - `daily_offline` int(11) NOT NULL DEFAULT '0' COMMENT '每日额外离线奖励次数', - `create_user` int(11) NOT NULL DEFAULT '0' COMMENT '是否创角', - `sex` int(11) NOT NULL DEFAULT '0' COMMENT '性别', - `sumlot_coin` double NOT NULL DEFAULT '0' COMMENT '累计抽奖剩余金额', - `lv` int(11) NOT NULL DEFAULT '0' COMMENT '玩家等级', - `lv_exp` int(11) NOT NULL DEFAULT '0' COMMENT '玩家当前等级的经验', - `money_of_week` int(11) NOT NULL DEFAULT '0' COMMENT '玩家本周通过战斗获得的金币数量', - `team_name` tinyblob COMMENT '玩家战队昵称', - `hi_id` int(11) NOT NULL DEFAULT '0' COMMENT '头像ID', - `hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '当前使用的英雄ID', - `season_point` int(11) NOT NULL DEFAULT '0' COMMENT '赛季积分', - `max_integral` int(11) NOT NULL DEFAULT '0' COMMENT '最高积分', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid` (`accountid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Table structure for table `bag` --- - -DROP TABLE IF EXISTS `bag`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `bag` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `color_id` int(11) NOT NULL DEFAULT '0' COMMENT '颜色id', - `status` int(11) NOT NULL DEFAULT '0' COMMENT '状态(0:上阵中,1:已获得,2:未获得)', - `active_time` varchar(50) NOT NULL DEFAULT '' COMMENT '有效时间(体验时间)', - `num` int(11) NOT NULL DEFAULT '0' COMMENT '数量', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `item_uuid` (`accountid`, `id`), - KEY `accountid` (`accountid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Table structure for table `sign` --- - -DROP TABLE IF EXISTS `sign`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sign` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `sign_id` int(11) NOT NULL DEFAULT '0' COMMENT '补签id', - `signable` int(11) NOT NULL DEFAULT '0' COMMENT '是否签到', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `sign_time` int(11) NOT NULL DEFAULT '0' COMMENT '签到时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_sign_id` (`accountid`, `sign_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - - --- --- Table structrure for table `quest` --- - -DROP TABLE IF EXISTS `quest`; -/*!40101 SET @saved_cs_client = @@character_set_client*/; -/*!40101 SET character_set_client = utf8*/; -CREATE TABLE `quest` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `quest_id` int(11) NOT NULL DEFAULT '0' COMMENT '任务id', - `quest_num` int(11) NOT NULL DEFAULT '0' COMMENT '任务进度', - `quest_type` int(11) NOT NULL DEFAULT '0' COMMENT '任务类型', - `quest_state` int(11) NOT NULL DEFAULT '0' COMMENT '任务状态', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `quest_uuid` (`accountid`, `quest_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Table structure for table `share_achievement` --- - -DROP TABLE IF EXISTS `share_achievement`; -/*!40101 SET @saved_cs_client = @@character_set_client*/; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `share_achievement` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `ach_id` int(11) NOT NULL DEFAULT '0' COMMENT '分享邀请成就id', - `status` int(11) NOT NULL DEFAULT '0' COMMENT '状态(0:未领取,1:已领取)', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid_ach_id` (`accountid`, `ach_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - - -DROP TABLE IF EXISTS `activity`; -/*!40101 SET @saved_cs_client = @@character_set_client*/; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `activity` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `free_times` int(11) NOT NULL DEFAULT '0' COMMENT '免费抽奖次数', - `video_times` int(11) NOT NULL DEFAULT '0' COMMENT '视频抽奖次数', - `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id', - `item_num` int(11) NOT NULL DEFAULT '0' COMMENT '物品数量', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `now_days` int(11) NOT NULL DEFAULT '0' COMMENT '当前第几天', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid` (`accountid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - - -DROP TABLE IF EXISTS `passinfo`; -/*!40101 SET @saved_cs_client = @@character_set_client*/; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `passinfo` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `passid` int(11) NOT NULL DEFAULT '0' COMMENT 'passid', - `active_status` int(11) NOT NULL DEFAULT '0' COMMENT '普通奖励状态', - `honor_status` int(11) NOT NULL DEFAULT '0' COMMENT '充值奖励状态', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `accountid` (`accountid`), - UNIQUE KEY `accountid_passid` (`accountid`, `passid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -DROP TABLE IF EXISTS `shop`; -/*!40101 SET @saved_cs_client = @@character_set_client*/; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `shop` ( - `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `coin_id` int(11) NOT NULL DEFAULT '0' COMMENT '金币商店物品id', - `coin_discount` int(11) NOT NULL DEFAULT '0' COMMENT '金币商店折扣', - `diamond_id` int(11) NOT NULL DEFAULT '0' COMMENT '钻石商店物品id', - `diamond_discount` int(11) NOT NULL DEFAULT '0' COMMENT '钻石商店折扣', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid` (`accountid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -DROP TABLE IF EXISTS `additem_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `additem_log` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `add_id` varchar(60) DEFAULT '' COMMENT '道具id', - `add_time` int(11) NOT NULL DEFAULT '0' COMMENT '添加时间', - `add_num` int(11) NOT NULL DEFAULT '0' COMMENT '道具数量', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_add_id_add_time` (`accountid`, `add_id` , `add_time`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - - -DROP TABLE IF EXISTS `equip`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `equip` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `id` int(11) NOT NULL DEFAULT '0' COMMENT '装备id', - `lv` int(11) NOT NULL DEFAULT '0' COMMENT '装备等级', - `active_time` int(11) NOT NULL DEFAULT '0' COMMENT '进阶时间', - `sub_time` int(11) NOT NULL DEFAULT '0' COMMENT '缩短时间', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - - `using_id` int(11) NOT NULL DEFAULT '0' COMMENT '上阵id', - `exp` int(11) NOT NULL DEFAULT '0' COMMENT '当前经验', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid_id` (`accountid`, id) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -DROP TABLE IF EXISTS `shop_data`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `shop_data` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `blobdata` mediumblob COMMENT '商店数据json', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid` (`accountid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -DROP TABLE IF EXISTS `festival_activity`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `festival_activity` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `blobdata` mediumblob COMMENT '节日活动数据json', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid` (`accountid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -DROP TABLE IF EXISTS `orderinfo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; - -CREATE TABLE `orderinfo` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `orderid` varchar(60) DEFAULT '' COMMENT '订单id', - `rmb_num` int(11) NOT NULL DEFAULT '0' COMMENT '点券数量', - `money` int(11) NOT NULL DEFAULT '0' COMMENT '金钱数量', - `custom_data` mediumblob COMMENT '其他字段', - `itemid` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_orderid` (`accountid`, `orderid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -DROP TABLE IF EXISTS `recharge_activity`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `recharge_activity` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `blobdata` mediumblob COMMENT '充值活动数据json', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid` (`accountid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - - -DROP TABLE IF EXISTS `vipinfo`; -/*!40101 SET @saved_cs_client = @@character_set_client*/; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `vipinfo` ( - `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `vipid` int(11) NOT NULL DEFAULT '0' COMMENT 'vipid', - `reward_id` int(11) NOT NULL DEFAULT '0' COMMENT '奖励id', - `reward_status` int(11) NOT NULL DEFAULT '0' COMMENT '奖励状态', - `today_reward_id` int(11) NOT NULL DEFAULT '0' COMMENT '每周奖励id', - `today_reward_status` int(11) NOT NULL DEFAULT '0' COMMENT '每周奖励状态', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `accountid` (`accountid`), - UNIQUE KEY `accountid_vipid` (`accountid`, `vipid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -DROP TABLE IF EXISTS `hang`; -/*!40101 SET @saved_cs_client = @@character_set_client*/; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `hang` ( - `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `hang_time` varchar(50) NOT NULL DEFAULT '' COMMENT '领取时间', - `reward_id` int(11) NOT NULL DEFAULT '0' COMMENT '奖励id', - `reward_num` int(11) NOT NULL DEFAULT '0' COMMENT '奖励数量', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid` (`accountid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - - -DROP TABLE IF EXISTS `event`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `event` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `sender_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '事件发送方id', - `target_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '事件接受方id', - `event_name` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '事件名', - `param1` tinyblob COMMENT 'param1', - `param2` tinyblob COMMENT 'param2', - `param3` tinyblob COMMENT 'param3', - `event_data` mediumblob COMMENT '事件数据', - `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:未处理 1:已处理', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - PRIMARY KEY (`idx`), - KEY `sender_id` (`sender_id`), - KEY `target_id` (`target_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -DROP TABLE IF EXISTS `vip_user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `vip_user` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', - `vip_lv` int(11) NOT NULL DEFAULT '0' COMMENT 'vip等级', - `privi_lv` int(11) NOT NULL DEFAULT '0' COMMENT '特权等级', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `privi_daily_mail_lasttime` int(11) NOT NULL DEFAULT '0' COMMENT '特权每日邮件最后发送时间', - `vip_weekly_mail_lasttime` int(11) NOT NULL DEFAULT '0' COMMENT 'vip每周邮件最后发送时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid` (`accountid`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - - -DROP TABLE IF EXISTS `draw`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `draw` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', - `id` int(11) NOT NULL DEFAULT '0' COMMENT '抽奖id', - `isfree` int(11) NOT NULL DEFAULT '0' COMMENT '是否免费', - `free_times` int(11) NOT NULL DEFAULT '0' COMMENT '免费次数', - `draw_times` int(11) NOT NULL DEFAULT '0' COMMENT '抽奖次数', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid_drawid` (`accountid`, `id`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Table structure for table `hero` --- - -DROP TABLE IF EXISTS `hero`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `hero` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', - `id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id', - `lv` int(11) NOT NULL DEFAULT '0' COMMENT '英雄等级', - `skinid` int(11) NOT NULL DEFAULT '0' COMMENT '皮肤id', - `skill1_lv1` int(11) NOT NULL DEFAULT '1' COMMENT '必杀技等级', - `skill1_lv2` int(11) NOT NULL DEFAULT '1' COMMENT '躲避技能等级', - `yokeexp` int(11) NOT NULL DEFAULT '0' COMMENT '当前羁绊等级的经验', - `yoketotalexp` int(11) NOT NULL DEFAULT '0' COMMENT '羁绊获得的总经验', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid_drawid` (`accountid`, `id`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Table structure for table `hero_skin` --- - -DROP TABLE IF EXISTS `hero_skin`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `hero_skin` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', - `hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id', - `skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤id', - `skin_state` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤状态 0=已经购,1 = 试用状态', - `get_from` int(11) NOT NULL DEFAULT '0' COMMENT '获得方式 0 = 系统赠送 1 = 金币购买', - `consume_num` int(11) NOT NULL DEFAULT '0' COMMENT '消耗货币的具体数量', - `trytime` int(11) NOT NULL DEFAULT '0' COMMENT '试用开始时间', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid_heroid_skinid` (`accountid`, `hero_id`,`skin_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Table structure for table `gun_intensify` --- - -DROP TABLE IF EXISTS `gun_intensify`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `gun_intensify` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', - `gun_type_id` int(11) NOT NULL DEFAULT '0' COMMENT '枪类型的id', - `skill_id` int(11) NOT NULL DEFAULT '0' COMMENT '技能ID', - `skill_lv` int(11) NOT NULL DEFAULT '0' COMMENT '技能等级', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid_gun_type_id_skill_id` (`accountid`, `gun_type_id`,`skill_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Table structure for table `gun` --- - -DROP TABLE IF EXISTS `gun`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `gun` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', - `gun_id` int(11) NOT NULL DEFAULT '0' COMMENT '枪的id', - `skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '装备的皮肤ID', - `trytime` int(11) NOT NULL DEFAULT '0' COMMENT '试用开始时间', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid_gun_id` (`accountid`, `gun_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Table structure for table `gun_skin` --- - -DROP TABLE IF EXISTS `gun_skin`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `gun_skin` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', - `gun_id` int(11) NOT NULL DEFAULT '0' COMMENT '枪的id', - `skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '皮肤ID', - `trytime` int(11) NOT NULL DEFAULT '0' COMMENT '试用开始时间', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `accountid_gun_id_skin_id` (`accountid`, `gun_id`,`skin_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - -- -- Table structure for table `t_user` -- @@ -596,7 +77,6 @@ DROP TABLE IF EXISTS `t_hero_skin`; CREATE TABLE `t_hero_skin` ( `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', - `hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id', `skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤id', `skin_state` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤状态 0=已经购,1 = 试用状态', `get_from` int(11) NOT NULL DEFAULT '0' COMMENT '获得方式 0 = 系统赠送 1 = 金币购买', @@ -605,7 +85,7 @@ CREATE TABLE `t_hero_skin` ( `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), - UNIQUE KEY `accountid_heroid_skinid` (`accountid`, `hero_id`, `skin_id`) + UNIQUE KEY `accountid_skinid` (`accountid`, `skin_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index 0a5f1165..e5534b48 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -4,9 +4,11 @@ require_once('mt/Shop.php'); require_once('mt/Hero.php'); require_once('models/Hero.php'); +require_once('models/HeroSkin.php'); use phpcommon\SqlHelper; use models\Hero; +use models\HeroSkin; class HeroController extends BaseAuthedController { @@ -28,6 +30,24 @@ class HeroController extends BaseAuthedController { )); } + public function skinList() + { + $skinList = array(); + SqlHelper::ormSelect( + $this->getSelfMysql(), + 't_hero_skin', + array( + 'accountid' => $this->getAccountId() + ), + function ($row) use(&$skinList) { + array_push($skinList, HeroSkin::toDto($row)); + } + ); + $this->rspData(array( + 'skin_list' => $skinList + )); + } + public function buyHero() { $heroId = getReqVal('hero_id', 0); @@ -70,35 +90,8 @@ class HeroController extends BaseAuthedController { public function buySkin() { - - } - - private function addHeroToDB($heroID,$_heroCfg) - { - $code = 100; - $itemArr = array(); - $resultArr = array(); - $heroCfg = $_heroCfg; - $skinListStr = $heroCfg["skinlist"]; - $skinIDArr = explode("|",$skinListStr); - $skinID = $skinIDArr[0]; - $itemData = array("hero_id"=>$heroID,"skin_id"=>$skinID); - array_push($itemArr,$itemData); - - $skinData = array( - 'accountid' => $this->getAccountId(),'hero_id' => $heroID,'skin_id' => $skinID, - 'skin_state' => 0, - 'get_from' => 0, - 'consume_num' => 0, - 'trytime' => 0 - ); - - $this->addHeroSkin($skinData); - - $this->addAllHero($itemArr); - array_push($resultArr,$itemData); - array_push($resultArr,$skinData); - return $resultArr; + $heroId = getReqVal('hero_id', 0); + $skinId = getReqVal('skin_id', 0); } private function addHeroAndSkin($heroID,$_heroCfg,$skinID) @@ -137,28 +130,6 @@ class HeroController extends BaseAuthedController { return $resultArr; } - public function getHeroInfoByID() - { - $account_id = $_REQUEST['account_id']; - $heroID = $_REQUEST['heroID']; - $conn = $this->getMysql($account_id); - $sqlStr = "SELECT * FROM hero WHERE accountid=:accountid AND id=:id;"; - $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':id' => $heroID)); - - if($row) { - // error_log("getHero======"); - } - else{ - // error_log("getHeroFailed======="); - } - $this->sendDataToClient(0,"getHeroInfoByID",$row); - } - - public function getYokeItemInfo()//获得羁绊道具信息 - { - - } - public function changeSkin()//切换英雄皮肤 { $skinID = $_REQUEST['skin_id']; @@ -314,30 +285,7 @@ class HeroController extends BaseAuthedController { } $this->sendDataToClient($code,"buyHero",$heroData); } - private function updateCurrency($_money,$_diamond) - { - $account_id = $_REQUEST['account_id']; - $conn = $this->getMysql($account_id); - - $sqlStr2 = "Update user set coin_num =:coin_num,diamond_num =:diamond_num WHERE accountid=:accountid "; - $row = $conn->execQuery($sqlStr2,array(':accountid' => $account_id,':coin_num' => $_money,':diamond_num' => $_diamond)); - - } - public function getAllHeroSkinByID()//获得英雄的所有皮肤 - { - $account_id = $_REQUEST['account_id']; - $conn = $this->getMysql($account_id); - $heroID = $_REQUEST['hero_id']; - $sqlStr = "SELECT hero_id,skin_id,skin_state,get_from,consume_num,trytime FROM hero_skin WHERE accountid=:accountid AND hero_id=:hero_id;"; - $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':hero_id' => $heroID)); - if($row) { - //error_log("getHeroSkin====="); - } - else{ - //error_log("getHeroSkinFailed======="); - } - $this->sendDataToClient(0,"getHeroSkin",$row); - } + public function skillLvUp()//技能升级 { $skillCfgArr = require('../res/skill@skill.php'); @@ -605,62 +553,5 @@ class HeroController extends BaseAuthedController { $resultArr = array("itemCnt"=>$itemNum,"itemPerExp"=>$perExp,"itemID"=>$itemID,"heroLV"=>$heroLv,"totalExp"=>$totalGetExp,"curExp"=>$curHeroExp); $this->sendDataToClient($code,"ok",$resultArr); } - private function addHeroSkin($item) - { - phpcommon\SqlHelper::insertOrUpdate - ($this->getSelfMysql(), - 'hero_skin', - array( - 'accountid' => $this->getAccountId(), - 'hero_id' => $item['hero_id'], - 'skin_id' => $item['skin_id'] - ), - array( - 'accountid' => $this->getAccountId(), - 'hero_id' => $item['hero_id'], - 'skin_id' => $item['skin_id'], - 'skin_state' => $item['skin_state'], - 'get_from' => $item['get_from'], - 'consume_num' => $item['consume_num'], - 'trytime' => $item['trytime'], - 'createtime' => $this->getNowTime(), - 'modifytime' => $this->getNowTime() - ), - array( - 'skin_state' => 3, - 'modifytime' => $this->getNowTime() - ) - ); - } - - private function addAllHero($items) - { - foreach ($items as $item) { - phpcommon\SqlHelper::insertOrUpdate - ($this->getSelfMysql(), - 'hero', - array( - 'accountid' => $this->getAccountId(), - 'id' => $item['hero_id'] - ), - array( - 'accountid' => $this->getAccountId(), - 'id' => $item['hero_id'], - 'lv' => 1, - 'skinid' => $item['skin_id'], - 'skill1_lv1' =>1, - 'skill1_lv2' =>1, - 'yokeexp' => 0, - 'yoketotalexp' => 0, - 'createtime' => $this->getNowTime(), - 'modifytime' => $this->getNowTime() - ), - array( - 'skill_lv1' => 1, - 'modifytime' => $this->getNowTime() - ) - ); - } - } } diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 1fc73dcd..abf98662 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -3,6 +3,7 @@ namespace models; require_once('mt/Hero.php'); +require_once('models/HeroSkin.php'); use mt; use phpcommon\SqlHelper; @@ -48,30 +49,7 @@ class Hero extends BaseModel { ) ); if ($defSkin) { - SqlHelper::upsert( - myself()->getSelfMysql(), - 't_hero_skin', - array( - 'accountid' => myself()->getAccountId(), - 'hero_id' => $heroMeta['id'], - 'skin_id' => $defSkin - ), - array( - 'skin_state' => 3, - 'modifytime' => myself()->getNowTime() - ), - array( - 'accountid' => myself()->getAccountId(), - 'hero_id' => $heroMeta['id'], - 'skin_id' => $defSkin, - 'skin_state' => 0, - 'get_from' => 0, - 'consume_num' => 0, - 'trytime' => 0, - 'createtime' => myself()->getNowTime(), - 'modifytime' => myself()->getNowTime() - ) - ); + HeroSkin::addSkin($defSkin); } } diff --git a/webapp/models/HeroSkin.php b/webapp/models/HeroSkin.php new file mode 100644 index 00000000..85b97f1b --- /dev/null +++ b/webapp/models/HeroSkin.php @@ -0,0 +1,49 @@ + $row['skin_id'], + 'skin_state' => $row['skin_state'], + 'get_from' => $row['get_from'], + 'consume_num' => $row['consume_num'], + 'trytime' => $row['trytime'], + ); + } + + public static function addSkin($skinId) + { + SqlHelper::upsert( + myself()->getSelfMysql(), + 't_hero_skin', + array( + 'accountid' => myself()->getAccountId(), + 'skin_id' => $skinId + ), + array( + 'skin_state' => 3, + 'modifytime' => myself()->getNowTime() + ), + array( + 'accountid' => myself()->getAccountId(), + 'skin_id' => $skinId, + 'skin_state' => 0, + 'get_from' => 0, + 'consume_num' => 0, + 'trytime' => 0, + 'createtime' => myself()->getNowTime(), + 'modifytime' => myself()->getNowTime() + ) + ); + } + +}