diff --git a/doc/ComputingPower.py b/doc/ComputingPower.py index eab75e78..1cc5b037 100644 --- a/doc/ComputingPower.py +++ b/doc/ComputingPower.py @@ -1,123 +1,149 @@ -# -*- coding: utf-8 -*- - -import _common - -class ComputingPower(object): - - def __init__(self): - self.apis = [ - { - 'name': 'info', - 'desc': '获取算力信息', - 'group': 'ComputingPower', - 'url': 'webapp/index.php?c=ComputingPower&a=info', - 'params': [ - _common.ReqHead(), - ], - 'response': [ - _common.RspHead(), - ['info', _common.ComputingPower(), '算力信息'] - ] - }, - { - 'name': 'getCrystalUi', - 'desc': '获取晶体ui信息', - 'group': 'ComputingPower', - 'url': 'webapp/index.php?c=ComputingPower&a=getCrystalUi', - 'params': [ - _common.ReqHead(), - ], - 'response': [ - _common.RspHead(), - ['data', _common.CrystalUI(), '晶体的获取方式信息'] - ] - }, - { - 'name': 'exchangeCrystal', - 'desc': '兑换晶体', - 'group': 'ComputingPower', - 'url': 'webapp/index.php?c=ComputingPower&a=exchangeCrystal', - 'params': [ - _common.ReqHead(), - ['item_id', 0, '晶体item'], -# ['item_num', 0, '晶体数量'], - ], - 'response': [ - _common.RspHead(), - ['property_chg', _common.PropertyChg(), '属性变更'], - ] - }, - { - 'name': 'getExchangeCrystalRecord', - 'desc': '获取兑换晶体记录', - 'group': 'ComputingPower', - 'url': 'webapp/index.php?c=ComputingPower&a=getExchangeCrystalRecord', - 'params': [ - _common.ReqHead(), - ], - 'response': [ - _common.RspHead(), - ['data', _common.ExchangeCrystalRecord(), '算力信息'] - ] - }, - { - 'name': 'exchangePower', - 'desc': '晶体兑换算力', - 'group': 'ComputingPower', - 'url': 'webapp/index.php?c=ComputingPower&a=exchangePower', - 'params': [ - _common.ReqHead(), - ['num1', 0, '晶体260001兑换数'], - ['num2', 0, '晶体260002兑换数'], - ['num3', 0, '晶体260003兑换数'], - ['num4', 0, '晶体260004兑换数'], - ], - 'response': [ - _common.RspHead(), - ['property_chg', _common.PropertyChg(), '属性变更'], - ] - }, - { - 'name': 'exchangeUplimit', - 'desc': '每周晶体兑换上限', - 'group': 'ComputingPower', - 'url': 'webapp/index.php?c=ComputingPower&a=exchangeUplimit', - 'params': [ - _common.ReqHead(), - ], - 'response': [ - _common.RspHead(), - ['data', _common.ExchangeCrystalNum(), '本周期晶体兑换信息'] - ] - }, - { - 'name': 'getRewardHistory', - 'desc': '获取奖励历史', - 'group': 'ComputingPower', - 'url': 'webapp/index.php?c=ComputingPower&a=getRewardHistory', - 'params': [ - _common.ReqHead(), - ['star_time', 0, '开始时间,都没传查全部'], - ['end_time', 0, '结束时间,都没传查全部'], - ], - 'response': [ - _common.RspHead(), - ['!data', [_common.CECRewardHistory()], '算力信息'], - ['pending_rewards', '', '剩余总计'], - ] - }, - # - # { - # 'name': 'getExchangePowerHistorys', - # 'desc': '获取兑换算力历史', - # 'group': 'ComputingPower', - # 'url': 'webapp/index.php?c=ComputingPower&a=getExchangePowerHistorys', - # 'params': [ - # _common.ReqHead(), - # ], - # 'response': [ - # _common.RspHead(), - # ['info', _common.ComputingPower(), '算力信息'] - # ] - # }, - ] +# -*- coding: utf-8 -*- + +import _common + +class ComputingPower(object): + + def __init__(self): + self.apis = [ + { + 'name': 'info', + 'desc': '获取算力信息', + 'group': 'ComputingPower', + 'url': 'webapp/index.php?c=ComputingPower&a=info', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['info', _common.ComputingPower(), '算力信息'] + ] + }, + { + 'name': 'getCrystalUi', + 'desc': '获取晶体ui信息', + 'group': 'ComputingPower', + 'url': 'webapp/index.php?c=ComputingPower&a=getCrystalUi', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['data', _common.CrystalUI(), '晶体的获取方式信息'] + ] + }, + { + 'name': 'exchangeCrystal', + 'desc': '兑换晶体', + 'group': 'ComputingPower', + 'url': 'webapp/index.php?c=ComputingPower&a=exchangeCrystal', + 'params': [ + _common.ReqHead(), + ['item_id', 0, '晶体item'], +# ['item_num', 0, '晶体数量'], + ], + 'response': [ + _common.RspHead(), + ['property_chg', _common.PropertyChg(), '属性变更'], + ] + }, + { + 'name': 'getExchangeCrystalRecord', + 'desc': '获取兑换晶体记录', + 'group': 'ComputingPower', + 'url': 'webapp/index.php?c=ComputingPower&a=getExchangeCrystalRecord', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['data', _common.ExchangeCrystalRecord(), '算力信息'] + ] + }, + { + 'name': 'exchangePower', + 'desc': '晶体兑换算力', + 'group': 'ComputingPower', + 'url': 'webapp/index.php?c=ComputingPower&a=exchangePower', + 'params': [ + _common.ReqHead(), + ['num1', 0, '晶体260001兑换数'], + ['num2', 0, '晶体260002兑换数'], + ['num3', 0, '晶体260003兑换数'], + ['num4', 0, '晶体260004兑换数'], + ], + 'response': [ + _common.RspHead(), + ['property_chg', _common.PropertyChg(), '属性变更'], + ] + }, + { + 'name': 'exchangeUplimit', + 'desc': '每周晶体兑换上限', + 'group': 'ComputingPower', + 'url': 'webapp/index.php?c=ComputingPower&a=exchangeUplimit', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['data', _common.ExchangeCrystalNum(), '本周期晶体兑换信息'] + ] + }, + { + 'name': 'getRewardHistory', + 'desc': '获取奖励历史', + 'group': 'ComputingPower', + 'url': 'webapp/index.php?c=ComputingPower&a=getRewardHistory', + 'params': [ + _common.ReqHead(), + ['star_time', 0, '开始时间,都没传查全部'], + ['end_time', 0, '结束时间,都没传查全部'], + ], + 'response': [ + _common.RspHead(), + ['!data', [_common.CECRewardHistory()], '算力信息'], + ['pending_rewards', '', '剩余总计'], + ] + }, + { + 'name': 'exchangeUplimitNew', + 'desc': '晶体兑换上限', + 'group': 'ComputingPower', + 'url': 'webapp/index.php?c=ComputingPower&a=exchangeUplimitNew', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['totalNum', 0, '可领取的总晶体'], + ['!playing', [Info()], '游戏行为'], + ['!staking', [Info()], '质押行为'], + ['!consuming', [Info()], '支出行为'], + ] + }, + { + 'name': 'claimCrystal', + 'desc': '一键领取晶体', + 'group': 'ComputingPower', + 'url': 'webapp/index.php?c=ComputingPower&a=claimCrystal', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['award', _common.Award(), '奖励信息'], + ['property_chg', _common.PropertyChg(), '属性变更'], + ] + }, + ] + + +class Info(object): + + def __init__(self): + self.fields = [ + ['task_id', 0, 'task_id'], + ['uplimit', '', '上限数量 -1为无上限'], + ['chaim_num', 0, '可领取数量'], + ] \ No newline at end of file diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 59d04cdc..851cc237 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -1,1696 +1,1710 @@ --- MySQL dump 10.14 Distrib 5.5.41-MariaDB, for Linux (x86_64) --- --- Host: localhost Database: accountdb --- ------------------------------------------------------ --- Server version 5.5.41-MariaDB - --- --- Table structure for table `version` --- - -DROP TABLE IF EXISTS `version`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `version` ( - `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `version` int(11) NOT NULL DEFAULT '0' COMMENT '版本号', - PRIMARY KEY (`idx`), - UNIQUE KEY `version` (`version`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_user` --- - -DROP TABLE IF EXISTS `t_user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_user` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', - `address` varchar(60) COMMENT 'address', - `name` tinyblob COMMENT '用户名字', - `sex` int(11) NOT NULL DEFAULT '0' COMMENT '性别', - `head_id` int(11) NOT NULL DEFAULT '0' COMMENT '头像id', - `head_frame` int(11) NOT NULL DEFAULT '0' COMMENT '头像框id', - `level` int(11) NOT NULL DEFAULT '0' COMMENT '等级', - `exp` int(11) NOT NULL DEFAULT '0' COMMENT '经验', - `rank` int(11) NOT NULL DEFAULT '0' COMMENT '段位', - `history_best_rank` int(11) NOT NULL DEFAULT '0' COMMENT '历史最高段位', - `score` int(11) NOT NULL DEFAULT '0' COMMENT '积分', - `history_best_score` int(11) NOT NULL DEFAULT '0' COMMENT '历史最高积分', - `elo` int(11) NOT NULL DEFAULT '0' COMMENT '隐藏ELO积分', - `bceg` double NOT NULL DEFAULT '0' COMMENT '中心化代币', - `gold` double NOT NULL DEFAULT '0' COMMENT '金币', - `diamond` double NOT NULL DEFAULT '0' COMMENT '钻石', - `hero_id` bigint 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', - `activated` int(11) NOT NULL DEFAULT '0' COMMENT '是否已激活', - `rename_count` int(11) NOT NULL DEFAULT '0' COMMENT '改名次数', - `activatetime` int(11) NOT NULL DEFAULT '0' COMMENT '激活时间', - `already_guide` int(11) NOT NULL DEFAULT '0' COMMENT '已引导', - `pve_instance_id` int(11) NOT NULL DEFAULT '0' COMMENT '已过pve副本id', - `like_count` int(11) NOT NULL DEFAULT '0' COMMENT '被点赞次数', - `head_list` mediumblob COMMENT '拥有的头像列表', - `head_frame_list` mediumblob COMMENT '拥有的头像框列表', - `consume_gold` bigint NOT NULL DEFAULT '0' COMMENT '消费金币数', - `score_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '积分修改时间', - `best_rank_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT 'bestrank修改时间', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `last_login_time` int(11) NOT NULL DEFAULT '0' COMMENT '上次登录时间', - `is_gain_item` int(11) NOT NULL DEFAULT '0' COMMENT '是否获取免费item道具', - `guild_id` varchar(60) NOT NULL DEFAULT '' COMMENT '工会id', - `guild_job` int(11) NOT NULL DEFAULT '0' COMMENT '工会职位', - `guild_name` varchar(255) NOT NULL DEFAULT '' COMMENT '工会名称', - `parachute` int(11) NOT NULL DEFAULT '0' COMMENT '降落伞ID', - `ring_id` int(11) NOT NULL DEFAULT '0' COMMENT '戒指id', - `star_num` int(11) NOT NULL DEFAULT '0' COMMENT '星星数(成长任务)', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id` (`account_id`), - UNIQUE KEY `address` (`address`), - KEY `channel` (`channel`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_bigdata` --- - -DROP TABLE IF EXISTS `t_bigdata`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_bigdata` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', - `type` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'type', - `data` mediumblob COMMENT 'data', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id_type` (`account_id`, `type`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; --- - -DROP TABLE IF EXISTS `t_user_wallet_offline`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_user_wallet_offline` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `gold` bigint NOT NULL DEFAULT '0' COMMENT '金币', - `diamond` bigint 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_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_user_wallet_record` --- - -DROP TABLE IF EXISTS `t_user_wallet_record`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_user_wallet_record` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `txhash` varchar(100) NOT NULL DEFAULT '' COMMENT 'txhash', - `dir` int(11) NOT NULL DEFAULT '0' COMMENT 'dir', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type', - `value` varchar(100) NOT NULL DEFAULT '' COMMENT 'value', - `state` int(11) NOT NULL DEFAULT '0' COMMENT 'state', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `txhash` (`txhash`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_hero` --- - -DROP TABLE IF EXISTS `t_hero`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_hero` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `token_id` varchar(60) COMMENT 'token_id', - `account_id` varchar(60) COMMENT 'account_id', - `hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id', - `hero_tili` varchar(25) NOT NULL DEFAULT '0' COMMENT '英雄体力', - `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 '英雄等级', - `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 '躲避技能等级', - `try_count` int(11) NOT NULL DEFAULT '0' COMMENT '剩余体验次数 当state=1时才有意义', - `advanced_count` int(11) NOT NULL DEFAULT '0' COMMENT '进阶次数', - `lock_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:无锁 1:升级 2:升阶 3:悬赏', - `unlock_time` int(11) NOT NULL DEFAULT '0' COMMENT '解锁时间', - `unlock_trade_time` int(11) NOT NULL DEFAULT '0' COMMENT '出售解锁时间', - `rand_attr` mediumblob COMMENT '随机属性', - `today_get_gold` bigint NOT NULL DEFAULT '0' COMMENT '金币', - `last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间', - `today_pve_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT 'pve金币', - `last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间', - `today_mission_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT '悬赏任务获得金币', - `last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id', - `active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count', - `activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活', - `base_attr` mediumblob COMMENT '初始随机属性(英雄重置时需要)', - PRIMARY KEY (`idx`), - UNIQUE KEY `token_id` (`token_id`), - 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_hero_skin` --- - -DROP TABLE IF EXISTS `t_hero_skin`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_hero_skin` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', - `skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤id', - `hero_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 '消耗货币的具体数量', - `try_expire_at` 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_id_skinid` (`account_id`, `skin_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_bag` --- - -DROP TABLE IF EXISTS `t_bag`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_bag` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `token_id` varchar(60) COMMENT 'token_id', - `account_id` varchar(60) COMMENT 'account_id', - `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `item_num` int(11) NOT NULL DEFAULT '0' COMMENT '数量', - `rand_attr` mediumblob COMMENT '随机属性', - `today_get_gold` bigint NOT NULL DEFAULT '0' COMMENT '金币', - `last_get_gold_time` 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 `token_id` (`token_id`), - KEY `item_id` (`item_id`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_bag` --- - --- --- 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', - `token_id` varchar(60) COMMENT 'token_id', - `account_id` varchar(60) COMMENT 'account_id', - `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `item_num` int(11) NOT NULL DEFAULT '1' COMMENT '数量', - `chip_grade` int(11) NOT NULL DEFAULT '1' COMMENT '芯片等级', - `chip_type` int(11) NOT NULL DEFAULT '1' COMMENT '1 攻击;2 防御;3 辅助', - `state` int(11) NOT NULL DEFAULT '0' COMMENT '0:已购买 1:免费(GIFT标签)', - `inlay_state` varchar(60) COMMENT '所镶嵌的芯片页id:1|2|3', - `rand_attr` mediumblob COMMENT '随机属性', - `active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id', - `active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count', - `activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `token_id` (`token_id`), - KEY `item_id` (`item_id`), - KEY `account_id` (`account_id`) -) 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', - `token_id` varchar(60) COMMENT 'token_id', - `account_id` varchar(60) 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:升阶 3:悬赏', - `unlock_time` int(11) NOT NULL DEFAULT '0' COMMENT '解锁时间', - `unlock_trade_time` int(11) NOT NULL DEFAULT '0' COMMENT '出售解锁时间', - `durability` varchar(25) NOT NULL DEFAULT '0' COMMENT '耐久', - `rand_attr` mediumblob COMMENT '随机属性', - `today_get_gold` bigint NOT NULL DEFAULT '0' COMMENT '金币', - `last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间', - `today_pve_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT 'pve金币', - `last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间', - `today_mission_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT '悬赏任务获得金币', - `last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id', - `active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count', - `activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活', - PRIMARY KEY (`idx`), - UNIQUE KEY `token_id` (`token_id`), - 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` --- - -DROP TABLE IF EXISTS `t_gun_skin`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_gun_skin` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', - `skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '皮肤ID', - `skin_state` int(11) NOT NULL DEFAULT '0' COMMENT '状态(0=已经购,1 = 试用状态)', - `try_expire_at` 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_id_skin_id` (`account_id`, `skin_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_talent` --- - -DROP TABLE IF EXISTS `t_gun_talent`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_gun_talent` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', - `talent_id` int(11) NOT NULL DEFAULT '0' COMMENT '技能ID', - `talent_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 `account_id_talent_id` (`account_id`, `talent_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_dyndata` --- - -DROP TABLE IF EXISTS `t_dyndata`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_dyndata` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `x` int(11) NOT NULL DEFAULT '0' COMMENT 'x', - `y` int(11) NOT NULL DEFAULT '0' COMMENT 'y', - `val` bigint NOT NULL DEFAULT '0' COMMENT 'val', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id_x_y` (`account_id`, `x`, `y`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_shop_buy_record` --- - -DROP TABLE IF EXISTS `t_shop_buy_record`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_shop_buy_record` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `this_day_buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '今日购买次数', - `this_week_buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '本周购买次数', - `total_buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '总购买次数', - `last_buy_time` 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`), - KEY `account_id` (`account_id`), - UNIQUE KEY `account_id_item_id` (`account_id`, `item_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_mission` --- - -DROP TABLE IF EXISTS `t_mission`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_mission` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `mission_id` 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`), - KEY `account_id` (`account_id`), - UNIQUE KEY `account_id_mission_id` (`account_id`, `mission_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_battle` --- - -DROP TABLE IF EXISTS `t_battle`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_battle` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `battle_data` mediumblob COMMENT 'battle_data', - `kills_modifytime` 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_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_battle_record` --- - -DROP TABLE IF EXISTS `t_battle_record`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_battle_record` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `request` mediumblob COMMENT 'request', - `kills_modifytime` 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`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_season` --- - -DROP TABLE IF EXISTS `t_season`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_season` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `season_id` int(11) NOT NULL DEFAULT '0' COMMENT '赛季id', - `card_lv` int(11) NOT NULL DEFAULT '0' COMMENT '赛季手册等级', - `card_exp` int(11) NOT NULL DEFAULT '0' COMMENT '赛季手册经验', - `rank` int(11) NOT NULL DEFAULT '0' COMMENT '段位', - `score` int(11) NOT NULL DEFAULT '0' COMMENT '积分', - `elo` int(11) NOT NULL DEFAULT '0' COMMENT '隐藏ELO积分', - `history_best_rank` int(11) NOT NULL DEFAULT '0' COMMENT '历史最高段位', - `gift_state1` int(11) NOT NULL DEFAULT '0' COMMENT '普通礼包购买状态 0:未购 1:已购', - `gift_buytime1` int(11) NOT NULL DEFAULT '0' COMMENT '普通礼包购买时间', - `gift_state2` int(11) NOT NULL DEFAULT '0' COMMENT '豪华礼包购买状态 0:未购 1:已购', - `gift_buytime2` int(11) NOT NULL DEFAULT '0' COMMENT '豪华礼包购买时间', - `battle_data` mediumblob COMMENT 'battle_data', - `kills_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '击杀修改时间', - `score_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '积分修改时间', - `best_rank_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT 'bestrank修改时间', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `account_id` (`account_id`), - UNIQUE KEY `account_id_season_id` (`account_id`, `season_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_season_card` --- - -DROP TABLE IF EXISTS `t_season_card`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_season_card` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `season_id` int(11) NOT NULL DEFAULT '0' COMMENT '赛季id', - `type` int(11) NOT NULL DEFAULT '0' COMMENT '手册类型 1:普通 2:精英', - `card_lv` int(11) NOT NULL DEFAULT '0' COMMENT '赛季手册等级', - `reward_received` 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`), - KEY `account_id_season_id` (`account_id`, `season_id`), - UNIQUE KEY `account_id_season_id_type_card_lv` (`account_id`, `season_id`, `type`, `card_lv`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_used_name` --- - -DROP TABLE IF EXISTS `t_used_name`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_used_name` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `name` tinyblob COMMENT '名字', - `name_base64` varchar(255) NOT NULL DEFAULT '' COMMENT '名字base64', - `key` varchar(60) NOT NULL DEFAULT '' COMMENT '应用key', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `name_base64_key` (`name_base64`, `key`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_drop_log` --- - -DROP TABLE IF EXISTS `t_drop_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_drop_log` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `drop_source` varchar(60) NOT NULL DEFAULT '' COMMENT '掉落源', - `drop_id` varchar(60) NOT NULL DEFAULT '' COMMENT '掉落id', - `drop_items` mediumblob COMMENT '掉落的物品', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `account_id_drop_source_drop_id` (`account_id`, `drop_source`, `drop_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_rank_activity` --- - -DROP TABLE IF EXISTS `t_rank_activity`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_rank_activity` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', - `guild_id` varchar(60) NOT NULL DEFAULT '' COMMENT '工会id', - `wave` int(11) NOT NULL DEFAULT '0' COMMENT 'wave', - `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type', - `value` double NOT NULL DEFAULT '0' COMMENT 'value', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id_wave_type` (`account_id`, `wave`, `type`), - KEY `channel` (`channel`), - KEY `type` (`type`), - KEY `guild_id` (`guild_id`), - KEY `value` (`value`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_game_log` --- - -DROP TABLE IF EXISTS `t_game_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_game_log` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `type` varchar(255) NOT NULL DEFAULT '' COMMENT '日志类型', - `subtype` varchar(255) NOT NULL DEFAULT '' COMMENT '日志子类型', - `param1` varchar(666) NOT NULL DEFAULT '' COMMENT 'param1', - `param2` varchar(666) NOT NULL DEFAULT '' COMMENT 'param2', - `param3` varchar(666) NOT NULL DEFAULT '' COMMENT 'param3', - `param4` varchar(666) NOT NULL DEFAULT '' COMMENT 'param4', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `account_id_type_subtype` (`account_id`, `type`, `subtype`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- Dump completed on 2015-08-19 18:51:22 - --- --- Table structure for table `t_nft_active` --- - -DROP TABLE IF EXISTS `t_nft_active`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_nft_active` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `uniid` varchar(255) NOT NULL DEFAULT '' COMMENT 'nft uniid', - `token_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'token id', - `daytime` int(11) NOT NULL DEFAULT '0' COMMENT '今天0点时间', - `token_type` int(11) NOT NULL DEFAULT '0' COMMENT 'nft类型 1:英雄 2:枪支 3:芯片 5:碎片箱子', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `uniid_daytime_type` (`uniid`, `daytime`,`token_type`), - KEY `account_id_token_type` (`account_id`,`token_type`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_fragment_pool` --- - -DROP TABLE IF EXISTS `t_fragment_pool`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_fragment_pool` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `fragment_id` int(11) NOT NULL DEFAULT '0' COMMENT '碎片id', - `type` int(11) NOT NULL DEFAULT '0' COMMENT '0:pvp 1:pve', - `fragment_type` int(11) NOT NULL DEFAULT '0' COMMENT '碎片类型 0:英雄 1:武器', - `fragment_num` int(11) NOT NULL DEFAULT '0' COMMENT '剩余碎片数量', - `alloced_num` int(11) NOT NULL DEFAULT '0' COMMENT '已经分配的碎片数量', - `alloc_num` int(11) NOT NULL DEFAULT '0' COMMENT '分配的碎片数量', - `alloc_time` 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`), - KEY `alloc_time_type_fragment_type` (`alloc_time`, `type`, `fragment_type`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_fragment_record` --- - -DROP TABLE IF EXISTS `t_fragment_record`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_fragment_record` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `param` int(11) NOT NULL DEFAULT '0' COMMENT 'param', - `value` 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`), - KEY `account_param` (`account_id`, `param`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_realtime_data` --- - -DROP TABLE IF EXISTS `t_realtime_data`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_realtime_data` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `name` varchar(60) NOT NULL DEFAULT '' COMMENT '参数名', - `value1` varchar(60) NOT NULL DEFAULT '' COMMENT '值1', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_battle_settlement_single` --- - -DROP TABLE IF EXISTS `t_battle_settlement_single`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_battle_settlement_single` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `battle_uuid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', - `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', - `room_uuid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'room_uuid', - `data` mediumblob COMMENT 'data', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id_battle_uniid` (`account_id`, `battle_uuid`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_battle_settlement_team` --- - -DROP TABLE IF EXISTS `t_battle_settlement_team`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_battle_settlement_team` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `battle_uuid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', - `room_uuid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'room_id', - `data` mediumblob COMMENT 'data', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `battle_room_uuid` (`battle_uuid`, `room_uuid`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_battle_settlement_team` --- - -DROP TABLE IF EXISTS `t_battle_input`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_battle_input` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `battle_uuid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', - `room_uuid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'room_id', - `input` mediumblob COMMENT 'input', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `battle_room_uuid` (`battle_uuid`, `room_uuid`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_battle_history` --- - -DROP TABLE IF EXISTS `t_battle_history`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_battle_history` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `battle_uniid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '用户 account_id', - `match_mode` int(11) NOT NULL DEFAULT '0' COMMENT '0: 匹配 pvp 1: 排位赛 2: pve', - `team_mode` int(11) NOT NULL DEFAULT '0' COMMENT '队伍模式 0:单人 1:组队', - `battle_rank` int(11) NOT NULL DEFAULT '0' COMMENT '战斗排名', - `team_rank` int(11) NOT NULL DEFAULT '0' COMMENT '团队排名', - `team_kills` int(11) NOT NULL DEFAULT '0' COMMENT '团队击杀数', - `gold` int(11) NOT NULL DEFAULT '0' COMMENT 'gold获得数', - `is_win` int(11) NOT NULL DEFAULT '0' COMMENT 'pve冒险是否胜利', - `kills` int(11) NOT NULL DEFAULT '0' COMMENT '击杀数', - `hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄 id', - `weapon1` int(11) NOT NULL DEFAULT '0' COMMENT '枪械1 id', - `weapon2` int(11) NOT NULL DEFAULT '0' COMMENT '枪械2 id', - `damage` int(11) NOT NULL DEFAULT '0' COMMENT '伤害', - `battle_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '战斗结束时间', - `current_level_class` varchar(60) NOT NULL DEFAULT '0' COMMENT '当前用户段位', - `current_level_class_score` int(11) NOT NULL DEFAULT '0' COMMENT '当前用户排位分', - `level_class_score_chg` int(11) NOT NULL DEFAULT '0' COMMENT '排位分改变', - `pve_rank_score` int(11) NOT NULL DEFAULT '0' COMMENT 'pve冒险积分', - `pve_kill_boss` int(11) NOT NULL DEFAULT '0' COMMENT 'pve冒险是否击杀BOSS', - `pve_instance_id` int(11) NOT NULL DEFAULT '0' COMMENT 'pve副本难度id', - `pve_instance_mode` int(11) NOT NULL DEFAULT '0' COMMENT 'pve副本mode', - `battle_foreign_key` int(11) NOT NULL DEFAULT '0' COMMENT '结算外键', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id_battle_uniid` (`account_id`, `battle_uniid`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_guide_data` --- - -DROP TABLE IF EXISTS `t_guide_data`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_guide_data` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `data` varchar(255) NOT NULL DEFAULT '' COMMENT '值1', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- Dump completed on 2015-08-19 18:51:22 - --- --- Table structure for table `t_user_season_ring` --- - -DROP TABLE IF EXISTS `t_user_season_ring`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_user_season_ring` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `item_id` 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`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_season_ranking` --- - -DROP TABLE IF EXISTS `t_season_ranking`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_season_ranking` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `address` varchar(60) COMMENT 'address', - `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', - `rank` int(11) NOT NULL DEFAULT '0' COMMENT '段位', - `score` int(11) NOT NULL DEFAULT '0' COMMENT '积分', - `ranking` int(11) NOT NULL DEFAULT '0' COMMENT '排名', - `ranking_point` bigint NOT NULL DEFAULT '0' COMMENT '排名SV积分', - `season` 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_id_season` (`account_id`, `season`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_parachute` --- - -DROP TABLE IF EXISTS `t_parachute`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_parachute` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `item_id` 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`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_transaction` --- - -DROP TABLE IF EXISTS `t_transaction`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_transaction` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `address` varchar(60) NOT NULL DEFAULT '' COMMENT 'address', - `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', - `action` int(11) NOT NULL DEFAULT '0' COMMENT 'action', - `token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id', - `token_type` int(11) NOT NULL DEFAULT '0' COMMENT 'token_type', - `item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid', - `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `item_num` bigint NOT NULL DEFAULT '0' COMMENT '道具num', - `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', - `result` int(11) NOT NULL DEFAULT '0' COMMENT 'result 0:失败 1:成功', - `client_confirmed` int(11) NOT NULL DEFAULT '0' COMMENT 'client_confirmed', - `client_result` mediumblob COMMENT 'client_result', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `trans_id` (`trans_id`), - KEY `account_id` (`account_id`), - KEY `address` (`address`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_transaction_prefee` --- - -DROP TABLE IF EXISTS `t_transaction_prefee`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_transaction_prefee` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', - `target_token_id` bigint NOT NULL DEFAULT '0' COMMENT 'target_token_id', - `target_token_type` bigint NOT NULL DEFAULT '0' COMMENT 'target_token_type', - `item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid', - `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `item_num` double NOT NULL DEFAULT '0' COMMENT '道具数量', - `done` int(11) NOT NULL DEFAULT '0' COMMENT 'done', - `state` int(11) NOT NULL DEFAULT '0' COMMENT 'state', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `trans_id` (`trans_id`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_nft_up_event` --- - -DROP TABLE IF EXISTS `t_nft_up_event`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_nft_up_event` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', - `token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id', - `value` int(11) NOT NULL DEFAULT '0' COMMENT 'value', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `trans_id` (`trans_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - -DROP TABLE IF EXISTS `t_nft_up_receive`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_nft_up_receive` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', - `token_id1` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id1', - `token_id2` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id2', - `state` int(11) NOT NULL DEFAULT '0' COMMENT '0进阶中,1可领取', - `token_type` int(11) NOT NULL DEFAULT '0' COMMENT '1英雄,2枪械', - `from_data` int(11) NOT NULL DEFAULT '0' COMMENT '0本地,1链', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `trans_id` (`trans_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_event_ranking` --- - -DROP TABLE IF EXISTS `t_event_ranking`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_event_ranking` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `wave` int(11) NOT NULL DEFAULT '0' COMMENT 'wave', - `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type', - `value` double NOT NULL DEFAULT '0' COMMENT 'value', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id_wave_type` (`account_id`, `wave`, `type`), - KEY `value` (`value`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_user_currency` --- - -DROP TABLE IF EXISTS `t_user_currency`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_user_currency` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `net_id` int(11) NOT NULL DEFAULT '0' COMMENT '链id', - `address` varchar(60) NOT NULL DEFAULT '' COMMENT '货币地址', - `symbol` varchar(10) NOT NULL DEFAULT '' COMMENT '符号', - `precision` int(11) NOT NULL DEFAULT '0' COMMENT '精度', - `type` int(11) NOT NULL DEFAULT '0' COMMENT '类型 1:ERC721 2:ERC1155 3:ERC20', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_net_address` (`account_id`, `net_id`, `address`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_emoji` --- - -DROP TABLE IF EXISTS `t_emoji`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_emoji` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `item_id` int(11) NOT NULL DEFAULT '0' COMMENT 'itemID', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_item_id` (`account_id`, `item_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_user_use_emoji` --- - -DROP TABLE IF EXISTS `t_user_use_emoji`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_user_use_emoji` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `value` varchar(255) NOT NULL DEFAULT '' COMMENT '选中表情itemID', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_chip_page` --- - -DROP TABLE IF EXISTS `t_chip_page`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_chip_page` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `page_name` varchar(50) NOT NULL DEFAULT '' COMMENT '页名', - `page_id` int(11) NOT NULL DEFAULT '0' COMMENT '页id', - `data` mediumblob COMMENT 'data', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_page_id` (`account_id`, `page_id`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_hero_preset` --- - -DROP TABLE IF EXISTS `t_hero_preset`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_hero_preset` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `hero_uid` bigint NOT NULL DEFAULT 0 COMMENT 'hero uniid', - `skill_id` int(11) NOT NULL DEFAULT 0 COMMENT '技能 item_id', - `weapon_uid1` bigint NOT NULL DEFAULT 0 COMMENT 'gun uniid1', - `weapon_uid2` bigint NOT NULL DEFAULT 0 COMMENT 'gun uniid2', - `chip_page` 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`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_rank_battle` --- - -DROP TABLE IF EXISTS `t_rank_battle`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_rank_battle` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', - `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type 1:场次榜 2:吃鸡榜 3:mvp榜 4:前三名榜 5:击杀榜', - `value` bigint NOT NULL DEFAULT '0' COMMENT 'value', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id_type` (`account_id`, `type`), - KEY `channel` (`channel`), - KEY `type` (`type`), - KEY `value` (`value`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_mission_star` --- - -DROP TABLE IF EXISTS `t_mission_star`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_mission_star` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `season_id` int(11) NOT NULL DEFAULT '0' COMMENT '成长任务赛季id', - `mission_id` 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_season_mission_id` (`account_id`, `season_id`, `mission_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_user_sign_log` --- - -DROP TABLE IF EXISTS `t_user_sign_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_user_sign_log` ( - `idx` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `days` int(10) DEFAULT '0' COMMENT '累计签到天数', - `sign_time` int(10) DEFAULT NULL COMMENT '签到时间', - `is_receive` tinyint(4) DEFAULT '0' COMMENT '是否领取奖励', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_first_topup` --- - -DROP TABLE IF EXISTS `t_first_topup`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_first_topup` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT, - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `address` varchar(60) COMMENT 'address', - `status1` int(11) NOT NULL DEFAULT '0' COMMENT '领取状态1 0 不能领取 1 可领取状态 2 已领取', - `status2` int(11) NOT NULL DEFAULT '0' COMMENT '领取状态2', - `status3` int(11) NOT NULL DEFAULT '0' COMMENT '领取状态3', - `createtime` int(11) NOT NULL COMMENT '首充时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_shop_buy_order` --- - -DROP TABLE IF EXISTS `t_shop_buy_order`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_shop_buy_order` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单id', - `order_id` varchar(64) DEFAULT NULL COMMENT '订单id', - `address` varchar(60) NOT NULL COMMENT '账户地址', - `createtime` int(11) NOT NULL COMMENT '订单开始时间', - `id` int(11) NOT NULL COMMENT '商店货物id', - `item_id` int(11) NOT NULL COMMENT '道具id', - `goods_num` bigint(20) NOT NULL COMMENT '购买个数', - `status` int(11) NOT NULL COMMENT '订单状态 0-客户端申请了订单 1-订单完成 2-订单失败', - PRIMARY KEY (`idx`), - UNIQUE KEY `order_id` (`order_id`) -) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_user_pass` --- - -DROP TABLE IF EXISTS `t_user_pass`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_user_pass` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL COMMENT '账户id', - `season_id` int(11) NOT NULL DEFAULT '0' COMMENT '通行证赛季', - `data` mediumblob COMMENT 'data', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_season_id` (`account_id`, `season_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_bc_order` --- - -DROP TABLE IF EXISTS `t_bc_order`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_bc_order` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `order_id` varchar(255) COMMENT '订单号', - `order_type` int(11) NOT NULL COMMENT '0:默认', - `account_id` varchar(60) NOT NULL COMMENT '账户id 只用做事后分析用', - `address` varchar(60) COMMENT 'address', - `currency_name` varchar(60) NOT NULL DEFAULT '' COMMENT 'currency_name', - `status` int(11) NOT NULL DEFAULT '0' COMMENT '0: 支付中 1: 已发货', - `item_id` int(11) NOT NULL COMMENT '道具id', - `item_num` bigint NOT NULL DEFAULT '0' COMMENT '道具数量', - `ext_data` mediumblob COMMENT '扩展数据自定义', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `price` varchar(60) COLLATE utf8_bin NOT NULL COMMENT '价格', - PRIMARY KEY (`idx`), - UNIQUE KEY `order_id` (`order_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_shop_dailyselection` --- - -DROP TABLE IF EXISTS `t_shop_dailyselection`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_shop_dailyselection` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `address` varchar(60) NOT NULL COMMENT 'address', - `refresh_mode` int(11) NOT NULL COMMENT '0-每日自动刷新时间 1-手动刷新时间', - `refresh_time` int(11) NOT NULL DEFAULT '0' COMMENT '刷新时间', - `grid_1` int(11) NOT NULL, - `grid_2` int(11) NOT NULL, - `grid_3` int(11) NOT NULL, - `grid_4` int(11) NOT NULL, - `grid_5` int(11) NOT NULL, - `grid_6` int(11) NOT NULL, - `count_1` tinyint(4) NOT NULL, - `count_2` tinyint(4) NOT NULL, - `count_3` tinyint(4) NOT NULL, - `count_4` tinyint(4) NOT NULL, - `count_5` tinyint(4) NOT NULL, - `count_6` tinyint(4) NOT NULL, - PRIMARY KEY (`idx`), - KEY `refresh_time` (`refresh_time`), - KEY `address` (`address`), - KEY `refresh_mode` (`refresh_mode`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - -DROP TABLE IF EXISTS `t_shop_free_record`; -CREATE TABLE `t_shop_free_record` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL COMMENT '账号id', - `shop_id` int(11) NOT NULL COMMENT '商店id', - `id` int(11) NOT NULL COMMENT '货架id', - `goods_id` int(11) NOT NULL COMMENT '道具id', - `goods_num` int(11) NOT NULL COMMENT '道具数量', - `free_type` int(11) NOT NULL COMMENT '免费类型', - `free_num` int(11) NOT NULL COMMENT '免费数量', - `createtime` int(11) NOT NULL COMMENT '创建时间', - PRIMARY KEY (`idx`), - KEY `account_id` (`account_id`), - KEY `createtime` (`createtime`), - KEY `id` (`id`), - KEY `goods_id` (`goods_id`) -) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=utf8; - - --- --- Table structure for table `t_user_honor` --- - -DROP TABLE IF EXISTS `t_user_honor`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_user_honor` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `address` varchar(60) NOT NULL COMMENT '钱包地址', - `honor1` int(11) NOT NULL DEFAULT '0' COMMENT 'nft类型6 1:佩戴', - `honor2` int(11) NOT NULL DEFAULT '0' COMMENT 'honor2', - `honor3` int(11) NOT NULL DEFAULT '0' COMMENT 'honor3', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `address` (`address`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_orderid` --- - -DROP TABLE IF EXISTS `t_orderid`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_orderid` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `request` mediumblob COMMENT 'request', - `confirmed` 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`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_inapp_record` --- - -DROP TABLE IF EXISTS `t_inapp_record`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_inapp_record` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `amount` double NOT NULL DEFAULT '0' COMMENT '充值总额', - `buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值次数', - `amount_ok` double NOT NULL DEFAULT '0' COMMENT '充值成功总额', - `buy_ok_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值成功次数', - `daytime` 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`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_inapp_order` --- - -DROP TABLE IF EXISTS `t_inapp_order`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_inapp_order` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id', - `sp_order_id` varchar(64) DEFAULT NULL COMMENT 'app store order_id', - `platform` int(11) NOT NULL DEFAULT '0' COMMENT '0: ios 1: android', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '申请账号id', - `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id', - `price` double NOT NULL DEFAULT '0' COMMENT '价格', - `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `order_id` (`order_id`), - UNIQUE KEY `platform_sp_order_id` (`platform`, `sp_order_id`), - KEY `account_id` (`account_id`), - KEY `sp_order_id` (`sp_order_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_outapp_order` --- - -DROP TABLE IF EXISTS `t_outapp_order`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_outapp_order` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id', - `sp_order_id` varchar(64) DEFAULT NULL COMMENT 'app store order_id', - `platform` int(11) NOT NULL DEFAULT '0' COMMENT '0: ios 1: android', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '申请账号id', - `address` varchar(60) DEFAULT NULL COMMENT '申请时账号绑定的钱包', - `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id', - `price` double NOT NULL DEFAULT '0' COMMENT '价格', - `params` mediumblob COMMENT 'params', - `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `order_id` (`order_id`), - UNIQUE KEY `platform_sp_order_id` (`platform`, `sp_order_id`), - KEY `account_id` (`account_id`), - KEY `address` (`address`), - KEY `sp_order_id` (`sp_order_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_mall` --- - -DROP TABLE IF EXISTS `t_mall`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_mall` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id', - `goods_uuid` varchar(255) NOT NULL DEFAULT '' COMMENT '商品uuid', - `seller` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller', - `seller_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller_address', - `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id', - `item_num` bigint NOT NULL DEFAULT '0' COMMENT '物品数量', - `currency` varchar(60) NOT NULL COMMENT 'currency', - `price` varchar(255) NOT NULL DEFAULT '' COMMENT 'price', - `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', - `last_buy_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次购买时间', - `last_buyer` varchar(60) NOT NULL DEFAULT '' COMMENT '最后一次购买者', - `last_modify_price_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次修改价格事件', - `buyer` varchar(60) NOT NULL DEFAULT '' COMMENT '购买成功者', - `buy_ok_time` 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`), - KEY `seller` (`seller`), - KEY `seller_address` (`seller_address`), - KEY `price` (`price`), - UNIQUE KEY `order_id` (`order_id`), - UNIQUE KEY `goods_uuid` (`goods_uuid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_market` --- - -DROP TABLE IF EXISTS `t_market`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_market` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `net_id` bigint NOT NULL DEFAULT '0' COMMENT 'net_id', - `order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id', - `token_id` varchar(60) NOT NULL COMMENT 'token_id', - `seller` varchar(60) NOT NULL COMMENT 'owner', - `buyer` varchar(60) NOT NULL COMMENT 'owner', - `nft_token` varchar(60) NOT NULL COMMENT 'nft_token', - `amount` varchar(255) NOT NULL DEFAULT '' COMMENT 'amount', - `currency` varchar(60) NOT NULL COMMENT 'currency', - `price` varchar(255) NOT NULL DEFAULT '' COMMENT 'price', - `update_price` varchar(255) COMMENT 'update_price', - `update_time` int(11) COMMENT 'update_time', - `c_name` varchar(32) NOT NULL DEFAULT '' COMMENT '缓存-名称', - `c_job` int(11) NOT NULL DEFAULT '0' COMMENT '缓存-职业', - `c_type` int(11) NOT NULL DEFAULT '0' COMMENT '缓存-碎片类型', - `c_lv` int(11) NOT NULL DEFAULT '0' COMMENT '缓存-级别', - `c_quality` int(11) NOT NULL DEFAULT '0' COMMENT '缓存-品阶', - `c_durability` float NOT NULL DEFAULT '0' COMMENT '缓存-能量', - `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', - `activated` int(11) NOT NULL DEFAULT '0' COMMENT 'activated', - `selltime` int(11) COMMENT 'selltime', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `order_id` (`order_id`), - KEY `seller_activated` (`seller`, `activated`), - KEY `activated` (`activated`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - -DROP TABLE IF EXISTS `t_web2_order`; -CREATE TABLE `t_web2_order` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `status` int(11) NOT NULL COMMENT '订单状态 0-客户端申请了订单 1-订单完成 2-订单失败', - `order_id` varchar(64) DEFAULT NULL COMMENT '订单id', - `createtime` datetime NOT NULL COMMENT '创建时间', - `account_id` varchar(64) NOT NULL COMMENT '申请账号id', - `address` varchar(64) DEFAULT NULL COMMENT '申请时账号绑定的钱包', - `item_id` int(11) NOT NULL COMMENT '物品id', - `item_num` bigint(20) NOT NULL COMMENT '物品数量', - `id` int(11) NOT NULL COMMENT '商店中的配置id,', - `goods_num` bigint(20) NOT NULL COMMENT '购买商品个数', - `price` varchar(64) DEFAULT NULL COMMENT '价格', - `ext_data` mediumblob COMMENT '扩展自定义数据', - `channel` varchar(64) DEFAULT NULL COMMENT 'google or apple', - `out_order_id` varchar(64) DEFAULT NULL COMMENT 'app store order_id', - PRIMARY KEY (`idx`), - UNIQUE KEY `order_id` (`order_id`), - KEY `out_order_id` (`out_order_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8; - -DROP TABLE IF EXISTS `t_market_store`; -CREATE TABLE `t_market_store` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `order_id` varchar(64) DEFAULT NULL COMMENT '订单id', - `o_link` varchar(64) DEFAULT NULL COMMENT '关联的链上上架单号', - `status` int(11) NOT NULL COMMENT '订单状态 0:出售中 1:已下架 2:已售出 3:购买中', - `owner_address` varchar(60) NOT NULL COMMENT '当前拥有者', - `token_id` varchar(60) DEFAULT NULL COMMENT 'token_id', - `nft_token` varchar(64) DEFAULT NULL COMMENT 'nftToken', - `token_type` int(11) NOT NULL COMMENT 'nft类型 1:英雄 2:枪支 3:芯片', - `item_id` int(11) DEFAULT NULL COMMENT '特殊字段,用于标记中心化道具,用于交易金币', - `amount` bigint(20) NOT NULL DEFAULT '1' COMMENT '堆叠数量', - `createtime` int(11) NOT NULL COMMENT '创建时间(上架时间)', - `modifytime` int(11) NOT NULL COMMENT '修改时间(更新价格等)', - `buytime` int(11) DEFAULT NULL COMMENT '开始购买的时间', - `s_currency` varchar(64) DEFAULT NULL COMMENT '出售时选择的币种地址', - `s_price` varchar(64) NOT NULL COMMENT '出售价格', - `c_name` varchar(32) NOT NULL COMMENT '缓存-名称', - `c_job` int(11) NOT NULL COMMENT '缓存-职业', - `c_type` int(11) NOT NULL COMMENT '缓存-碎片类型', - `c_lv` int(11) NOT NULL COMMENT '缓存-级别', - `c_quality` int(11) NOT NULL COMMENT '缓存-品阶', - `c_durability` float NOT NULL COMMENT '缓存-能量', - `c_id` int(11) NOT NULL COMMENT '缓存-id', - PRIMARY KEY (`idx`) USING BTREE, - UNIQUE KEY `idx` (`idx`), - UNIQUE KEY `o_link` (`o_link`) USING BTREE, - UNIQUE KEY `order_id` (`order_id`) USING BTREE, - KEY `owner_address` (`owner_address`), - KEY `token_id` (`token_id`), - KEY `createtime` (`createtime`), - KEY `s_currency` (`s_currency`), - KEY `s_price` (`s_price`), - KEY `c_name` (`c_name`), - KEY `c_job` (`c_job`), - KEY `c_lv` (`c_lv`), - KEY `c_quality` (`c_quality`), - KEY `c_durability` (`c_durability`), - KEY `c_id` (`c_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10048 DEFAULT CHARSET=utf8; - -DROP TABLE IF EXISTS `t_market_transaction_record`; -CREATE TABLE `t_market_transaction_record` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT, - `createtime` int(11) NOT NULL COMMENT '交易成功时间', - `order_id` varchar(64) NOT NULL DEFAULT '0' COMMENT '订单id', - `o_link` varchar(64) NOT NULL COMMENT '合约订单id', - `seller` varchar(60) NOT NULL COMMENT '卖家', - `buyer` varchar(60) NOT NULL COMMENT '买家', - `token_id` varchar(60) NOT NULL COMMENT 'tokenid', - `item_id` int(11) DEFAULT NULL COMMENT '如果有,说明是中心化道具交易', - `amount` bigint(20) NOT NULL COMMENT '堆叠数量', - `name` varchar(64) NOT NULL COMMENT '商品名称', - `type` int(11) NOT NULL COMMENT '商品类型', - PRIMARY KEY (`idx`), - KEY `createtime` (`createtime`), - KEY `seller` (`seller`), - KEY `buyer` (`buyer`), - KEY `o_link` (`o_link`), - KEY `order_id` (`order_id`) -) ENGINE=InnoDB AUTO_INCREMENT=10002 DEFAULT CHARSET=utf8; - - - --- --- Table structure for table `t_crystal_exchange_record` --- - -DROP TABLE IF EXISTS `t_crystal_exchange_record`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_crystal_exchange_record` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT, - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `address` varchar(60) COMMENT 'address', - `period` int(11) NOT NULL DEFAULT '0' COMMENT '第几期', - `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `item_num` bigint NOT NULL DEFAULT '0' COMMENT '道具数量', - `createtime` int(11) NOT NULL COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_power_exchange_record` --- - -DROP TABLE IF EXISTS `t_power_exchange_record`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_power_exchange_record` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT, - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `address` varchar(60) COMMENT 'address', - `period` int(11) NOT NULL DEFAULT '0' COMMENT '第几期', - `item_num1` int(11) NOT NULL DEFAULT '0' COMMENT '晶体道具260001兑换算力数量', - `item_num2` int(11) NOT NULL DEFAULT '0' COMMENT '晶体道具260002兑换算力数量', - `item_num3` int(11) NOT NULL DEFAULT '0' COMMENT '晶体道具260003兑换算力数量', - `item_num4` int(11) NOT NULL DEFAULT '0' COMMENT '晶体道具260004兑换算力数量', - `total_num` double NOT NULL DEFAULT '0' COMMENT '算力总量', - `createtime` int(11) NOT NULL COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `t_computing_power_period` --- - -DROP TABLE IF EXISTS `t_computing_power_period`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_hash_rate_reward` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT, - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `address` varchar(60) COMMENT 'address', - `period` int(11) NOT NULL DEFAULT '0' COMMENT '第几期', - `power` varchar(60) COMMENT '算力', - `reward_cec` varchar(60) COMMENT 'reward cec', - `reward1` int(11) NOT NULL DEFAULT '0' COMMENT '第1周奖励', - `reward2` int(11) NOT NULL DEFAULT '0' COMMENT '第2周奖励', - `reward3` int(11) NOT NULL DEFAULT '0' COMMENT '第3周奖励', - `reward4` int(11) NOT NULL DEFAULT '0' COMMENT '第4周奖励', - `txHash1` varchar(60) NOT NULL DEFAULT '' COMMENT '地址1', - `txHash2` varchar(60) NOT NULL DEFAULT '' COMMENT '地址2', - `txHash3` varchar(60) NOT NULL DEFAULT '' COMMENT '地址3', - `txHash4` varchar(60) NOT NULL DEFAULT '' COMMENT '地址4', - - `createtime` int(11) NOT NULL COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `account_id` (`account_id`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - -CREATE TABLE `t_ranking_settlement_record` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `state` int(11) NOT NULL DEFAULT '0' COMMENT '是否重置', - `last_rank` int(11) NOT NULL DEFAULT '0' COMMENT '上赛季段位', - `current_rank` int(11) NOT NULL DEFAULT '0' COMMENT '新段位', - `last_score` int(11) NOT NULL DEFAULT '0' COMMENT '上赛季段位分', - `current_score` int(11) NOT NULL DEFAULT '0' COMMENT '新段位分', - `awards` 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=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - - -CREATE TABLE `t_staking` ( - `idx` bigint(20) NOT NULL AUTO_INCREMENT, - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', - `address` varchar(60) NOT NULL DEFAULT '' COMMENT 'address', - `order_id` varchar(60) COMMENT 'order_id', - `token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id', - `item_id` int(11) NOT NULL COMMENT 'item_id', - `token_type` int(11) NOT NULL DEFAULT '0' COMMENT 'nft类型 1:英雄 2:枪支 3:芯片 6:荣誉 7:徽章', - `net_id` bigint NOT NULL DEFAULT '0' COMMENT 'net_id', - `contract_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'contract_address', - `stacked_num` varchar(60) NOT NULL DEFAULT '' COMMENT 'stacked_num', - `start_time` bigint NOT NULL DEFAULT '0' COMMENT '质押开始时间', - `stake_time` bigint NOT NULL DEFAULT '0' COMMENT '质押结束时间', - `redeem_time` bigint NOT NULL DEFAULT '0' COMMENT '赎回时间', - `status` int(11) NOT NULL COMMENT '0:质押中 1:已解押', - `txhash` varchar(255) NOT NULL DEFAULT '' COMMENT 'txhash', - `nft_type` int(11) NOT NULL COMMENT '', - `nft_reward` double NOT NULL DEFAULT '0' COMMENT '利息', - `createtime` int(11) NOT NULL COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `unikey1` (`token_id`, `contract_address`, `net_id`, `start_time`), - UNIQUE KEY `unikey2` (`token_id`, `contract_address`, `net_id`, `order_id`), - KEY `address` (`address`) -) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8; - --- --- Table structure for table `t_mail` --- - -DROP TABLE IF EXISTS `t_mail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_mail` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `mailid` bigint NOT NULL DEFAULT '0' COMMENT '邮件id', - `confirmed` int(11) NOT NULL DEFAULT '0' COMMENT 'confirmed', - `attachments` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '附件', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - KEY `account_id_mailid` (`account_id`, `mailid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - --- --- Table structure for table `t_avatar` --- - -DROP TABLE IF EXISTS `t_avatar`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_avatar` ( - `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', - `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `token_id` varchar(60) COMMENT 'token_id', - `item_id` int(11) NOT NULL COMMENT 'item_id', - `item_type` int(11) NOT NULL COMMENT 'item类型', - `status` int(11) NOT NULL DEFAULT '0' COMMENT '装备状态', - `hero_idx` bigint DEFAULT NULL COMMENT '英雄外键id', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `hero_idx_type` (`hero_idx`, `item_type`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; \ No newline at end of file +-- MySQL dump 10.14 Distrib 5.5.41-MariaDB, for Linux (x86_64) +-- +-- Host: localhost Database: accountdb +-- ------------------------------------------------------ +-- Server version 5.5.41-MariaDB + +-- +-- Table structure for table `version` +-- + +DROP TABLE IF EXISTS `version`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `version` ( + `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `version` int(11) NOT NULL DEFAULT '0' COMMENT '版本号', + PRIMARY KEY (`idx`), + UNIQUE KEY `version` (`version`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_user` +-- + +DROP TABLE IF EXISTS `t_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_user` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', + `address` varchar(60) COMMENT 'address', + `name` tinyblob COMMENT '用户名字', + `sex` int(11) NOT NULL DEFAULT '0' COMMENT '性别', + `head_id` int(11) NOT NULL DEFAULT '0' COMMENT '头像id', + `head_frame` int(11) NOT NULL DEFAULT '0' COMMENT '头像框id', + `level` int(11) NOT NULL DEFAULT '0' COMMENT '等级', + `exp` int(11) NOT NULL DEFAULT '0' COMMENT '经验', + `rank` int(11) NOT NULL DEFAULT '0' COMMENT '段位', + `history_best_rank` int(11) NOT NULL DEFAULT '0' COMMENT '历史最高段位', + `score` int(11) NOT NULL DEFAULT '0' COMMENT '积分', + `history_best_score` int(11) NOT NULL DEFAULT '0' COMMENT '历史最高积分', + `elo` int(11) NOT NULL DEFAULT '0' COMMENT '隐藏ELO积分', + `bceg` double NOT NULL DEFAULT '0' COMMENT '中心化代币', + `gold` double NOT NULL DEFAULT '0' COMMENT '金币', + `diamond` double NOT NULL DEFAULT '0' COMMENT '钻石', + `hero_id` bigint 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', + `activated` int(11) NOT NULL DEFAULT '0' COMMENT '是否已激活', + `rename_count` int(11) NOT NULL DEFAULT '0' COMMENT '改名次数', + `activatetime` int(11) NOT NULL DEFAULT '0' COMMENT '激活时间', + `already_guide` int(11) NOT NULL DEFAULT '0' COMMENT '已引导', + `pve_instance_id` int(11) NOT NULL DEFAULT '0' COMMENT '已过pve副本id', + `like_count` int(11) NOT NULL DEFAULT '0' COMMENT '被点赞次数', + `head_list` mediumblob COMMENT '拥有的头像列表', + `head_frame_list` mediumblob COMMENT '拥有的头像框列表', + `consume_gold` bigint NOT NULL DEFAULT '0' COMMENT '消费金币数', + `score_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '积分修改时间', + `best_rank_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT 'bestrank修改时间', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + `last_login_time` int(11) NOT NULL DEFAULT '0' COMMENT '上次登录时间', + `is_gain_item` int(11) NOT NULL DEFAULT '0' COMMENT '是否获取免费item道具', + `guild_id` varchar(60) NOT NULL DEFAULT '' COMMENT '工会id', + `guild_job` int(11) NOT NULL DEFAULT '0' COMMENT '工会职位', + `guild_name` varchar(255) NOT NULL DEFAULT '' COMMENT '工会名称', + `parachute` int(11) NOT NULL DEFAULT '0' COMMENT '降落伞ID', + `ring_id` int(11) NOT NULL DEFAULT '0' COMMENT '戒指id', + `star_num` int(11) NOT NULL DEFAULT '0' COMMENT '星星数(成长任务)', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id` (`account_id`), + UNIQUE KEY `address` (`address`), + KEY `channel` (`channel`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_bigdata` +-- + +DROP TABLE IF EXISTS `t_bigdata`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_bigdata` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', + `type` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'type', + `data` mediumblob COMMENT 'data', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id_type` (`account_id`, `type`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; +-- + +DROP TABLE IF EXISTS `t_user_wallet_offline`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_user_wallet_offline` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `gold` bigint NOT NULL DEFAULT '0' COMMENT '金币', + `diamond` bigint 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_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_user_wallet_record` +-- + +DROP TABLE IF EXISTS `t_user_wallet_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_user_wallet_record` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `txhash` varchar(100) NOT NULL DEFAULT '' COMMENT 'txhash', + `dir` int(11) NOT NULL DEFAULT '0' COMMENT 'dir', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type', + `value` varchar(100) NOT NULL DEFAULT '' COMMENT 'value', + `state` int(11) NOT NULL DEFAULT '0' COMMENT 'state', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `txhash` (`txhash`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_hero` +-- + +DROP TABLE IF EXISTS `t_hero`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_hero` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `token_id` varchar(60) COMMENT 'token_id', + `account_id` varchar(60) COMMENT 'account_id', + `hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id', + `hero_tili` varchar(25) NOT NULL DEFAULT '0' COMMENT '英雄体力', + `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 '英雄等级', + `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 '躲避技能等级', + `try_count` int(11) NOT NULL DEFAULT '0' COMMENT '剩余体验次数 当state=1时才有意义', + `advanced_count` int(11) NOT NULL DEFAULT '0' COMMENT '进阶次数', + `lock_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:无锁 1:升级 2:升阶 3:悬赏', + `unlock_time` int(11) NOT NULL DEFAULT '0' COMMENT '解锁时间', + `unlock_trade_time` int(11) NOT NULL DEFAULT '0' COMMENT '出售解锁时间', + `rand_attr` mediumblob COMMENT '随机属性', + `today_get_gold` bigint NOT NULL DEFAULT '0' COMMENT '金币', + `last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间', + `today_pve_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT 'pve金币', + `last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间', + `today_mission_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT '悬赏任务获得金币', + `last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + `active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id', + `active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count', + `activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活', + `base_attr` mediumblob COMMENT '初始随机属性(英雄重置时需要)', + PRIMARY KEY (`idx`), + UNIQUE KEY `token_id` (`token_id`), + 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_hero_skin` +-- + +DROP TABLE IF EXISTS `t_hero_skin`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_hero_skin` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', + `skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤id', + `hero_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 '消耗货币的具体数量', + `try_expire_at` 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_id_skinid` (`account_id`, `skin_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_bag` +-- + +DROP TABLE IF EXISTS `t_bag`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_bag` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `token_id` varchar(60) COMMENT 'token_id', + `account_id` varchar(60) COMMENT 'account_id', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', + `item_num` int(11) NOT NULL DEFAULT '0' COMMENT '数量', + `rand_attr` mediumblob COMMENT '随机属性', + `today_get_gold` bigint NOT NULL DEFAULT '0' COMMENT '金币', + `last_get_gold_time` 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 `token_id` (`token_id`), + KEY `item_id` (`item_id`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_bag` +-- + +-- +-- 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', + `token_id` varchar(60) COMMENT 'token_id', + `account_id` varchar(60) COMMENT 'account_id', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', + `item_num` int(11) NOT NULL DEFAULT '1' COMMENT '数量', + `chip_grade` int(11) NOT NULL DEFAULT '1' COMMENT '芯片等级', + `chip_type` int(11) NOT NULL DEFAULT '1' COMMENT '1 攻击;2 防御;3 辅助', + `state` int(11) NOT NULL DEFAULT '0' COMMENT '0:已购买 1:免费(GIFT标签)', + `inlay_state` varchar(60) COMMENT '所镶嵌的芯片页id:1|2|3', + `rand_attr` mediumblob COMMENT '随机属性', + `active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id', + `active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count', + `activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `token_id` (`token_id`), + KEY `item_id` (`item_id`), + KEY `account_id` (`account_id`) +) 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', + `token_id` varchar(60) COMMENT 'token_id', + `account_id` varchar(60) 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:升阶 3:悬赏', + `unlock_time` int(11) NOT NULL DEFAULT '0' COMMENT '解锁时间', + `unlock_trade_time` int(11) NOT NULL DEFAULT '0' COMMENT '出售解锁时间', + `durability` varchar(25) NOT NULL DEFAULT '0' COMMENT '耐久', + `rand_attr` mediumblob COMMENT '随机属性', + `today_get_gold` bigint NOT NULL DEFAULT '0' COMMENT '金币', + `last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间', + `today_pve_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT 'pve金币', + `last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间', + `today_mission_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT '悬赏任务获得金币', + `last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + `active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id', + `active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count', + `activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活', + PRIMARY KEY (`idx`), + UNIQUE KEY `token_id` (`token_id`), + 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` +-- + +DROP TABLE IF EXISTS `t_gun_skin`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_gun_skin` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', + `skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '皮肤ID', + `skin_state` int(11) NOT NULL DEFAULT '0' COMMENT '状态(0=已经购,1 = 试用状态)', + `try_expire_at` 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_id_skin_id` (`account_id`, `skin_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_talent` +-- + +DROP TABLE IF EXISTS `t_gun_talent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_gun_talent` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', + `talent_id` int(11) NOT NULL DEFAULT '0' COMMENT '技能ID', + `talent_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 `account_id_talent_id` (`account_id`, `talent_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_dyndata` +-- + +DROP TABLE IF EXISTS `t_dyndata`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_dyndata` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `x` int(11) NOT NULL DEFAULT '0' COMMENT 'x', + `y` int(11) NOT NULL DEFAULT '0' COMMENT 'y', + `val` bigint NOT NULL DEFAULT '0' COMMENT 'val', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id_x_y` (`account_id`, `x`, `y`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_shop_buy_record` +-- + +DROP TABLE IF EXISTS `t_shop_buy_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_shop_buy_record` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', + `this_day_buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '今日购买次数', + `this_week_buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '本周购买次数', + `total_buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '总购买次数', + `last_buy_time` 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`), + KEY `account_id` (`account_id`), + UNIQUE KEY `account_id_item_id` (`account_id`, `item_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_mission` +-- + +DROP TABLE IF EXISTS `t_mission`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_mission` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `mission_id` 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`), + KEY `account_id` (`account_id`), + UNIQUE KEY `account_id_mission_id` (`account_id`, `mission_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_battle` +-- + +DROP TABLE IF EXISTS `t_battle`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_battle` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `battle_data` mediumblob COMMENT 'battle_data', + `kills_modifytime` 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_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_battle_record` +-- + +DROP TABLE IF EXISTS `t_battle_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_battle_record` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `request` mediumblob COMMENT 'request', + `kills_modifytime` 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`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_season` +-- + +DROP TABLE IF EXISTS `t_season`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_season` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `season_id` int(11) NOT NULL DEFAULT '0' COMMENT '赛季id', + `card_lv` int(11) NOT NULL DEFAULT '0' COMMENT '赛季手册等级', + `card_exp` int(11) NOT NULL DEFAULT '0' COMMENT '赛季手册经验', + `rank` int(11) NOT NULL DEFAULT '0' COMMENT '段位', + `score` int(11) NOT NULL DEFAULT '0' COMMENT '积分', + `elo` int(11) NOT NULL DEFAULT '0' COMMENT '隐藏ELO积分', + `history_best_rank` int(11) NOT NULL DEFAULT '0' COMMENT '历史最高段位', + `gift_state1` int(11) NOT NULL DEFAULT '0' COMMENT '普通礼包购买状态 0:未购 1:已购', + `gift_buytime1` int(11) NOT NULL DEFAULT '0' COMMENT '普通礼包购买时间', + `gift_state2` int(11) NOT NULL DEFAULT '0' COMMENT '豪华礼包购买状态 0:未购 1:已购', + `gift_buytime2` int(11) NOT NULL DEFAULT '0' COMMENT '豪华礼包购买时间', + `battle_data` mediumblob COMMENT 'battle_data', + `kills_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '击杀修改时间', + `score_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '积分修改时间', + `best_rank_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT 'bestrank修改时间', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `account_id` (`account_id`), + UNIQUE KEY `account_id_season_id` (`account_id`, `season_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_season_card` +-- + +DROP TABLE IF EXISTS `t_season_card`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_season_card` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `season_id` int(11) NOT NULL DEFAULT '0' COMMENT '赛季id', + `type` int(11) NOT NULL DEFAULT '0' COMMENT '手册类型 1:普通 2:精英', + `card_lv` int(11) NOT NULL DEFAULT '0' COMMENT '赛季手册等级', + `reward_received` 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`), + KEY `account_id_season_id` (`account_id`, `season_id`), + UNIQUE KEY `account_id_season_id_type_card_lv` (`account_id`, `season_id`, `type`, `card_lv`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_used_name` +-- + +DROP TABLE IF EXISTS `t_used_name`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_used_name` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `name` tinyblob COMMENT '名字', + `name_base64` varchar(255) NOT NULL DEFAULT '' COMMENT '名字base64', + `key` varchar(60) NOT NULL DEFAULT '' COMMENT '应用key', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `name_base64_key` (`name_base64`, `key`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_drop_log` +-- + +DROP TABLE IF EXISTS `t_drop_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_drop_log` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `drop_source` varchar(60) NOT NULL DEFAULT '' COMMENT '掉落源', + `drop_id` varchar(60) NOT NULL DEFAULT '' COMMENT '掉落id', + `drop_items` mediumblob COMMENT '掉落的物品', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `account_id_drop_source_drop_id` (`account_id`, `drop_source`, `drop_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_rank_activity` +-- + +DROP TABLE IF EXISTS `t_rank_activity`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_rank_activity` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', + `guild_id` varchar(60) NOT NULL DEFAULT '' COMMENT '工会id', + `wave` int(11) NOT NULL DEFAULT '0' COMMENT 'wave', + `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type', + `value` double NOT NULL DEFAULT '0' COMMENT 'value', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id_wave_type` (`account_id`, `wave`, `type`), + KEY `channel` (`channel`), + KEY `type` (`type`), + KEY `guild_id` (`guild_id`), + KEY `value` (`value`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_game_log` +-- + +DROP TABLE IF EXISTS `t_game_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_game_log` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `type` varchar(255) NOT NULL DEFAULT '' COMMENT '日志类型', + `subtype` varchar(255) NOT NULL DEFAULT '' COMMENT '日志子类型', + `param1` varchar(666) NOT NULL DEFAULT '' COMMENT 'param1', + `param2` varchar(666) NOT NULL DEFAULT '' COMMENT 'param2', + `param3` varchar(666) NOT NULL DEFAULT '' COMMENT 'param3', + `param4` varchar(666) NOT NULL DEFAULT '' COMMENT 'param4', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `account_id_type_subtype` (`account_id`, `type`, `subtype`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- Dump completed on 2015-08-19 18:51:22 + +-- +-- Table structure for table `t_nft_active` +-- + +DROP TABLE IF EXISTS `t_nft_active`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_nft_active` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `uniid` varchar(255) NOT NULL DEFAULT '' COMMENT 'nft uniid', + `token_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'token id', + `daytime` int(11) NOT NULL DEFAULT '0' COMMENT '今天0点时间', + `token_type` int(11) NOT NULL DEFAULT '0' COMMENT 'nft类型 1:英雄 2:枪支 3:芯片 5:碎片箱子', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `uniid_daytime_type` (`uniid`, `daytime`,`token_type`), + KEY `account_id_token_type` (`account_id`,`token_type`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_fragment_pool` +-- + +DROP TABLE IF EXISTS `t_fragment_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_fragment_pool` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `fragment_id` int(11) NOT NULL DEFAULT '0' COMMENT '碎片id', + `type` int(11) NOT NULL DEFAULT '0' COMMENT '0:pvp 1:pve', + `fragment_type` int(11) NOT NULL DEFAULT '0' COMMENT '碎片类型 0:英雄 1:武器', + `fragment_num` int(11) NOT NULL DEFAULT '0' COMMENT '剩余碎片数量', + `alloced_num` int(11) NOT NULL DEFAULT '0' COMMENT '已经分配的碎片数量', + `alloc_num` int(11) NOT NULL DEFAULT '0' COMMENT '分配的碎片数量', + `alloc_time` 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`), + KEY `alloc_time_type_fragment_type` (`alloc_time`, `type`, `fragment_type`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_fragment_record` +-- + +DROP TABLE IF EXISTS `t_fragment_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_fragment_record` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `param` int(11) NOT NULL DEFAULT '0' COMMENT 'param', + `value` 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`), + KEY `account_param` (`account_id`, `param`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_realtime_data` +-- + +DROP TABLE IF EXISTS `t_realtime_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_realtime_data` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `name` varchar(60) NOT NULL DEFAULT '' COMMENT '参数名', + `value1` varchar(60) NOT NULL DEFAULT '' COMMENT '值1', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_battle_settlement_single` +-- + +DROP TABLE IF EXISTS `t_battle_settlement_single`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_battle_settlement_single` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `battle_uuid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', + `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', + `room_uuid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'room_uuid', + `data` mediumblob COMMENT 'data', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id_battle_uniid` (`account_id`, `battle_uuid`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_battle_settlement_team` +-- + +DROP TABLE IF EXISTS `t_battle_settlement_team`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_battle_settlement_team` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `battle_uuid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', + `room_uuid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'room_id', + `data` mediumblob COMMENT 'data', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `battle_room_uuid` (`battle_uuid`, `room_uuid`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_battle_settlement_team` +-- + +DROP TABLE IF EXISTS `t_battle_input`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_battle_input` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `battle_uuid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', + `room_uuid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'room_id', + `input` mediumblob COMMENT 'input', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `battle_room_uuid` (`battle_uuid`, `room_uuid`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_battle_history` +-- + +DROP TABLE IF EXISTS `t_battle_history`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_battle_history` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `battle_uniid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '用户 account_id', + `match_mode` int(11) NOT NULL DEFAULT '0' COMMENT '0: 匹配 pvp 1: 排位赛 2: pve', + `team_mode` int(11) NOT NULL DEFAULT '0' COMMENT '队伍模式 0:单人 1:组队', + `battle_rank` int(11) NOT NULL DEFAULT '0' COMMENT '战斗排名', + `team_rank` int(11) NOT NULL DEFAULT '0' COMMENT '团队排名', + `team_kills` int(11) NOT NULL DEFAULT '0' COMMENT '团队击杀数', + `gold` int(11) NOT NULL DEFAULT '0' COMMENT 'gold获得数', + `is_win` int(11) NOT NULL DEFAULT '0' COMMENT 'pve冒险是否胜利', + `kills` int(11) NOT NULL DEFAULT '0' COMMENT '击杀数', + `hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄 id', + `weapon1` int(11) NOT NULL DEFAULT '0' COMMENT '枪械1 id', + `weapon2` int(11) NOT NULL DEFAULT '0' COMMENT '枪械2 id', + `damage` int(11) NOT NULL DEFAULT '0' COMMENT '伤害', + `battle_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '战斗结束时间', + `current_level_class` varchar(60) NOT NULL DEFAULT '0' COMMENT '当前用户段位', + `current_level_class_score` int(11) NOT NULL DEFAULT '0' COMMENT '当前用户排位分', + `level_class_score_chg` int(11) NOT NULL DEFAULT '0' COMMENT '排位分改变', + `pve_rank_score` int(11) NOT NULL DEFAULT '0' COMMENT 'pve冒险积分', + `pve_kill_boss` int(11) NOT NULL DEFAULT '0' COMMENT 'pve冒险是否击杀BOSS', + `pve_instance_id` int(11) NOT NULL DEFAULT '0' COMMENT 'pve副本难度id', + `pve_instance_mode` int(11) NOT NULL DEFAULT '0' COMMENT 'pve副本mode', + `battle_foreign_key` int(11) NOT NULL DEFAULT '0' COMMENT '结算外键', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id_battle_uniid` (`account_id`, `battle_uniid`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_guide_data` +-- + +DROP TABLE IF EXISTS `t_guide_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_guide_data` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `data` varchar(255) NOT NULL DEFAULT '' COMMENT '值1', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- Dump completed on 2015-08-19 18:51:22 + +-- +-- Table structure for table `t_user_season_ring` +-- + +DROP TABLE IF EXISTS `t_user_season_ring`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_user_season_ring` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `item_id` 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`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_season_ranking` +-- + +DROP TABLE IF EXISTS `t_season_ranking`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_season_ranking` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `address` varchar(60) COMMENT 'address', + `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', + `rank` int(11) NOT NULL DEFAULT '0' COMMENT '段位', + `score` int(11) NOT NULL DEFAULT '0' COMMENT '积分', + `ranking` int(11) NOT NULL DEFAULT '0' COMMENT '排名', + `ranking_point` bigint NOT NULL DEFAULT '0' COMMENT '排名SV积分', + `season` 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_id_season` (`account_id`, `season`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_parachute` +-- + +DROP TABLE IF EXISTS `t_parachute`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_parachute` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `item_id` 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`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_transaction` +-- + +DROP TABLE IF EXISTS `t_transaction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_transaction` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `address` varchar(60) NOT NULL DEFAULT '' COMMENT 'address', + `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', + `action` int(11) NOT NULL DEFAULT '0' COMMENT 'action', + `token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id', + `token_type` int(11) NOT NULL DEFAULT '0' COMMENT 'token_type', + `item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', + `item_num` bigint NOT NULL DEFAULT '0' COMMENT '道具num', + `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `result` int(11) NOT NULL DEFAULT '0' COMMENT 'result 0:失败 1:成功', + `client_confirmed` int(11) NOT NULL DEFAULT '0' COMMENT 'client_confirmed', + `client_result` mediumblob COMMENT 'client_result', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `trans_id` (`trans_id`), + KEY `account_id` (`account_id`), + KEY `address` (`address`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_transaction_prefee` +-- + +DROP TABLE IF EXISTS `t_transaction_prefee`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_transaction_prefee` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', + `target_token_id` bigint NOT NULL DEFAULT '0' COMMENT 'target_token_id', + `target_token_type` bigint NOT NULL DEFAULT '0' COMMENT 'target_token_type', + `item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', + `item_num` double NOT NULL DEFAULT '0' COMMENT '道具数量', + `done` int(11) NOT NULL DEFAULT '0' COMMENT 'done', + `state` int(11) NOT NULL DEFAULT '0' COMMENT 'state', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `trans_id` (`trans_id`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_nft_up_event` +-- + +DROP TABLE IF EXISTS `t_nft_up_event`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_nft_up_event` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', + `token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id', + `value` int(11) NOT NULL DEFAULT '0' COMMENT 'value', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `trans_id` (`trans_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +DROP TABLE IF EXISTS `t_nft_up_receive`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_nft_up_receive` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', + `token_id1` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id1', + `token_id2` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id2', + `state` int(11) NOT NULL DEFAULT '0' COMMENT '0进阶中,1可领取', + `token_type` int(11) NOT NULL DEFAULT '0' COMMENT '1英雄,2枪械', + `from_data` int(11) NOT NULL DEFAULT '0' COMMENT '0本地,1链', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `trans_id` (`trans_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_event_ranking` +-- + +DROP TABLE IF EXISTS `t_event_ranking`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_event_ranking` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `wave` int(11) NOT NULL DEFAULT '0' COMMENT 'wave', + `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type', + `value` double NOT NULL DEFAULT '0' COMMENT 'value', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id_wave_type` (`account_id`, `wave`, `type`), + KEY `value` (`value`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_user_currency` +-- + +DROP TABLE IF EXISTS `t_user_currency`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_user_currency` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `net_id` int(11) NOT NULL DEFAULT '0' COMMENT '链id', + `address` varchar(60) NOT NULL DEFAULT '' COMMENT '货币地址', + `symbol` varchar(10) NOT NULL DEFAULT '' COMMENT '符号', + `precision` int(11) NOT NULL DEFAULT '0' COMMENT '精度', + `type` int(11) NOT NULL DEFAULT '0' COMMENT '类型 1:ERC721 2:ERC1155 3:ERC20', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_net_address` (`account_id`, `net_id`, `address`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_emoji` +-- + +DROP TABLE IF EXISTS `t_emoji`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_emoji` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT 'itemID', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_item_id` (`account_id`, `item_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_user_use_emoji` +-- + +DROP TABLE IF EXISTS `t_user_use_emoji`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_user_use_emoji` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `value` varchar(255) NOT NULL DEFAULT '' COMMENT '选中表情itemID', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_chip_page` +-- + +DROP TABLE IF EXISTS `t_chip_page`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_chip_page` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `page_name` varchar(50) NOT NULL DEFAULT '' COMMENT '页名', + `page_id` int(11) NOT NULL DEFAULT '0' COMMENT '页id', + `data` mediumblob COMMENT 'data', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_page_id` (`account_id`, `page_id`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_hero_preset` +-- + +DROP TABLE IF EXISTS `t_hero_preset`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_hero_preset` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `hero_uid` bigint NOT NULL DEFAULT 0 COMMENT 'hero uniid', + `skill_id` int(11) NOT NULL DEFAULT 0 COMMENT '技能 item_id', + `weapon_uid1` bigint NOT NULL DEFAULT 0 COMMENT 'gun uniid1', + `weapon_uid2` bigint NOT NULL DEFAULT 0 COMMENT 'gun uniid2', + `chip_page` 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`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_rank_battle` +-- + +DROP TABLE IF EXISTS `t_rank_battle`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_rank_battle` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', + `type` int(11) NOT NULL DEFAULT '0' COMMENT 'type 1:场次榜 2:吃鸡榜 3:mvp榜 4:前三名榜 5:击杀榜', + `value` bigint NOT NULL DEFAULT '0' COMMENT 'value', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id_type` (`account_id`, `type`), + KEY `channel` (`channel`), + KEY `type` (`type`), + KEY `value` (`value`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_mission_star` +-- + +DROP TABLE IF EXISTS `t_mission_star`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_mission_star` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `season_id` int(11) NOT NULL DEFAULT '0' COMMENT '成长任务赛季id', + `mission_id` 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_season_mission_id` (`account_id`, `season_id`, `mission_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_user_sign_log` +-- + +DROP TABLE IF EXISTS `t_user_sign_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_user_sign_log` ( + `idx` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `days` int(10) DEFAULT '0' COMMENT '累计签到天数', + `sign_time` int(10) DEFAULT NULL COMMENT '签到时间', + `is_receive` tinyint(4) DEFAULT '0' COMMENT '是否领取奖励', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_first_topup` +-- + +DROP TABLE IF EXISTS `t_first_topup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_first_topup` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT, + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `address` varchar(60) COMMENT 'address', + `status1` int(11) NOT NULL DEFAULT '0' COMMENT '领取状态1 0 不能领取 1 可领取状态 2 已领取', + `status2` int(11) NOT NULL DEFAULT '0' COMMENT '领取状态2', + `status3` int(11) NOT NULL DEFAULT '0' COMMENT '领取状态3', + `createtime` int(11) NOT NULL COMMENT '首充时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_shop_buy_order` +-- + +DROP TABLE IF EXISTS `t_shop_buy_order`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_shop_buy_order` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单id', + `order_id` varchar(64) DEFAULT NULL COMMENT '订单id', + `address` varchar(60) NOT NULL COMMENT '账户地址', + `createtime` int(11) NOT NULL COMMENT '订单开始时间', + `id` int(11) NOT NULL COMMENT '商店货物id', + `item_id` int(11) NOT NULL COMMENT '道具id', + `goods_num` bigint(20) NOT NULL COMMENT '购买个数', + `status` int(11) NOT NULL COMMENT '订单状态 0-客户端申请了订单 1-订单完成 2-订单失败', + PRIMARY KEY (`idx`), + UNIQUE KEY `order_id` (`order_id`) +) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_user_pass` +-- + +DROP TABLE IF EXISTS `t_user_pass`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_user_pass` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL COMMENT '账户id', + `season_id` int(11) NOT NULL DEFAULT '0' COMMENT '通行证赛季', + `data` mediumblob COMMENT 'data', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_season_id` (`account_id`, `season_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_bc_order` +-- + +DROP TABLE IF EXISTS `t_bc_order`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_bc_order` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `order_id` varchar(255) COMMENT '订单号', + `order_type` int(11) NOT NULL COMMENT '0:默认', + `account_id` varchar(60) NOT NULL COMMENT '账户id 只用做事后分析用', + `address` varchar(60) COMMENT 'address', + `currency_name` varchar(60) NOT NULL DEFAULT '' COMMENT 'currency_name', + `status` int(11) NOT NULL DEFAULT '0' COMMENT '0: 支付中 1: 已发货', + `item_id` int(11) NOT NULL COMMENT '道具id', + `item_num` bigint NOT NULL DEFAULT '0' COMMENT '道具数量', + `ext_data` mediumblob COMMENT '扩展数据自定义', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + `price` varchar(60) COLLATE utf8_bin NOT NULL COMMENT '价格', + PRIMARY KEY (`idx`), + UNIQUE KEY `order_id` (`order_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_shop_dailyselection` +-- + +DROP TABLE IF EXISTS `t_shop_dailyselection`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_shop_dailyselection` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `address` varchar(60) NOT NULL COMMENT 'address', + `refresh_mode` int(11) NOT NULL COMMENT '0-每日自动刷新时间 1-手动刷新时间', + `refresh_time` int(11) NOT NULL DEFAULT '0' COMMENT '刷新时间', + `grid_1` int(11) NOT NULL, + `grid_2` int(11) NOT NULL, + `grid_3` int(11) NOT NULL, + `grid_4` int(11) NOT NULL, + `grid_5` int(11) NOT NULL, + `grid_6` int(11) NOT NULL, + `count_1` tinyint(4) NOT NULL, + `count_2` tinyint(4) NOT NULL, + `count_3` tinyint(4) NOT NULL, + `count_4` tinyint(4) NOT NULL, + `count_5` tinyint(4) NOT NULL, + `count_6` tinyint(4) NOT NULL, + PRIMARY KEY (`idx`), + KEY `refresh_time` (`refresh_time`), + KEY `address` (`address`), + KEY `refresh_mode` (`refresh_mode`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +DROP TABLE IF EXISTS `t_shop_free_record`; +CREATE TABLE `t_shop_free_record` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL COMMENT '账号id', + `shop_id` int(11) NOT NULL COMMENT '商店id', + `id` int(11) NOT NULL COMMENT '货架id', + `goods_id` int(11) NOT NULL COMMENT '道具id', + `goods_num` int(11) NOT NULL COMMENT '道具数量', + `free_type` int(11) NOT NULL COMMENT '免费类型', + `free_num` int(11) NOT NULL COMMENT '免费数量', + `createtime` int(11) NOT NULL COMMENT '创建时间', + PRIMARY KEY (`idx`), + KEY `account_id` (`account_id`), + KEY `createtime` (`createtime`), + KEY `id` (`id`), + KEY `goods_id` (`goods_id`) +) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=utf8; + + +-- +-- Table structure for table `t_user_honor` +-- + +DROP TABLE IF EXISTS `t_user_honor`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_user_honor` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `address` varchar(60) NOT NULL COMMENT '钱包地址', + `honor1` int(11) NOT NULL DEFAULT '0' COMMENT 'nft类型6 1:佩戴', + `honor2` int(11) NOT NULL DEFAULT '0' COMMENT 'honor2', + `honor3` int(11) NOT NULL DEFAULT '0' COMMENT 'honor3', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `address` (`address`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_orderid` +-- + +DROP TABLE IF EXISTS `t_orderid`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_orderid` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `request` mediumblob COMMENT 'request', + `confirmed` 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`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_inapp_record` +-- + +DROP TABLE IF EXISTS `t_inapp_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_inapp_record` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `amount` double NOT NULL DEFAULT '0' COMMENT '充值总额', + `buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值次数', + `amount_ok` double NOT NULL DEFAULT '0' COMMENT '充值成功总额', + `buy_ok_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值成功次数', + `daytime` 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`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_inapp_order` +-- + +DROP TABLE IF EXISTS `t_inapp_order`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_inapp_order` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id', + `sp_order_id` varchar(64) DEFAULT NULL COMMENT 'app store order_id', + `platform` int(11) NOT NULL DEFAULT '0' COMMENT '0: ios 1: android', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '申请账号id', + `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id', + `price` double NOT NULL DEFAULT '0' COMMENT '价格', + `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `order_id` (`order_id`), + UNIQUE KEY `platform_sp_order_id` (`platform`, `sp_order_id`), + KEY `account_id` (`account_id`), + KEY `sp_order_id` (`sp_order_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_outapp_order` +-- + +DROP TABLE IF EXISTS `t_outapp_order`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_outapp_order` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id', + `sp_order_id` varchar(64) DEFAULT NULL COMMENT 'app store order_id', + `platform` int(11) NOT NULL DEFAULT '0' COMMENT '0: ios 1: android', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '申请账号id', + `address` varchar(60) DEFAULT NULL COMMENT '申请时账号绑定的钱包', + `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id', + `price` double NOT NULL DEFAULT '0' COMMENT '价格', + `params` mediumblob COMMENT 'params', + `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `order_id` (`order_id`), + UNIQUE KEY `platform_sp_order_id` (`platform`, `sp_order_id`), + KEY `account_id` (`account_id`), + KEY `address` (`address`), + KEY `sp_order_id` (`sp_order_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_mall` +-- + +DROP TABLE IF EXISTS `t_mall`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_mall` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id', + `goods_uuid` varchar(255) NOT NULL DEFAULT '' COMMENT '商品uuid', + `seller` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller', + `seller_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller_address', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id', + `item_num` bigint NOT NULL DEFAULT '0' COMMENT '物品数量', + `currency` varchar(60) NOT NULL COMMENT 'currency', + `price` varchar(255) NOT NULL DEFAULT '' COMMENT 'price', + `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `last_buy_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次购买时间', + `last_buyer` varchar(60) NOT NULL DEFAULT '' COMMENT '最后一次购买者', + `last_modify_price_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次修改价格事件', + `buyer` varchar(60) NOT NULL DEFAULT '' COMMENT '购买成功者', + `buy_ok_time` 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`), + KEY `seller` (`seller`), + KEY `seller_address` (`seller_address`), + KEY `price` (`price`), + UNIQUE KEY `order_id` (`order_id`), + UNIQUE KEY `goods_uuid` (`goods_uuid`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_market` +-- + +DROP TABLE IF EXISTS `t_market`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_market` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `net_id` bigint NOT NULL DEFAULT '0' COMMENT 'net_id', + `order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id', + `token_id` varchar(60) NOT NULL COMMENT 'token_id', + `seller` varchar(60) NOT NULL COMMENT 'owner', + `buyer` varchar(60) NOT NULL COMMENT 'owner', + `nft_token` varchar(60) NOT NULL COMMENT 'nft_token', + `amount` varchar(255) NOT NULL DEFAULT '' COMMENT 'amount', + `currency` varchar(60) NOT NULL COMMENT 'currency', + `price` varchar(255) NOT NULL DEFAULT '' COMMENT 'price', + `update_price` varchar(255) COMMENT 'update_price', + `update_time` int(11) COMMENT 'update_time', + `c_name` varchar(32) NOT NULL DEFAULT '' COMMENT '缓存-名称', + `c_job` int(11) NOT NULL DEFAULT '0' COMMENT '缓存-职业', + `c_type` int(11) NOT NULL DEFAULT '0' COMMENT '缓存-碎片类型', + `c_lv` int(11) NOT NULL DEFAULT '0' COMMENT '缓存-级别', + `c_quality` int(11) NOT NULL DEFAULT '0' COMMENT '缓存-品阶', + `c_durability` float NOT NULL DEFAULT '0' COMMENT '缓存-能量', + `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `activated` int(11) NOT NULL DEFAULT '0' COMMENT 'activated', + `selltime` int(11) COMMENT 'selltime', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `order_id` (`order_id`), + KEY `seller_activated` (`seller`, `activated`), + KEY `activated` (`activated`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +DROP TABLE IF EXISTS `t_web2_order`; +CREATE TABLE `t_web2_order` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `status` int(11) NOT NULL COMMENT '订单状态 0-客户端申请了订单 1-订单完成 2-订单失败', + `order_id` varchar(64) DEFAULT NULL COMMENT '订单id', + `createtime` datetime NOT NULL COMMENT '创建时间', + `account_id` varchar(64) NOT NULL COMMENT '申请账号id', + `address` varchar(64) DEFAULT NULL COMMENT '申请时账号绑定的钱包', + `item_id` int(11) NOT NULL COMMENT '物品id', + `item_num` bigint(20) NOT NULL COMMENT '物品数量', + `id` int(11) NOT NULL COMMENT '商店中的配置id,', + `goods_num` bigint(20) NOT NULL COMMENT '购买商品个数', + `price` varchar(64) DEFAULT NULL COMMENT '价格', + `ext_data` mediumblob COMMENT '扩展自定义数据', + `channel` varchar(64) DEFAULT NULL COMMENT 'google or apple', + `out_order_id` varchar(64) DEFAULT NULL COMMENT 'app store order_id', + PRIMARY KEY (`idx`), + UNIQUE KEY `order_id` (`order_id`), + KEY `out_order_id` (`out_order_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `t_market_store`; +CREATE TABLE `t_market_store` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `order_id` varchar(64) DEFAULT NULL COMMENT '订单id', + `o_link` varchar(64) DEFAULT NULL COMMENT '关联的链上上架单号', + `status` int(11) NOT NULL COMMENT '订单状态 0:出售中 1:已下架 2:已售出 3:购买中', + `owner_address` varchar(60) NOT NULL COMMENT '当前拥有者', + `token_id` varchar(60) DEFAULT NULL COMMENT 'token_id', + `nft_token` varchar(64) DEFAULT NULL COMMENT 'nftToken', + `token_type` int(11) NOT NULL COMMENT 'nft类型 1:英雄 2:枪支 3:芯片', + `item_id` int(11) DEFAULT NULL COMMENT '特殊字段,用于标记中心化道具,用于交易金币', + `amount` bigint(20) NOT NULL DEFAULT '1' COMMENT '堆叠数量', + `createtime` int(11) NOT NULL COMMENT '创建时间(上架时间)', + `modifytime` int(11) NOT NULL COMMENT '修改时间(更新价格等)', + `buytime` int(11) DEFAULT NULL COMMENT '开始购买的时间', + `s_currency` varchar(64) DEFAULT NULL COMMENT '出售时选择的币种地址', + `s_price` varchar(64) NOT NULL COMMENT '出售价格', + `c_name` varchar(32) NOT NULL COMMENT '缓存-名称', + `c_job` int(11) NOT NULL COMMENT '缓存-职业', + `c_type` int(11) NOT NULL COMMENT '缓存-碎片类型', + `c_lv` int(11) NOT NULL COMMENT '缓存-级别', + `c_quality` int(11) NOT NULL COMMENT '缓存-品阶', + `c_durability` float NOT NULL COMMENT '缓存-能量', + `c_id` int(11) NOT NULL COMMENT '缓存-id', + PRIMARY KEY (`idx`) USING BTREE, + UNIQUE KEY `idx` (`idx`), + UNIQUE KEY `o_link` (`o_link`) USING BTREE, + UNIQUE KEY `order_id` (`order_id`) USING BTREE, + KEY `owner_address` (`owner_address`), + KEY `token_id` (`token_id`), + KEY `createtime` (`createtime`), + KEY `s_currency` (`s_currency`), + KEY `s_price` (`s_price`), + KEY `c_name` (`c_name`), + KEY `c_job` (`c_job`), + KEY `c_lv` (`c_lv`), + KEY `c_quality` (`c_quality`), + KEY `c_durability` (`c_durability`), + KEY `c_id` (`c_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10048 DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `t_market_transaction_record`; +CREATE TABLE `t_market_transaction_record` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT, + `createtime` int(11) NOT NULL COMMENT '交易成功时间', + `order_id` varchar(64) NOT NULL DEFAULT '0' COMMENT '订单id', + `o_link` varchar(64) NOT NULL COMMENT '合约订单id', + `seller` varchar(60) NOT NULL COMMENT '卖家', + `buyer` varchar(60) NOT NULL COMMENT '买家', + `token_id` varchar(60) NOT NULL COMMENT 'tokenid', + `item_id` int(11) DEFAULT NULL COMMENT '如果有,说明是中心化道具交易', + `amount` bigint(20) NOT NULL COMMENT '堆叠数量', + `name` varchar(64) NOT NULL COMMENT '商品名称', + `type` int(11) NOT NULL COMMENT '商品类型', + PRIMARY KEY (`idx`), + KEY `createtime` (`createtime`), + KEY `seller` (`seller`), + KEY `buyer` (`buyer`), + KEY `o_link` (`o_link`), + KEY `order_id` (`order_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10002 DEFAULT CHARSET=utf8; + + + +-- +-- Table structure for table `t_crystal_exchange_record` +-- + +DROP TABLE IF EXISTS `t_crystal_exchange_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_crystal_exchange_record` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT, + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `address` varchar(60) COMMENT 'address', + `period` int(11) NOT NULL DEFAULT '0' COMMENT '第几期', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', + `item_num` bigint NOT NULL DEFAULT '0' COMMENT '道具数量', + `createtime` int(11) NOT NULL COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_power_exchange_record` +-- + +DROP TABLE IF EXISTS `t_power_exchange_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_power_exchange_record` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT, + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `address` varchar(60) COMMENT 'address', + `period` int(11) NOT NULL DEFAULT '0' COMMENT '第几期', + `item_num1` int(11) NOT NULL DEFAULT '0' COMMENT '晶体道具260001兑换算力数量', + `item_num2` int(11) NOT NULL DEFAULT '0' COMMENT '晶体道具260002兑换算力数量', + `item_num3` int(11) NOT NULL DEFAULT '0' COMMENT '晶体道具260003兑换算力数量', + `item_num4` int(11) NOT NULL DEFAULT '0' COMMENT '晶体道具260004兑换算力数量', + `total_num` double NOT NULL DEFAULT '0' COMMENT '算力总量', + `createtime` int(11) NOT NULL COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_computing_power_period` +-- + +DROP TABLE IF EXISTS `t_hash_rate_reward`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_hash_rate_reward` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT, + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `address` varchar(60) COMMENT 'address', + `period` int(11) NOT NULL DEFAULT '0' COMMENT '第几期', + `power` varchar(60) COMMENT '算力', + `reward_cec` varchar(60) COMMENT 'reward cec', + `reward1` int(11) NOT NULL DEFAULT '0' COMMENT '第1周奖励', + `reward2` int(11) NOT NULL DEFAULT '0' COMMENT '第2周奖励', + `reward3` int(11) NOT NULL DEFAULT '0' COMMENT '第3周奖励', + `reward4` int(11) NOT NULL DEFAULT '0' COMMENT '第4周奖励', + `txHash1` varchar(60) NOT NULL DEFAULT '' COMMENT '地址1', + `txHash2` varchar(60) NOT NULL DEFAULT '' COMMENT '地址2', + `txHash3` varchar(60) NOT NULL DEFAULT '' COMMENT '地址3', + `txHash4` varchar(60) NOT NULL DEFAULT '' COMMENT '地址4', + + `createtime` int(11) NOT NULL COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +CREATE TABLE `t_ranking_settlement_record` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `state` int(11) NOT NULL DEFAULT '0' COMMENT '是否重置', + `last_rank` int(11) NOT NULL DEFAULT '0' COMMENT '上赛季段位', + `current_rank` int(11) NOT NULL DEFAULT '0' COMMENT '新段位', + `last_score` int(11) NOT NULL DEFAULT '0' COMMENT '上赛季段位分', + `current_score` int(11) NOT NULL DEFAULT '0' COMMENT '新段位分', + `awards` 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=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + + +CREATE TABLE `t_staking` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT, + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `address` varchar(60) NOT NULL DEFAULT '' COMMENT 'address', + `order_id` varchar(60) COMMENT 'order_id', + `token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id', + `item_id` int(11) NOT NULL COMMENT 'item_id', + `token_type` int(11) NOT NULL DEFAULT '0' COMMENT 'nft类型 1:英雄 2:枪支 3:芯片 6:荣誉 7:徽章', + `net_id` bigint NOT NULL DEFAULT '0' COMMENT 'net_id', + `contract_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'contract_address', + `stacked_num` varchar(60) NOT NULL DEFAULT '' COMMENT 'stacked_num', + `start_time` bigint NOT NULL DEFAULT '0' COMMENT '质押开始时间', + `stake_time` bigint NOT NULL DEFAULT '0' COMMENT '质押结束时间', + `redeem_time` bigint NOT NULL DEFAULT '0' COMMENT '赎回时间', + `status` int(11) NOT NULL COMMENT '0:质押中 1:已解押', + `txhash` varchar(255) NOT NULL DEFAULT '' COMMENT 'txhash', + `nft_type` int(11) NOT NULL COMMENT '', + `nft_reward` double NOT NULL DEFAULT '0' COMMENT '利息', + `createtime` int(11) NOT NULL COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `unikey1` (`token_id`, `contract_address`, `net_id`, `start_time`), + UNIQUE KEY `unikey2` (`token_id`, `contract_address`, `net_id`, `order_id`), + KEY `address` (`address`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8; + +-- +-- Table structure for table `t_mail` +-- + +DROP TABLE IF EXISTS `t_mail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_mail` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `mailid` bigint NOT NULL DEFAULT '0' COMMENT '邮件id', + `confirmed` int(11) NOT NULL DEFAULT '0' COMMENT 'confirmed', + `attachments` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '附件', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `account_id_mailid` (`account_id`, `mailid`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +-- +-- Table structure for table `t_avatar` +-- + +DROP TABLE IF EXISTS `t_avatar`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_avatar` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `token_id` varchar(60) COMMENT 'token_id', + `item_id` int(11) NOT NULL COMMENT 'item_id', + `item_type` int(11) NOT NULL COMMENT 'item类型', + `status` int(11) NOT NULL DEFAULT '0' COMMENT '装备状态', + `hero_idx` bigint DEFAULT NULL COMMENT '英雄外键id', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `hero_idx_type` (`hero_idx`, `item_type`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +CREATE TABLE `t_hash_rate_task` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `task_id` int(11) NOT NULL COMMENT '配置表HashRateTask', + `season` int(11) NOT NULL DEFAULT '0' COMMENT 'taskId 为10003可用', + `record_total` int(64) NOT NULL DEFAULT '0' COMMENT '记录总数据', + `claim_day` int(64) NOT NULL DEFAULT '0' COMMENT '当天领取数据', + `claim_total` int(64) 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_task_id` (`account_id`, `task_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; \ No newline at end of file diff --git a/sql/gamedb2006_migrate_231027_01.sql b/sql/gamedb2006_migrate_231027_01.sql new file mode 100644 index 00000000..fb776cc8 --- /dev/null +++ b/sql/gamedb2006_migrate_231027_01.sql @@ -0,0 +1,19 @@ +begin; + +CREATE TABLE `t_hash_rate_task` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `task_id` int(11) NOT NULL COMMENT '配置表HashRateTask', + `season` int(11) NOT NULL DEFAULT '0' COMMENT 'taskId 为10003可用', + `record_total` int(64) NOT NULL DEFAULT '0' COMMENT '记录总数据', + `claim_day` int(64) NOT NULL DEFAULT '0' COMMENT '当天领取数据', + `claim_total` int(64) 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_task_id` (`account_id`, `task_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +insert into version (version) values(2023092001); + +commit; diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index c84bea3a..a688d328 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -1,805 +1,808 @@ -_getOpenId(), $whiteList); - } - - public function switchAccount($accountId){ - $this->accountId = $accountId; - $this->mysqlConn = null; - } - - public function switchOnlineAccount($accountId){ - $this->accountId = $accountId; - $this->mysqlConn = null; - $r = $this->_getRedis($this->_getAccountId()); - $this->sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId()); - return !empty($this->sessionId); - } - - public function _handlePre() - { -// if (SERVER_ENV == _ONLINE) { -// if (getReqVal('client_uuid', '') != '499af8a0-a1bc-0b0e-dc79-a42cb3f103dc') { -// if ((getReqVal('c', '') != 'Battle')) { -// phpcommon\sendError(1001, 'session expiration'); -// die(); -// } -// } -// } - - $this->accountId = getReqVal('account_id', ''); - $this->sessionId = getReqVal('session_id', ''); - if (SERVER_ENV != _DEBUG) { - if (!phpcommon\isValidSessionId($this->accountId, - $this->sessionId)) { - phpcommon\sendError(500, 'invalid session_id'); - die(); - } - } - if (!(getReqVal('c', '') == 'User' && getReqVal('a', '') == 'login')) { - if ((getReqVal('c', '') == 'Battle')) { - return; - } - $r = $this->_getRedis($this->_getAccountId()); - $sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId()); - // error_log('SERVER_ENV:' . SERVER_ENV . '_DEBUG:' . _DEBUG); - if (SERVER_ENV != _DEBUG) - { - if (empty($sessionId)) { - $this->updateSession(myself()->_getAccountId(), - myself()->_getSessionId()); - } else if ($sessionId != $this->_getSessionId()) { - error_log('session expiration' . json_encode( - $_REQUEST - )); - phpcommon\sendError(1001, 'session expiration'); - die(); - } - } - - $this->_userLvRestriction(); - } - - /*if (SERVER_ENV == _ONLINE) { - if (phpcommon\cmpVersion(getReqVal('_version', ''), '0.2.0') > 0) { - if (!$this->isWhiteList() || myself()->_getChannel() != BC_CHANNEL) { - phpcommon\sendError(1002, ''); - die(); - } - } - }*/ - } - - protected function _userLvRestriction(){ - $userDb = $this->_getOrmUserInfo(); - $controller = getReqVal('c', ''); - switch ($controller){ - case "Chip" : { - if (getReqVal('a', '') != 'chipList' && $userDb['star_num'] < \mt\StarLevel::STAR_NUM_CHIP_LIMIT){ - $this->_rspErr(1,'Not agreed terms. star number of need ' .\mt\StarLevel::STAR_NUM_CHIP_LIMIT); - die(); - } - } - break; - case "Emoji" : { - if ($userDb['star_num'] < \mt\StarLevel::STAR_NUM_EMOJI_LIMIT){ - $this->_rspErr(1,'Not agreed terms star number of need ' .\mt\StarLevel::STAR_NUM_EMOJI_LIMIT); - die(); - } - } - break; - case "Fragment" : { - if (getReqVal('a', '') == 'syntheticFragment' && $userDb['star_num'] < \mt\StarLevel::STAR_NUM_PIECE_LIMIT){ - $this->_rspErr(1,'Not agreed terms star number of need ' .\mt\StarLevel::STAR_NUM_PIECE_LIMIT); - die(); - } - } - } - } - - protected function updateSession($accountId, $sessionId) - { - $r = $this->_getRedis($this->_getAccountId()); - $r->set(LAST_SESSION_KEY . $this->_getAccountId(), $sessionId); - $r->pexpire(LAST_SESSION_KEY . $this->_getAccountId(), 1000 * 3600 * 24); - } - - public function _getAccountId() - { - return $this->accountId; - } - - public function _getGameId() - { - return phpcommon\extractGameId($this->_getAccountId()); - } - - public function _getOpenId() - { - return phpcommon\extractOpenId($this->_getAccountId()); - } - - public function _getChannel() - { - return phpcommon\extractChannel($this->_getAccountId()); - } - - public function _getAddress() - { - if (!$this->addressActived) { - $userDb = $this->_getOrmUserInfo(); - $this->address = $userDb['address']; - $this->addressActived = true; - if (SERVER_ENV != _ONLINE && empty($this->address)) { - $this->address = strtolower('0xa9ecB9F3A0b54d31ce4a035C89EC7Da4110beB59'); - if (myself()->_getAccountId() == '6513_2006_3WOWIsmpcihK1KTnNP1Ky5MBOh7rt6Rl') { - ///$this->address = strtolower('0x0bb52209756e8d157f2e551a9adb8d9019b688b1'); - $this->address = strtolower('0xbd2d6de4b70d370954b187c95dddfbd00f4129ff'); - } - } - } - return $this->address; - } - - public function _isValidAddress() - { - $address = $this->_getAddress(); - return !empty($address); - } - - public function _getSessionId() - { - return $this->sessionId; - } - - public function _getRegisterTime() - { - $registertime = phpcommon\extractRegisterTimeFromSessionId($this->sessionId); - return $registertime; - } - - public function _getSelfMysql() - { - if (!$this->mysqlConn) { - $this->mysqlConn = $this->_getMysql($this->_getAccountId()); - } - return $this->mysqlConn; - } - - public function _getSelfRedis() - { - if (!$this->redisConn) { - $this->redisConn = $this->_getRedis($this->_getAccountId()); - } - return $this->redisConn; - } - - public function _getUserInfo($fields) - { - $row = SqlHelper::selectOne - ($this->_getSelfMysql(), - 't_user', - $fields, - array( - 'account_id' => $this->_getAccountId() - ) - ); - if (empty($row)) { - phpcommon\sendError(500, 'server internal error'); - error_log('getUserInfo error '. $this->_getAccountId()); - die(); - } - return $row; - } - - public function _getOrmUserInfo() - { - $row = SqlHelper::ormSelectOne - ($this->_getSelfMysql(), - 't_user', - array( - 'account_id' => $this->_getAccountId() - ) - ); - if (empty($row)) { - phpcommon\sendError(500, 'server internal error'); - error_log('getUserInfo error '. $this->_getAccountId()); - die(); - } - return $row; - } - - public function _safeGetOrmUserInfo() - { - $row = SqlHelper::ormSelectOne - ($this->_getSelfMysql(), - 't_user', - array( - 'account_id' => $this->_getAccountId() - ) - ); - return $row ? $row : null; - } - - public function _updateUserInfo($fieldsKv) - { - SqlHelper::update - ($this->_getSelfMysql(), - 't_user', - array( - 'account_id' => $this->_getAccountId() - ), - $fieldsKv - ); - } - - public function _getItemCount($itemId, $userInfo) - { - switch ($itemId) { - case V_ITEM_GOLD: - { - return $userInfo['gold']; - } - break; - case V_ITEM_DIAMOND: - { - return $userInfo['diamond']; - } - break; - case V_ITEM_EXP: - { - return $userInfo['exp']; - } - break; - case V_ITEM_ACTIVE: - { - return $this->_getV(TN_ACTIVE, 0); - } - break; - default: - { - return Bag::getItemCount($itemId); - } - break; - } - return 0; - } - - public function _isVirtualItem($itemId) - { - return in_array($itemId, array(V_ITEM_GOLD, V_ITEM_DIAMOND, V_ITEM_EXP, V_ITEM_ACTIVE,V_ITEM_BCEG,V_ITEM_STAR)); - } - - public function _addVirtualItem($itemId, $itemNum,$awardService,$propertyChgService) - { - if ($itemNum <= 0){ - return; - } - switch ($itemId) { - case V_ITEM_GOLD: - { - $this->_updateUserInfo(array( - 'gold' => function () use($itemNum) { - return "gold + ${itemNum}"; - } - )); - } - break; - case V_ITEM_DIAMOND: - { - $this->_updateUserInfo(array( - 'diamond' => function () use($itemNum) { - return "diamond + ${itemNum}"; - } - )); - } - break; - case V_ITEM_BCEG: - { - $this->_updateUserInfo(array( - 'bceg' => function () use($itemNum) { - return "bceg + ${itemNum}"; - } - )); - } - break; - case V_ITEM_EXP: - { -// $this->_updateUserInfo(array( -// 'exp' => function () use($itemNum) { -// return "exp + ${itemNum}"; -// } -// )); - $userDb = $this->_safeGetOrmUserInfo(); - $newlV = $userDb['level']; - $newExp = $userDb['exp']+$itemNum; - \mt\BattlePass::getExpByLv($newlV,$newExp); - $this->_updateUserInfo(array( - 'level' => $newlV, - 'exp' => $newExp - )); - if ($newlV != $userDb['level']){ - $currSeasonMeta = \mt\BattlePass::getCurrentSeason(); - $passDb = Pass::find($currSeasonMeta['id']); - $rewards = emptyReplace(json_decode($passDb['data'], true), array()); - foreach ($rewards['basic'] as &$reward){ - if ($newlV >= $reward['level'] && $reward['state']==-1){ - $reward['state'] = 0; - } - } - if ($userDb['activated']){ - foreach ($rewards['platinum'] as &$reward){ - if ($newlV >= $reward['level'] && $reward['state']==-1){ - $reward['state'] = 0; - } - } - } - Pass::upsert($currSeasonMeta['id'],json_encode($rewards)); - } - } - break; - case V_ITEM_ACTIVE: - { - - $addItem = max(0, mt\Parameter::getVal('activeness_limit', 0) - $this->_getDailyV(TN_DAILY_ACTIVE, 0)); - $addItem = min($addItem, $itemNum); - if ($addItem > 0) { - $this->_incV(TN_ACTIVE, 0, $itemNum); - $this->_incDailyV(TN_DAILY_ACTIVE, 0, $itemNum); - $this->_incWeeklyV(TN_WEEKLY_ACTIVE, 0, $itemNum); - } - } - break; - case V_ITEM_STAR: - { - $this->_updateUserInfo(array( - 'star_num' => function () use($itemNum) { - return "star_num + ${itemNum}"; - } - )); - $this->_incDailyV(TN_DAILY_GET_STAR_NUM, 0,$itemNum); - } - break; - default: - { - } - break; - } - } - - public function _decVirtualItem($itemId, $itemNum) - { - if ($itemNum <= 0){ - return; - } - switch ($itemId) { - case V_ITEM_GOLD: - { - $this->_updateUserInfo(array( - 'gold' => function () use($itemNum) { - return "GREATEST(0, gold - ${itemNum})"; - }, - 'consume_gold' => function () use ($itemNum){ - return "consume_gold + ${itemNum}"; - } - )); - $this->_incDailyV(TN_DAILY_USED_GOLD_NUM, 0, $itemNum); - } - break; - case V_ITEM_DIAMOND: - { - $this->_updateUserInfo(array( - 'diamond' => function () use($itemNum) { - return "GREATEST(0, diamond - ${itemNum})"; - } - )); - } - break; - default: - { - } - break; - } - } - - public function _addItems($items, $awardService, $propertyService) - { - $heads = array(); - $headFrames = array(); - foreach ($items as $item) { - //道具产出埋点 - LogService::productItem($item); - if ($awardService){ - $awardService->addItem($item['item_id'], $item['item_num']); - } - if ($this->_isVirtualItem($item['item_id'])) { - $this->_addVirtualItem($item['item_id'], $item['item_num'],$awardService,$propertyService); - $propertyService->addUserChg(); - } else { - $itemMeta = mt\Item::get($item['item_id']); - if ($itemMeta) { - if (mt\Item::isBagItem($itemMeta['type'], $itemMeta['sub_type'])) { - Bag::addItem($item['item_id'], $item['item_num']); - $propertyService->addBagChg(); - } else { - for ($i=0; $i<$item['item_num']; $i++){ - switch ($itemMeta['type']) { - case mt\Item::HERO_TYPE: - { - if (isset($item['is_payed']) && $item['is_payed']) { - $res = Hero::addHero($itemMeta); - } else { - $res = Hero::addFreeHero($itemMeta); - } - if ($res){ - $lastIdx = SqlHelper::getLastInsertId( myself()->_getSelfMysql()); - $awardService->addHero($item['item_id'],$lastIdx); - } - $propertyService->addHeroChg(); - $propertyService->addUserChg(); - } - break; - case mt\Item::HERO_SKIN_TYPE: - { - HeroSkin::addSkin($itemMeta); - $propertyService->addHeroSkinChg(); - } - break; - case mt\Item::HEAD_TYPE: - { - array_push($heads, $itemMeta['id']); - $propertyService->addUserChg(); - } - break; - case mt\Item::HEAD_FRAME_TYPE: - { - array_push($headFrames, $itemMeta['id']); - $propertyService->addUserChg(); - } - break; - case mt\Item::GUN_TYPE: - { - Gun::addGun($itemMeta); - $propertyService->addGunChg(); - } - break; - case mt\Item::GUN_SKIN_TYPE: - { - GunSkin::addSkin($itemMeta['id']); - $propertyService->addGunSkinChg(); - } - break; - case mt\Item::FRAGMENT_BOX_TYPE: - { - Bag::addItem($item['item_id'], $item['item_num']); - $propertyService->addBagChg(); - } - break; - case mt\Item::RING_TYPE: - { - UserSeasonRing::addRing($itemMeta); - $propertyService->addUserChg(); - } - break; - case mt\Item::PARACHUTE_TYPE: - { - Parachute::addParachute($itemMeta); - $propertyService->addUserChg(); - } - break; - case mt\Item::CHIP_TYPE: - { - Chip::addChip($itemMeta); - $propertyService->addChip(); - } - break; - case mt\Item::RANDOM_BOX_TYPE: - { - $this->_openRandomBox($itemMeta,$awardService,$propertyService); - } - break; - case mt\Item::AVATAR_TYPE: - { - Avatar::addAvatar($itemMeta); - } - break; - default: - { - $this->_addLog('additems', 'invalid_item', array( - 'param1' => $item['item_id'], - 'param2' => $item['item_num'], - )); - } - break; - } - } - - } - } - } - }//end foreach - if (!empty($heads) || !empty($headFrames)) { - $userInfo = $this->_getOrmUserInfo(); - $headsDb = emptyReplace(json_decode($userInfo['head_list'], true), array()); - $headFramesDb = emptyReplace(json_decode($userInfo['head_frame_list'], true), array()); - $heads = array_unique(array_merge($heads, $headsDb)); - $headFrames = array_values(array_unique(array_merge($headFrames, $headFramesDb))); - $this->_updateUserInfo(array( - 'head_list' => json_encode($heads), - 'head_frame_list' => json_encode($headFrames), - )); - } - } - - public function _openRandomBox($itemMeta,$awardService,$propertyService){ - if ($itemMeta['include_item_id']) { - $includeItemIds = explode('|', $itemMeta['include_item_id']); - $key = array_rand($includeItemIds,1); - - $items = array( - array( - 'item_id' => $includeItemIds[$key] , - 'item_num' => 1 - ) - ); - $this->_addItems($items,$awardService,$propertyService); - } - } - - public function _addTryUsingItems($items) - { - foreach ($items as $item) { - Bag::addTryUsingItem($item['item_id'], $item['item_num'], $item['try_using_time']); - } - } - - public function _decItems($items) - { - foreach ($items as $item) { - //道具消耗埋点 - LogService::consumeItem($item); - if ($this->_isVirtualItem($item['item_id'])) { - $this->_decVirtualItem($item['item_id'], $item['item_num']); - } else { - Bag::decItem($item['item_id'], $item['item_num']); - } - } - } - - public function _hasEnoughItems($items, &$lackItem) - { - $userInfo = $this->_getUserInfo(array( - 'gold', - 'diamond', - )); - foreach ($items as $item) { - $inventory = $this->_getItemCount($item['item_id'], $userInfo); - if ($inventory < $item['item_num']) { - $lackItem = array( - 'item_id' => $item['item_id'], - 'item_num' => $item['item_num'], - 'inventory' => $inventory - ); - return false; - } - } - return true; - } - - public function _getLackItemErrMsg($lackItem) - { - if (!$lackItem) { - return 'Not enough item'; - } - $itemMeta = mt\Item::get($lackItem['item_id']); - if (!$itemMeta) { - return 'Not enough item'; - } - if (SERVER_ENV != _ONLINE) { - return "${itemMeta['name']} Not enough stock:${lackItem['inventory']} need:${lackItem['item_num']}"; - } else { - return "${itemMeta['name']} Not enough"; - } - } - - public function _scatterDrop($dropSource, $dropMeta, $awardService, $propertyService) - { - $itemIds = explode('|', $dropMeta['item_id']); - $nums = explode('|', $dropMeta['num']); - $weights = explode('|', $dropMeta['weight']); - if (count($itemIds) != count($nums) || - count($itemIds) != count($weights)) { - return; - } - $totalWeight = 0; - foreach ($weights as $weight) { - $totalWeight += $weight; - } - $addItems = array(); - if ($dropMeta['type'] == 1) { - //N out of n - for ($i = 0; $i < count($itemIds); ++$i) { - $itemId = $itemIds[$i]; - $num = $nums[$i]; - $weight = $weights[$i]; - if ((rand() % 10000) < $weight) { - array_push($addItems, array( - 'item_id' => $itemId, - 'item_num' => $num - )); - } - } - }else if ($dropMeta['type'] == 2 && $totalWeight > 0) { - //1 out of n - $currWeight = 0; - $rnd = rand() % $totalWeight; - for ($i = 0; $i < count($itemIds); ++$i) { - $itemId = $itemIds[$i]; - $num = $nums[$i]; - $currWeight += $weights[$i]; - if ($currWeight > $rnd) { - array_push($addItems, array( - 'item_id' => $itemId, - 'item_num' => $num - )); - break; - } - } - } - if (count($addItems) > 0) { - $this->_addItems($addItems, $awardService, $propertyService); - } - SqlHelper::insert( - myself()->_getSelfMysql(), - 't_drop_log', - array( - 'account_id' => myself()->_getAccountId(), - 'drop_source' => $dropSource, - 'drop_id' => $dropMeta['drop_id'], - 'drop_items' => json_encode($addItems), - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ) - ); - } - - public function _addLog($type, $subtype, $params) - { - $fieldsKv = array( - 'account_id' => $this->_getAccountId(), - 'type' => $type, - 'subtype' => $subtype, - 'param1' => getXVal($params, 'param1', ''), - 'param2' => getXVal($params, 'param2', ''), - 'param3' => getXVal($params, 'param3', ''), - 'param4' => getXVal($params, 'param4', ''), - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); - SqlHelper::insert( - myself()->_getSelfMysql(), - 't_game_log', - $fieldsKv - ); - } - - public function _getV($x, $y, $defVal = 0) - { - return DynData::getV($x, $y, $defVal); - } - - public function _setV($x, $y, $val) - { - DynData::setV($x, $y, $val); - } - - public function _incV($x, $y, $incVal) - { - DynData::incV($x, $y, $incVal); - } - - public function _decV($x, $y, $decVal) - { - DynData::decV($x, $y, $decVal); - } - - public function _getDailyV($x, $y, $defVal = 0) - { - return DynData::getDailyV($x, $y, $defVal); - } - - public function _setDailyV($x, $y, $val) - { - DynData::setDailyV($x, $y, $val); - } - - public function _incDailyV($x, $y, $incVal) - { - DynData::incDailyV($x, $y, $incVal); - } - - public function _decDailyV($x, $y, $decVal) - { - DynData::decDailyV($x, $y, $decVal); - } - - public function _getWeeklyV($x, $y, $defVal = 0) - { - return DynData::getWeeklyV($x, $y, $defVal); - } - - public function _setWeeklyV($x, $y, $val) - { - DynData::setWeeklyV($x, $y, $val); - } - - public function _incWeeklyV($x, $y, $incVal) - { - DynData::incWeeklyV($x, $y, $incVal); - } - - public function _decWeeklyV($x, $y, $decVal) - { - DynData::decWeeklyV($x, $y, $decVal); - } - -} +_getOpenId(), $whiteList); + } + + public function switchAccount($accountId){ + $this->accountId = $accountId; + $this->mysqlConn = null; + } + + public function switchOnlineAccount($accountId){ + $this->accountId = $accountId; + $this->mysqlConn = null; + $r = $this->_getRedis($this->_getAccountId()); + $this->sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId()); + return !empty($this->sessionId); + } + + public function _handlePre() + { +// if (SERVER_ENV == _ONLINE) { +// if (getReqVal('client_uuid', '') != '499af8a0-a1bc-0b0e-dc79-a42cb3f103dc') { +// if ((getReqVal('c', '') != 'Battle')) { +// phpcommon\sendError(1001, 'session expiration'); +// die(); +// } +// } +// } + + $this->accountId = getReqVal('account_id', ''); + $this->sessionId = getReqVal('session_id', ''); + if (SERVER_ENV != _DEBUG) { + if (!phpcommon\isValidSessionId($this->accountId, + $this->sessionId)) { + phpcommon\sendError(500, 'invalid session_id'); + die(); + } + } + if (!(getReqVal('c', '') == 'User' && getReqVal('a', '') == 'login')) { + if ((getReqVal('c', '') == 'Battle')) { + return; + } + $r = $this->_getRedis($this->_getAccountId()); + $sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId()); + // error_log('SERVER_ENV:' . SERVER_ENV . '_DEBUG:' . _DEBUG); + if (SERVER_ENV != _DEBUG) + { + if (empty($sessionId)) { + $this->updateSession(myself()->_getAccountId(), + myself()->_getSessionId()); + } else if ($sessionId != $this->_getSessionId()) { + error_log('session expiration' . json_encode( + $_REQUEST + )); + phpcommon\sendError(1001, 'session expiration'); + die(); + } + } + + $this->_userLvRestriction(); + } + + /*if (SERVER_ENV == _ONLINE) { + if (phpcommon\cmpVersion(getReqVal('_version', ''), '0.2.0') > 0) { + if (!$this->isWhiteList() || myself()->_getChannel() != BC_CHANNEL) { + phpcommon\sendError(1002, ''); + die(); + } + } + }*/ + } + + protected function _userLvRestriction(){ + $userDb = $this->_getOrmUserInfo(); + $controller = getReqVal('c', ''); + switch ($controller){ + case "Chip" : { + if (getReqVal('a', '') != 'chipList' && $userDb['star_num'] < \mt\StarLevel::STAR_NUM_CHIP_LIMIT){ + $this->_rspErr(1,'Not agreed terms. star number of need ' .\mt\StarLevel::STAR_NUM_CHIP_LIMIT); + die(); + } + } + break; + case "Emoji" : { + if ($userDb['star_num'] < \mt\StarLevel::STAR_NUM_EMOJI_LIMIT){ + $this->_rspErr(1,'Not agreed terms star number of need ' .\mt\StarLevel::STAR_NUM_EMOJI_LIMIT); + die(); + } + } + break; + case "Fragment" : { + if (getReqVal('a', '') == 'syntheticFragment' && $userDb['star_num'] < \mt\StarLevel::STAR_NUM_PIECE_LIMIT){ + $this->_rspErr(1,'Not agreed terms star number of need ' .\mt\StarLevel::STAR_NUM_PIECE_LIMIT); + die(); + } + } + } + } + + protected function updateSession($accountId, $sessionId) + { + $r = $this->_getRedis($this->_getAccountId()); + $r->set(LAST_SESSION_KEY . $this->_getAccountId(), $sessionId); + $r->pexpire(LAST_SESSION_KEY . $this->_getAccountId(), 1000 * 3600 * 24); + } + + public function _getAccountId() + { + return $this->accountId; + } + + public function _getGameId() + { + return phpcommon\extractGameId($this->_getAccountId()); + } + + public function _getOpenId() + { + return phpcommon\extractOpenId($this->_getAccountId()); + } + + public function _getChannel() + { + return phpcommon\extractChannel($this->_getAccountId()); + } + + public function _getAddress() + { + if (!$this->addressActived) { + $userDb = $this->_getOrmUserInfo(); + $this->address = $userDb['address']; + $this->addressActived = true; + if (SERVER_ENV != _ONLINE && empty($this->address)) { + $this->address = strtolower('0xa9ecB9F3A0b54d31ce4a035C89EC7Da4110beB59'); + if (myself()->_getAccountId() == '6513_2006_3WOWIsmpcihK1KTnNP1Ky5MBOh7rt6Rl') { + ///$this->address = strtolower('0x0bb52209756e8d157f2e551a9adb8d9019b688b1'); + $this->address = strtolower('0xbd2d6de4b70d370954b187c95dddfbd00f4129ff'); + } + } + } + return $this->address; + } + + public function _isValidAddress() + { + $address = $this->_getAddress(); + return !empty($address); + } + + public function _getSessionId() + { + return $this->sessionId; + } + + public function _getRegisterTime() + { + $registertime = phpcommon\extractRegisterTimeFromSessionId($this->sessionId); + return $registertime; + } + + public function _getSelfMysql() + { + if (!$this->mysqlConn) { + $this->mysqlConn = $this->_getMysql($this->_getAccountId()); + } + return $this->mysqlConn; + } + + public function _getSelfRedis() + { + if (!$this->redisConn) { + $this->redisConn = $this->_getRedis($this->_getAccountId()); + } + return $this->redisConn; + } + + public function _getUserInfo($fields) + { + $row = SqlHelper::selectOne + ($this->_getSelfMysql(), + 't_user', + $fields, + array( + 'account_id' => $this->_getAccountId() + ) + ); + if (empty($row)) { + phpcommon\sendError(500, 'server internal error'); + error_log('getUserInfo error '. $this->_getAccountId()); + die(); + } + return $row; + } + + public function _getOrmUserInfo() + { + $row = SqlHelper::ormSelectOne + ($this->_getSelfMysql(), + 't_user', + array( + 'account_id' => $this->_getAccountId() + ) + ); + if (empty($row)) { + phpcommon\sendError(500, 'server internal error'); + error_log('getUserInfo error '. $this->_getAccountId()); + die(); + } + return $row; + } + + public function _safeGetOrmUserInfo() + { + $row = SqlHelper::ormSelectOne + ($this->_getSelfMysql(), + 't_user', + array( + 'account_id' => $this->_getAccountId() + ) + ); + return $row ? $row : null; + } + + public function _updateUserInfo($fieldsKv) + { + SqlHelper::update + ($this->_getSelfMysql(), + 't_user', + array( + 'account_id' => $this->_getAccountId() + ), + $fieldsKv + ); + } + + public function _getItemCount($itemId, $userInfo) + { + switch ($itemId) { + case V_ITEM_GOLD: + { + return $userInfo['gold']; + } + break; + case V_ITEM_DIAMOND: + { + return $userInfo['diamond']; + } + break; + case V_ITEM_EXP: + { + return $userInfo['exp']; + } + break; + case V_ITEM_ACTIVE: + { + return $this->_getV(TN_ACTIVE, 0); + } + break; + default: + { + return Bag::getItemCount($itemId); + } + break; + } + return 0; + } + + public function _isVirtualItem($itemId) + { + return in_array($itemId, array(V_ITEM_GOLD, V_ITEM_DIAMOND, V_ITEM_EXP, V_ITEM_ACTIVE,V_ITEM_BCEG,V_ITEM_STAR)); + } + + public function _addVirtualItem($itemId, $itemNum,$awardService,$propertyChgService) + { + if ($itemNum <= 0){ + return; + } + switch ($itemId) { + case V_ITEM_GOLD: + { + $this->_updateUserInfo(array( + 'gold' => function () use($itemNum) { + return "gold + ${itemNum}"; + } + )); + } + break; + case V_ITEM_DIAMOND: + { + $this->_updateUserInfo(array( + 'diamond' => function () use($itemNum) { + return "diamond + ${itemNum}"; + } + )); + } + break; + case V_ITEM_BCEG: + { + $this->_updateUserInfo(array( + 'bceg' => function () use($itemNum) { + return "bceg + ${itemNum}"; + } + )); + } + break; + case V_ITEM_EXP: + { +// $this->_updateUserInfo(array( +// 'exp' => function () use($itemNum) { +// return "exp + ${itemNum}"; +// } +// )); + $userDb = $this->_safeGetOrmUserInfo(); + $newlV = $userDb['level']; + $newExp = $userDb['exp']+$itemNum; + \mt\BattlePass::getExpByLv($newlV,$newExp); + $this->_updateUserInfo(array( + 'level' => $newlV, + 'exp' => $newExp + )); + if ($newlV != $userDb['level']){ + $currSeasonMeta = \mt\BattlePass::getCurrentSeason(); + $passDb = Pass::find($currSeasonMeta['id']); + $rewards = emptyReplace(json_decode($passDb['data'], true), array()); + foreach ($rewards['basic'] as &$reward){ + if ($newlV >= $reward['level'] && $reward['state']==-1){ + $reward['state'] = 0; + } + } + if ($userDb['activated']){ + foreach ($rewards['platinum'] as &$reward){ + if ($newlV >= $reward['level'] && $reward['state']==-1){ + $reward['state'] = 0; + } + } + } + Pass::upsert($currSeasonMeta['id'],json_encode($rewards)); + } + } + break; + case V_ITEM_ACTIVE: + { + + $addItem = max(0, mt\Parameter::getVal('activeness_limit', 0) - $this->_getDailyV(TN_DAILY_ACTIVE, 0)); + $addItem = min($addItem, $itemNum); + if ($addItem > 0) { + $this->_incV(TN_ACTIVE, 0, $itemNum); + $this->_incDailyV(TN_DAILY_ACTIVE, 0, $itemNum); + $this->_incWeeklyV(TN_WEEKLY_ACTIVE, 0, $itemNum); + } + } + break; + case V_ITEM_STAR: + { + $this->_updateUserInfo(array( + 'star_num' => function () use($itemNum) { + return "star_num + ${itemNum}"; + } + )); + $this->_incDailyV(TN_DAILY_GET_STAR_NUM, 0,$itemNum); + HashRateTask::incRecordNum(HashRateTask::STAR_TYPE,$itemNum); + } + break; + default: + { + } + break; + } + } + + public function _decVirtualItem($itemId, $itemNum) + { + if ($itemNum <= 0){ + return; + } + switch ($itemId) { + case V_ITEM_GOLD: + { + $this->_updateUserInfo(array( + 'gold' => function () use($itemNum) { + return "GREATEST(0, gold - ${itemNum})"; + }, + 'consume_gold' => function () use ($itemNum){ + return "consume_gold + ${itemNum}"; + } + )); + $this->_incDailyV(TN_DAILY_USED_GOLD_NUM, 0, $itemNum); + } + break; + case V_ITEM_DIAMOND: + { + $this->_updateUserInfo(array( + 'diamond' => function () use($itemNum) { + return "GREATEST(0, diamond - ${itemNum})"; + } + )); + } + break; + default: + { + } + break; + } + } + + public function _addItems($items, $awardService, $propertyService) + { + $heads = array(); + $headFrames = array(); + foreach ($items as $item) { + //道具产出埋点 + LogService::productItem($item); + if ($awardService){ + $awardService->addItem($item['item_id'], $item['item_num']); + } + if ($this->_isVirtualItem($item['item_id'])) { + $this->_addVirtualItem($item['item_id'], $item['item_num'],$awardService,$propertyService); + $propertyService->addUserChg(); + } else { + $itemMeta = mt\Item::get($item['item_id']); + if ($itemMeta) { + if (mt\Item::isBagItem($itemMeta['type'], $itemMeta['sub_type'])) { + Bag::addItem($item['item_id'], $item['item_num']); + $propertyService->addBagChg(); + } else { + for ($i=0; $i<$item['item_num']; $i++){ + switch ($itemMeta['type']) { + case mt\Item::HERO_TYPE: + { + if (isset($item['is_payed']) && $item['is_payed']) { + $res = Hero::addHero($itemMeta); + } else { + $res = Hero::addFreeHero($itemMeta); + } + if ($res){ + $lastIdx = SqlHelper::getLastInsertId( myself()->_getSelfMysql()); + $awardService->addHero($item['item_id'],$lastIdx); + } + $propertyService->addHeroChg(); + $propertyService->addUserChg(); + } + break; + case mt\Item::HERO_SKIN_TYPE: + { + HeroSkin::addSkin($itemMeta); + $propertyService->addHeroSkinChg(); + } + break; + case mt\Item::HEAD_TYPE: + { + array_push($heads, $itemMeta['id']); + $propertyService->addUserChg(); + } + break; + case mt\Item::HEAD_FRAME_TYPE: + { + array_push($headFrames, $itemMeta['id']); + $propertyService->addUserChg(); + } + break; + case mt\Item::GUN_TYPE: + { + Gun::addGun($itemMeta); + $propertyService->addGunChg(); + } + break; + case mt\Item::GUN_SKIN_TYPE: + { + GunSkin::addSkin($itemMeta['id']); + $propertyService->addGunSkinChg(); + } + break; + case mt\Item::FRAGMENT_BOX_TYPE: + { + Bag::addItem($item['item_id'], $item['item_num']); + $propertyService->addBagChg(); + } + break; + case mt\Item::RING_TYPE: + { + UserSeasonRing::addRing($itemMeta); + $propertyService->addUserChg(); + } + break; + case mt\Item::PARACHUTE_TYPE: + { + Parachute::addParachute($itemMeta); + $propertyService->addUserChg(); + } + break; + case mt\Item::CHIP_TYPE: + { + Chip::addChip($itemMeta); + $propertyService->addChip(); + } + break; + case mt\Item::RANDOM_BOX_TYPE: + { + $this->_openRandomBox($itemMeta,$awardService,$propertyService); + } + break; + case mt\Item::AVATAR_TYPE: + { + Avatar::addAvatar($itemMeta); + } + break; + default: + { + $this->_addLog('additems', 'invalid_item', array( + 'param1' => $item['item_id'], + 'param2' => $item['item_num'], + )); + } + break; + } + } + + } + } + } + }//end foreach + if (!empty($heads) || !empty($headFrames)) { + $userInfo = $this->_getOrmUserInfo(); + $headsDb = emptyReplace(json_decode($userInfo['head_list'], true), array()); + $headFramesDb = emptyReplace(json_decode($userInfo['head_frame_list'], true), array()); + $heads = array_unique(array_merge($heads, $headsDb)); + $headFrames = array_values(array_unique(array_merge($headFrames, $headFramesDb))); + $this->_updateUserInfo(array( + 'head_list' => json_encode($heads), + 'head_frame_list' => json_encode($headFrames), + )); + } + } + + public function _openRandomBox($itemMeta,$awardService,$propertyService){ + if ($itemMeta['include_item_id']) { + $includeItemIds = explode('|', $itemMeta['include_item_id']); + $key = array_rand($includeItemIds,1); + + $items = array( + array( + 'item_id' => $includeItemIds[$key] , + 'item_num' => 1 + ) + ); + $this->_addItems($items,$awardService,$propertyService); + } + } + + public function _addTryUsingItems($items) + { + foreach ($items as $item) { + Bag::addTryUsingItem($item['item_id'], $item['item_num'], $item['try_using_time']); + } + } + + public function _decItems($items) + { + foreach ($items as $item) { + //道具消耗埋点 + LogService::consumeItem($item); + if ($this->_isVirtualItem($item['item_id'])) { + $this->_decVirtualItem($item['item_id'], $item['item_num']); + } else { + Bag::decItem($item['item_id'], $item['item_num']); + } + } + } + + public function _hasEnoughItems($items, &$lackItem) + { + $userInfo = $this->_getUserInfo(array( + 'gold', + 'diamond', + )); + foreach ($items as $item) { + $inventory = $this->_getItemCount($item['item_id'], $userInfo); + if ($inventory < $item['item_num']) { + $lackItem = array( + 'item_id' => $item['item_id'], + 'item_num' => $item['item_num'], + 'inventory' => $inventory + ); + return false; + } + } + return true; + } + + public function _getLackItemErrMsg($lackItem) + { + if (!$lackItem) { + return 'Not enough item'; + } + $itemMeta = mt\Item::get($lackItem['item_id']); + if (!$itemMeta) { + return 'Not enough item'; + } + if (SERVER_ENV != _ONLINE) { + return "${itemMeta['name']} Not enough stock:${lackItem['inventory']} need:${lackItem['item_num']}"; + } else { + return "${itemMeta['name']} Not enough"; + } + } + + public function _scatterDrop($dropSource, $dropMeta, $awardService, $propertyService) + { + $itemIds = explode('|', $dropMeta['item_id']); + $nums = explode('|', $dropMeta['num']); + $weights = explode('|', $dropMeta['weight']); + if (count($itemIds) != count($nums) || + count($itemIds) != count($weights)) { + return; + } + $totalWeight = 0; + foreach ($weights as $weight) { + $totalWeight += $weight; + } + $addItems = array(); + if ($dropMeta['type'] == 1) { + //N out of n + for ($i = 0; $i < count($itemIds); ++$i) { + $itemId = $itemIds[$i]; + $num = $nums[$i]; + $weight = $weights[$i]; + if ((rand() % 10000) < $weight) { + array_push($addItems, array( + 'item_id' => $itemId, + 'item_num' => $num + )); + } + } + }else if ($dropMeta['type'] == 2 && $totalWeight > 0) { + //1 out of n + $currWeight = 0; + $rnd = rand() % $totalWeight; + for ($i = 0; $i < count($itemIds); ++$i) { + $itemId = $itemIds[$i]; + $num = $nums[$i]; + $currWeight += $weights[$i]; + if ($currWeight > $rnd) { + array_push($addItems, array( + 'item_id' => $itemId, + 'item_num' => $num + )); + break; + } + } + } + if (count($addItems) > 0) { + $this->_addItems($addItems, $awardService, $propertyService); + } + SqlHelper::insert( + myself()->_getSelfMysql(), + 't_drop_log', + array( + 'account_id' => myself()->_getAccountId(), + 'drop_source' => $dropSource, + 'drop_id' => $dropMeta['drop_id'], + 'drop_items' => json_encode($addItems), + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) + ); + } + + public function _addLog($type, $subtype, $params) + { + $fieldsKv = array( + 'account_id' => $this->_getAccountId(), + 'type' => $type, + 'subtype' => $subtype, + 'param1' => getXVal($params, 'param1', ''), + 'param2' => getXVal($params, 'param2', ''), + 'param3' => getXVal($params, 'param3', ''), + 'param4' => getXVal($params, 'param4', ''), + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ); + SqlHelper::insert( + myself()->_getSelfMysql(), + 't_game_log', + $fieldsKv + ); + } + + public function _getV($x, $y, $defVal = 0) + { + return DynData::getV($x, $y, $defVal); + } + + public function _setV($x, $y, $val) + { + DynData::setV($x, $y, $val); + } + + public function _incV($x, $y, $incVal) + { + DynData::incV($x, $y, $incVal); + } + + public function _decV($x, $y, $decVal) + { + DynData::decV($x, $y, $decVal); + } + + public function _getDailyV($x, $y, $defVal = 0) + { + return DynData::getDailyV($x, $y, $defVal); + } + + public function _setDailyV($x, $y, $val) + { + DynData::setDailyV($x, $y, $val); + } + + public function _incDailyV($x, $y, $incVal) + { + DynData::incDailyV($x, $y, $incVal); + } + + public function _decDailyV($x, $y, $decVal) + { + DynData::decDailyV($x, $y, $decVal); + } + + public function _getWeeklyV($x, $y, $defVal = 0) + { + return DynData::getWeeklyV($x, $y, $defVal); + } + + public function _setWeeklyV($x, $y, $val) + { + DynData::setWeeklyV($x, $y, $val); + } + + public function _incWeeklyV($x, $y, $incVal) + { + DynData::incWeeklyV($x, $y, $incVal); + } + + public function _decWeeklyV($x, $y, $decVal) + { + DynData::decWeeklyV($x, $y, $decVal); + } + +} diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 30abcbf6..c5cbc687 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -12,6 +12,7 @@ require_once('models/User.php'); require_once('models/Parachute.php'); require_once('models/ChipPage.php'); require_once('models/Battle.php'); +require_once('models/HashRateTask.php'); require_once('services/BattleDataService.php'); require_once('services/TameBattleDataService.php'); require_once('services/FormulaService.php'); @@ -29,6 +30,7 @@ use models\User; use models\Parachute; use models\ChipPage; use models\Battle; +use models\HashRateTask; class BattleController extends BaseAuthedController { @@ -124,6 +126,7 @@ class BattleController extends BaseAuthedController { // $ranked = getReqVal('pvp_personal_rank', 0); $teamBattleDataService = new services\TameBattleDataService(); $teamBattleDataService->calStarNum(); + HashRateTask::setRankedData(); } public function teamReport() diff --git a/webapp/controller/ComputingPowerController.class.php b/webapp/controller/ComputingPowerController.class.php index 708210fe..6f38e2cc 100644 --- a/webapp/controller/ComputingPowerController.class.php +++ b/webapp/controller/ComputingPowerController.class.php @@ -1,387 +1,468 @@ - 0, - "period_end" => 0, - "await_time" => 0, - "assignable_cec" => 0, - "cec_pool" => 0, - "total_exchange_hash_rate" => 0, - "total_hash_rate" => 0, - - ); - $reward = array( - "cec" => 0, - "point" => 0, - ); - $last_period = array( - "period_begin" => 0, - "period_end" => 0, - "reward" => 0, - ); - - $lastMeta = \mt\HashRateCommon::getLastPeriod(); - $currentMeta = \mt\HashRateCommon::getCurrentPeriod(); - $nextMeta = \mt\HashRateCommon::getNextPeriod(); - if (!$currentMeta && $lastMeta){ - $ownerNum = ComputingPower::getOwnedBH($lastMeta['id']); - $totalNum = ComputingPower::getTotalBH($lastMeta['id']); - $target = \services\NumberService::ceilEx(min($totalNum / $lastMeta['cec_pool'] , 1),6); - if ($totalNum == 0) { - $ratio = 0; - }else{ - $ratio = $ownerNum/$totalNum; - } - $reward['cec'] = \services\NumberService::ceilEx($currentMeta['cec_pool'] * $target * $ratio,2); - if ($nextMeta){ - $period_state = 1; - $curr_period['period_begin'] = strtotime($nextMeta['start_time']); - $curr_period['period_end'] = strtotime($nextMeta['end_time']); - $curr_period['await_time'] = strtotime($nextMeta['start_time']) - myself()->_getNowTime(); - }else{ - $period_state = 2; - } - } - if ($currentMeta){ - $period_state = 0; - $ownerNum = ComputingPower::getOwnedBH($currentMeta['id']); - $totalNum = ComputingPower::getTotalBH($currentMeta['id']); - $curr_period['period_begin'] = strtotime($currentMeta['start_time']); - $curr_period['period_end'] = strtotime($currentMeta['end_time']); - $curr_period['assignable_cec'] = min($currentMeta['cec_pool'],$totalNum); - $curr_period['cec_pool'] = $currentMeta['cec_pool']; - $curr_period['total_exchange_hash_rate'] = $ownerNum; - $curr_period['total_hash_rate'] = $totalNum; - $curr_period['await_time'] = strtotime($currentMeta['end_time']) - myself()->_getNowTime(); - - $target = \services\NumberService::ceilEx(min($totalNum / $currentMeta['cec_pool'] , 1),6); - if ($totalNum == 0) { - $ratio = 0; - }else{ - $ratio = $ownerNum/$totalNum; - } - $reward['cec'] = \services\NumberService::ceilEx($currentMeta['cec_pool'] * $target * $ratio,2); - $reward['point'] = $ownerNum; - } - - if ($lastMeta){ - $last_period['period_begin'] = strtotime($lastMeta['start_time']); - $last_period['period_end'] = strtotime($lastMeta['end_time']); - $cecDb = RewardsCec::findByAccount(myself()->_getAccountId(),$lastMeta['id']); - $last_period['reward'] = $cecDb ? $cecDb['reward_cec'] : 0; - $last_period['last_hash_rate'] = ComputingPower::getOwnedBH($lastMeta['id']); - } - - - - - $info = array( - 'period_state' => $period_state, - 'curr_period' => $curr_period, - 'curr_reward' => $reward, - 'last_period' => $last_period, - 'listing_state' => LISTING_SWITCH, - 'owned_cec' => RewardsCec::getTotalCecNum(), - 'owned_total_hash_rate' =>ComputingPower::getMyTotalBH(), - ); - $this->_rspData(array( - 'info' => $info - )); - } - - public function getCrystalUi(){ - $crystalList = array(); - $itemMetas = \mt\Item::getMetaListByType(\mt\Item::CRYSTAL_TYPE); - $hashRateService = new \services\HashRateService(); - foreach ($itemMetas as $meta){ - $crystalDto = array(); - $hashRateService->getCrystalDto($meta,$crystalDto); - array_push($crystalList,$crystalDto); - } - $this->_rspData(array( - 'data' => $crystalList - )); - } - - public function exchangeCrystal(){ - $itemId = getReqVal('item_id', 0); - $itemMeta = \mt\Item::get($itemId); - if (!$itemMeta || $itemMeta['type'] != \mt\Item::CRYSTAL_TYPE ){ - $this->_rspErr(1, 'param error'); - return ; - } - $hashRateMeta = HashRate::findHash($itemId); - if (!$hashRateMeta){ - $this->_rspErr(1, 'param error'); - return ; - } - $param = explode('|',$hashRateMeta['parameter']); - $paramEd = explode(':',$param[0]); - $paramEx = explode(':',$param[1]); - $crystalNum = 0; - switch ($itemId){ - case ComputingPower::CRYSTAL1 : { - $killsNum = myself()->_getV(TN_TOTAL_KILLS_NUM,0); - $killsNumEd = myself()->_getV(TN_TOTAL_KILLS_NUM,-1); - $killsNumEx = $killsNum - $killsNumEd; - $starNum = myself()->_getV(TN_TOTAL_STAR_NUM,0); - $starNumEd = myself()->_getV(TN_TOTAL_STAR_NUM,-1); - $starNumEx = $starNum - $starNumEd ; - $crystalNum = max(0,floor($killsNumEx / $paramEd[0]) * $paramEd[1] + - floor($starNumEx / $paramEx[0]) * $paramEx[1] ); - } - break; - case ComputingPower::CRYSTAL2 : { - $consumeCost = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,0); - $consumeCostEd = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,-1); - $consumeCostEx = $consumeCost - $consumeCostEd ; - $crystalNum = max(0,floor($consumeCostEx / \services\HashRateService::EXCHANGE_RATE / $paramEd[0]) * $paramEd[1]); - } - break; - case ComputingPower::CRYSTAL3 : { - $consumeCost = myself()->_getV(TN_TOTAL_CEG_CONSUME,0); - $consumeCostEd = myself()->_getV(TN_TOTAL_CEG_CONSUME,-1); - $consumeCostEx = $consumeCost - $consumeCostEd; - $crystalNum = max(0,floor($consumeCostEx / \services\HashRateService::EXCHANGE_RATE / $paramEd[0]) * $paramEd[1]); - } - break; - case ComputingPower::CRYSTAL4 : { - $recordDb = CrystalRecord::getNewestRecordOne($itemId); - error_log('exchangeCrystal:'.json_encode($recordDb)); - if ($recordDb && myself()->_getNowDaySeconds() == myself()->_getDaySeconds($recordDb['createtime'])){ - $this->_rspErr(1, 'There are no available crystals'); - return ; - } -// $rate = Parameter::getVal('cec_exchange_rate',10); - $cecVal = Staking::getStakingTotalValue(); - $crystalNum = max(0,floor($cecVal / $paramEd[0]) * $paramEd[1]); - - } - } - - if ($crystalNum < 1){ - $this->_rspErr(1, 'There are no available crystals'); - return ; - } - - - - $items = array( - array( - 'item_id' => $itemId, - 'item_num' => $crystalNum, - ) - ); - $propertyChgService = new services\PropertyChgService(); - $awardService = new services\AwardService(); - $this->_addItems($items,$awardService,$propertyChgService); - CrystalRecord::addCrystalRecord($itemId,$crystalNum); - switch ($itemId) { - case ComputingPower::CRYSTAL1 : { - - $killsNum = myself()->_getV(TN_TOTAL_KILLS_NUM,0); - $killsNumEd = myself()->_getV(TN_TOTAL_KILLS_NUM,-1); - $starNum = myself()->_getV(TN_TOTAL_STAR_NUM,0); - $starNumEd = myself()->_getV(TN_TOTAL_STAR_NUM,-1); - //floor($killsNumEx / $paramEd[0]) * $paramEd[1] 222 100:3 222/100=2 2*3=6 6/3=2 2*100 - $newKillsNum = floor(($killsNum-$killsNumEd)/$paramEd[0]) * $paramEd[0]; - myself()->_incV(TN_TOTAL_KILLS_NUM,-1,$newKillsNum); - $newStarNum = floor(($starNum-$starNumEd)/$paramEx[0]) * $paramEx[0]; - myself()->_incV(TN_TOTAL_STAR_NUM,-1,$newStarNum); - } - break; - case ComputingPower::CRYSTAL2 : { - myself()->_incV(TN_TOTAL_DIAMOND_CONSUME,-1,$crystalNum / $paramEd[1] * $paramEd[0] * \services\HashRateService::EXCHANGE_RATE); - } - break; - case ComputingPower::CRYSTAL3 : { - myself()->_incV(TN_TOTAL_CEG_CONSUME,-1,$crystalNum / $paramEd[1] * $paramEd[0] * \services\HashRateService::EXCHANGE_RATE); - } - break; - } - $this->_rspData(array( - 'award' => $awardService->toDto(), - 'property_chg' => $propertyChgService->toDto(), - )); - } - - public function getExchangeCrystalRecord(){ - $crystalRecordList = array(); - CrystalRecord::getCrystalRecordList(function ($row) use (&$crystalRecordList) { - array_push($crystalRecordList,array( - 'item_id' => $row['item_id'], - 'item_num' => $row['item_num'], - 'createtime' => $row['createtime'], - )); - }); - $this->_rspData(array( - 'data' => $crystalRecordList, - )); - } - - public function exchangeUplimit(){ - $currentMeta = \mt\HashRateCommon::getCurrentPeriod(); - if (!$currentMeta){ - $this->_rspErr(1, 'kindly await'); - return ; - } - $list = ComputingPower::findByPeriod($currentMeta['id']); - $this->_rspData(array( - 'data' => $list, - )); - } - - public function exchangePower(){ - $num1 = getReqVal('num1', 0); - $num2 = getReqVal('num2', 0); - $num3 = getReqVal('num3', 0); - $num4 = getReqVal('num4', 0); - $currentMeta = \mt\HashRateCommon::getCurrentPeriod(); - if (!$currentMeta){ - $this->_rspErr(1, 'kindly await'); - return ; - } - if (!$num1 && !$num2 && !$num3 && !$num4 ){ - $this->_rspErr(1, 'exchange none'); - return ; - } - $BH = 0 ; - $costItems = array(); - if ($num1 > 0){ - $meta = \mt\HashRate::findHash(ComputingPower::CRYSTAL1); - $this->_verificationCeiling($currentMeta['id'],$meta,$num1,$num2,$num3,$num4); - $BH += $num1 * $meta['amount_bh']; - array_push($costItems,array( - 'item_id' => ComputingPower::CRYSTAL1, - 'item_num' => $num1 - )); - } - if ($num2 > 0){ - $meta = \mt\HashRate::findHash(ComputingPower::CRYSTAL2); - $this->_verificationCeiling($currentMeta['id'],$meta,$num1,$num2,$num3,$num4); - $BH += $num2 * $meta['amount_bh']; - array_push($costItems,array( - 'item_id' => ComputingPower::CRYSTAL2, - 'item_num' => $num2 - )); - } - if ($num3 > 0){ - $meta = \mt\HashRate::findHash(ComputingPower::CRYSTAL3); - $this->_verificationCeiling($currentMeta['id'],$meta,$num1,$num2,$num3,$num4); - $BH += $num3 * $meta['amount_bh']; - array_push($costItems,array( - 'item_id' => ComputingPower::CRYSTAL3, - 'item_num' => $num3 - )); - } - if ($num4 > 0){ - $meta = \mt\HashRate::findHash(ComputingPower::CRYSTAL4); - $this->_verificationCeiling($currentMeta['id'],$meta,$num1,$num2,$num3,$num4); - $BH += $num4 * $meta['amount_bh']; - array_push($costItems,array( - 'item_id' => ComputingPower::CRYSTAL4, - 'item_num' => $num4 - )); - } - $lackItem = null; - if (!$this->_hasEnoughItems($costItems, $lackItem)) { - $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); - return; - } - $this->_decItems($costItems); - $propertyChgService = new services\PropertyChgService(); - $propertyChgService->addBagChg(); - ComputingPower::addPowerRecord( - array( - 'period' => $currentMeta['id'], - 'item_num1' => $num1, - 'item_num2' => $num2, - 'item_num3' => $num3, - 'item_num4' => $num4, - 'total_num' => $BH, - ) - ); - $this->_rspData(array( - 'property_chg' => $propertyChgService->toDto(), - )); - - } - - public function getRewardHistory(){ - $starTime = getReqVal('star_time', 0); - $endTime = getReqVal('end_time', 0); - $historyDb = RewardsCec::getHistoryByTime($starTime,$endTime); - $historyList = array(); - $pendingNum = 0; - foreach ($historyDb as $row){ - $historyDto = RewardsCec::toDto($row); - $pendingNum += $historyDto['pending_num']; - array_push($historyList,$historyDto); - } - $this->_rspData(array( - 'data' => $historyList, - 'pending_rewards' => strval($pendingNum), - )); - } - - private function _verificationCeiling($period,$meta,$num1,$num2,$num3,$num4){ - $list = ComputingPower::findByPeriod($period); - switch ($meta['item_id']){ - case ComputingPower::CRYSTAL1 : { - if ($list['num1'] + $num1 > $meta['week_max']){ - $this->_rspErr(1, 'Micro crystal exchange ceiling'); - die ; - } - } - break; - case ComputingPower::CRYSTAL2 : { - if ($list['num2'] + $num2 > $meta['week_max']){ - $this->_rspErr(1, 'Standard crystal exchange ceiling'); - die ; - } - } - break; - case ComputingPower::CRYSTAL3 : { - if ($list['num3'] + $num3 > $meta['week_max']){ - $this->_rspErr(1, 'Large crystal exchange ceiling'); - die ; - } - } - break; - case ComputingPower::CRYSTAL4 : { - if ($list['num4'] + $num4 > $meta['week_max']){ - $this->_rspErr(1, 'Giant crystal exchange ceiling'); - die ; - } - } - break; - } - } - - - + 0, + "period_end" => 0, + "await_time" => 0, + "assignable_cec" => 0, + "cec_pool" => 0, + "total_exchange_hash_rate" => 0, + "total_hash_rate" => 0, + + ); + $reward = array( + "cec" => 0, + "point" => 0, + ); + $last_period = array( + "period_begin" => 0, + "period_end" => 0, + "reward" => 0, + ); + + $lastMeta = \mt\HashRateCommon::getLastPeriod(); + $currentMeta = \mt\HashRateCommon::getCurrentPeriod(); + $nextMeta = \mt\HashRateCommon::getNextPeriod(); + if (!$currentMeta && $lastMeta){ + $ownerNum = ComputingPower::getOwnedBH($lastMeta['id']); + $totalNum = ComputingPower::getTotalBH($lastMeta['id']); + $target = \services\NumberService::ceilEx(min($totalNum / $lastMeta['cec_pool'] , 1),6); + if ($totalNum == 0) { + $ratio = 0; + }else{ + $ratio = $ownerNum/$totalNum; + } + $reward['cec'] = \services\NumberService::ceilEx($currentMeta['cec_pool'] * $target * $ratio,2); + if ($nextMeta){ + $period_state = 1; + $curr_period['period_begin'] = strtotime($nextMeta['start_time']); + $curr_period['period_end'] = strtotime($nextMeta['end_time']); + $curr_period['await_time'] = strtotime($nextMeta['start_time']) - myself()->_getNowTime(); + }else{ + $period_state = 2; + } + } + if ($currentMeta){ + $period_state = 0; + $ownerNum = ComputingPower::getOwnedBH($currentMeta['id']); + $totalNum = ComputingPower::getTotalBH($currentMeta['id']); + $curr_period['period_begin'] = strtotime($currentMeta['start_time']); + $curr_period['period_end'] = strtotime($currentMeta['end_time']); + $curr_period['assignable_cec'] = min($currentMeta['cec_pool'],$totalNum); + $curr_period['cec_pool'] = $currentMeta['cec_pool']; + $curr_period['total_exchange_hash_rate'] = $ownerNum; + $curr_period['total_hash_rate'] = $totalNum; + $curr_period['await_time'] = strtotime($currentMeta['end_time']) - myself()->_getNowTime(); + + $target = \services\NumberService::ceilEx(min($totalNum / $currentMeta['cec_pool'] , 1),6); + if ($totalNum == 0) { + $ratio = 0; + }else{ + $ratio = $ownerNum/$totalNum; + } + $reward['cec'] = \services\NumberService::ceilEx($currentMeta['cec_pool'] * $target * $ratio,2); + $reward['point'] = $ownerNum; + } + + if ($lastMeta){ + $last_period['period_begin'] = strtotime($lastMeta['start_time']); + $last_period['period_end'] = strtotime($lastMeta['end_time']); + $cecDb = RewardsCec::findByAccount(myself()->_getAccountId(),$lastMeta['id']); + $last_period['reward'] = $cecDb ? $cecDb['reward_cec'] : 0; + $last_period['last_hash_rate'] = ComputingPower::getOwnedBH($lastMeta['id']); + } + + + + + $info = array( + 'period_state' => $period_state, + 'curr_period' => $curr_period, + 'curr_reward' => $reward, + 'last_period' => $last_period, + 'listing_state' => LISTING_SWITCH, + 'owned_cec' => RewardsCec::getTotalCecNum(), + 'owned_total_hash_rate' =>ComputingPower::getMyTotalBH(), + ); + $this->_rspData(array( + 'info' => $info + )); + } + + public function getCrystalUi(){ + $crystalList = array(); + $itemMetas = \mt\Item::getMetaListByType(\mt\Item::CRYSTAL_TYPE); + $hashRateService = new \services\HashRateService(); + foreach ($itemMetas as $meta){ + $crystalDto = array(); + $hashRateService->getCrystalDto($meta,$crystalDto); + array_push($crystalList,$crystalDto); + } + $this->_rspData(array( + 'data' => $crystalList + )); + } + + public function exchangeCrystal(){ + $itemId = getReqVal('item_id', 0); + $itemMeta = \mt\Item::get($itemId); + if (!$itemMeta || $itemMeta['type'] != \mt\Item::CRYSTAL_TYPE ){ + $this->_rspErr(1, 'param error'); + return ; + } + $hashRateMeta = HashRate::findHash($itemId); + if (!$hashRateMeta){ + $this->_rspErr(1, 'param error'); + return ; + } + $param = explode('|',$hashRateMeta['parameter']); + $paramEd = explode(':',$param[0]); + $paramEx = explode(':',$param[1]); + $crystalNum = 0; + switch ($itemId){ + case ComputingPower::CRYSTAL1 : { + $killsNum = myself()->_getV(TN_TOTAL_KILLS_NUM,0); + $killsNumEd = myself()->_getV(TN_TOTAL_KILLS_NUM,-1); + $killsNumEx = $killsNum - $killsNumEd; + $starNum = myself()->_getV(TN_TOTAL_STAR_NUM,0); + $starNumEd = myself()->_getV(TN_TOTAL_STAR_NUM,-1); + $starNumEx = $starNum - $starNumEd ; + $crystalNum = max(0,floor($killsNumEx / $paramEd[0]) * $paramEd[1] + + floor($starNumEx / $paramEx[0]) * $paramEx[1] ); + } + break; + case ComputingPower::CRYSTAL2 : { + $consumeCost = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,0); + $consumeCostEd = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,-1); + $consumeCostEx = $consumeCost - $consumeCostEd ; + $crystalNum = max(0,floor($consumeCostEx / \services\HashRateService::EXCHANGE_RATE / $paramEd[0]) * $paramEd[1]); + } + break; + case ComputingPower::CRYSTAL3 : { + $consumeCost = myself()->_getV(TN_TOTAL_CEG_CONSUME,0); + $consumeCostEd = myself()->_getV(TN_TOTAL_CEG_CONSUME,-1); + $consumeCostEx = $consumeCost - $consumeCostEd; + $crystalNum = max(0,floor($consumeCostEx / \services\HashRateService::EXCHANGE_RATE / $paramEd[0]) * $paramEd[1]); + } + break; + case ComputingPower::CRYSTAL4 : { + $recordDb = CrystalRecord::getNewestRecordOne($itemId); + error_log('exchangeCrystal:'.json_encode($recordDb)); + if ($recordDb && myself()->_getNowDaySeconds() == myself()->_getDaySeconds($recordDb['createtime'])){ + $this->_rspErr(1, 'There are no available crystals'); + return ; + } +// $rate = Parameter::getVal('cec_exchange_rate',10); + $cecVal = Staking::getStakingTotalValue(); + $crystalNum = max(0,floor($cecVal / $paramEd[0]) * $paramEd[1]); + + } + } + + if ($crystalNum < 1){ + $this->_rspErr(1, 'There are no available crystals'); + return ; + } + + + + $items = array( + array( + 'item_id' => $itemId, + 'item_num' => $crystalNum, + ) + ); + $propertyChgService = new services\PropertyChgService(); + $awardService = new services\AwardService(); + $this->_addItems($items,$awardService,$propertyChgService); + CrystalRecord::addCrystalRecord($itemId,$crystalNum); + switch ($itemId) { + case ComputingPower::CRYSTAL1 : { + + $killsNum = myself()->_getV(TN_TOTAL_KILLS_NUM,0); + $killsNumEd = myself()->_getV(TN_TOTAL_KILLS_NUM,-1); + $starNum = myself()->_getV(TN_TOTAL_STAR_NUM,0); + $starNumEd = myself()->_getV(TN_TOTAL_STAR_NUM,-1); + //floor($killsNumEx / $paramEd[0]) * $paramEd[1] 222 100:3 222/100=2 2*3=6 6/3=2 2*100 + $newKillsNum = floor(($killsNum-$killsNumEd)/$paramEd[0]) * $paramEd[0]; + myself()->_incV(TN_TOTAL_KILLS_NUM,-1,$newKillsNum); + $newStarNum = floor(($starNum-$starNumEd)/$paramEx[0]) * $paramEx[0]; + myself()->_incV(TN_TOTAL_STAR_NUM,-1,$newStarNum); + } + break; + case ComputingPower::CRYSTAL2 : { + myself()->_incV(TN_TOTAL_DIAMOND_CONSUME,-1,$crystalNum / $paramEd[1] * $paramEd[0] * \services\HashRateService::EXCHANGE_RATE); + } + break; + case ComputingPower::CRYSTAL3 : { + myself()->_incV(TN_TOTAL_CEG_CONSUME,-1,$crystalNum / $paramEd[1] * $paramEd[0] * \services\HashRateService::EXCHANGE_RATE); + } + break; + } + $this->_rspData(array( + 'award' => $awardService->toDto(), + 'property_chg' => $propertyChgService->toDto(), + )); + } + + public function getExchangeCrystalRecord(){ + $crystalRecordList = array(); + CrystalRecord::getCrystalRecordList(function ($row) use (&$crystalRecordList) { + array_push($crystalRecordList,array( + 'item_id' => $row['item_id'], + 'item_num' => $row['item_num'], + 'createtime' => $row['createtime'], + )); + }); + $this->_rspData(array( + 'data' => $crystalRecordList, + )); + } + + public function exchangeUplimit(){ + $currentMeta = \mt\HashRateCommon::getCurrentPeriod(); + if (!$currentMeta){ + $this->_rspErr(1, 'kindly await'); + return ; + } + $list = ComputingPower::findByPeriod($currentMeta['id']); + $this->_rspData(array( + 'data' => $list, + )); + } + + public function exchangePower(){ + $num1 = getReqVal('num1', 0); + $num2 = getReqVal('num2', 0); + $num3 = getReqVal('num3', 0); + $num4 = getReqVal('num4', 0); + $currentMeta = \mt\HashRateCommon::getCurrentPeriod(); + if (!$currentMeta){ + $this->_rspErr(1, 'kindly await'); + return ; + } + if (!$num1 && !$num2 && !$num3 && !$num4 ){ + $this->_rspErr(1, 'exchange none'); + return ; + } + $BH = 0 ; + $costItems = array(); + if ($num1 > 0){ + $meta = \mt\HashRate::findHash(ComputingPower::CRYSTAL1); + $this->_verificationCeiling($currentMeta['id'],$meta,$num1,$num2,$num3,$num4); + $BH += $num1 * $meta['amount_bh']; + array_push($costItems,array( + 'item_id' => ComputingPower::CRYSTAL1, + 'item_num' => $num1 + )); + } + if ($num2 > 0){ + $meta = \mt\HashRate::findHash(ComputingPower::CRYSTAL2); + $this->_verificationCeiling($currentMeta['id'],$meta,$num1,$num2,$num3,$num4); + $BH += $num2 * $meta['amount_bh']; + array_push($costItems,array( + 'item_id' => ComputingPower::CRYSTAL2, + 'item_num' => $num2 + )); + } + if ($num3 > 0){ + $meta = \mt\HashRate::findHash(ComputingPower::CRYSTAL3); + $this->_verificationCeiling($currentMeta['id'],$meta,$num1,$num2,$num3,$num4); + $BH += $num3 * $meta['amount_bh']; + array_push($costItems,array( + 'item_id' => ComputingPower::CRYSTAL3, + 'item_num' => $num3 + )); + } + if ($num4 > 0){ + $meta = \mt\HashRate::findHash(ComputingPower::CRYSTAL4); + $this->_verificationCeiling($currentMeta['id'],$meta,$num1,$num2,$num3,$num4); + $BH += $num4 * $meta['amount_bh']; + array_push($costItems,array( + 'item_id' => ComputingPower::CRYSTAL4, + 'item_num' => $num4 + )); + } + $lackItem = null; + if (!$this->_hasEnoughItems($costItems, $lackItem)) { + $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); + return; + } + $this->_decItems($costItems); + $propertyChgService = new services\PropertyChgService(); + $propertyChgService->addBagChg(); + ComputingPower::addPowerRecord( + array( + 'period' => $currentMeta['id'], + 'item_num1' => $num1, + 'item_num2' => $num2, + 'item_num3' => $num3, + 'item_num4' => $num4, + 'total_num' => $BH, + ) + ); + $this->_rspData(array( + 'property_chg' => $propertyChgService->toDto(), + )); + + } + + public function getRewardHistory(){ + $starTime = getReqVal('star_time', 0); + $endTime = getReqVal('end_time', 0); + $historyDb = RewardsCec::getHistoryByTime($starTime,$endTime); + $historyList = array(); + $pendingNum = 0; + foreach ($historyDb as $row){ + $historyDto = RewardsCec::toDto($row); + $pendingNum += $historyDto['pending_num']; + array_push($historyList,$historyDto); + } + $this->_rspData(array( + 'data' => $historyList, + 'pending_rewards' => strval($pendingNum), + )); + } + + public function exchangeUplimitNew(){ + $hashRateService = new \services\HashRateService(); + $crystalInfo = $hashRateService->getCrystalValue(); + $this->_rspData(array( + 'crystalInfo' => $crystalInfo + )); + } + + public function claimCrystal(){ + $hashRateService = new \services\HashRateService(); + $crystalInfo = $hashRateService->getCrystalValue(); + if ($crystalInfo['totalNum'] < 1){ + $this->_rspErr(1, 'No crystals available at this time'); + return ; + } + foreach ($crystalInfo['playing'] as $val){ + if ($val['chaim_num'] < 1){ + continue; + } + $hashRateMt = \mt\HashRateTask::find($val['task_id']); + switch ($val['task_id']){ + case HashRateTask::RANK_TYPE :{ + $chaimUpTotal = $val['chaim_num'] / $hashRateMt['reward']; + HashRateTask::updateKv($val['task_id'],array( + 'claim_total' => function () use($chaimUpTotal) { + return "claim_total + ${chaimUpTotal}"; + }, + 'modifytime' => myself()->_getNowTime() + )); + } + break; + default : { + + if ($val['task_id'] == HashRateTask::BATTLE_TIME_TYPE){ + $chaimTotal = $val['chaim_num'] / $hashRateMt['reward'] * $hashRateMt['target'] * 1000; + }else{ + $chaimTotal = $val['chaim_num'] / $hashRateMt['reward'] * $hashRateMt['target']; + } + HashRateTask::incDailyReward($val['task_id'],$val['chaim_num'],$chaimTotal); + } + } + } + foreach ($crystalInfo['staking'] as $val){ + if ($val['chaim_num'] > 0){ + HashRateTask::updateKv($val['task_id'],array( + 'claim_day' => 1, + 'modifytime' => myself()->_getNowTime() + )); + } + } + + foreach ($crystalInfo['consuming'] as $val){ + if ($val['chaim_num'] > 0){ + $hashRateMt = \mt\HashRateTask::find($val['task_id']); + $chaimTotal = $val['chaim_num'] / $hashRateMt['reward'] * $hashRateMt['target'] * \services\HashRateService::EXCHANGE_RATE; + myself()->_incV(TN_TOTAL_DIAMOND_CONSUME,-1,$chaimTotal); + } + } + $items = array( + array( + 'item_id' => ComputingPower::CRYSTAL_NEW, + 'item_num' => $crystalInfo['totalNum'], + ) + ); + $propertyChgService = new services\PropertyChgService(); + $awardService = new services\AwardService(); + $this->_addItems($items,$awardService,$propertyChgService); + CrystalRecord::addCrystalRecord(ComputingPower::CRYSTAL_NEW,$crystalInfo['totalNum']); + $this->_rspData(array( + 'award' => $awardService->toDto(), + 'property_chg' => $propertyChgService->toDto(), + )); + } + + private function _verificationCeiling($period,$meta,$num1,$num2,$num3,$num4){ + $list = ComputingPower::findByPeriod($period); + switch ($meta['item_id']){ + case ComputingPower::CRYSTAL1 : { + if ($list['num1'] + $num1 > $meta['week_max']){ + $this->_rspErr(1, 'Micro crystal exchange ceiling'); + die ; + } + } + break; + case ComputingPower::CRYSTAL2 : { + if ($list['num2'] + $num2 > $meta['week_max']){ + $this->_rspErr(1, 'Standard crystal exchange ceiling'); + die ; + } + } + break; + case ComputingPower::CRYSTAL3 : { + if ($list['num3'] + $num3 > $meta['week_max']){ + $this->_rspErr(1, 'Large crystal exchange ceiling'); + die ; + } + } + break; + case ComputingPower::CRYSTAL4 : { + if ($list['num4'] + $num4 > $meta['week_max']){ + $this->_rspErr(1, 'Giant crystal exchange ceiling'); + die ; + } + } + break; + } + } + + public function test(){ + print_r(\mt\HashRateTask::getMetaList()); + + } + + } \ No newline at end of file diff --git a/webapp/models/ComputingPower.php b/webapp/models/ComputingPower.php index 28930925..2813fcfe 100644 --- a/webapp/models/ComputingPower.php +++ b/webapp/models/ComputingPower.php @@ -1,137 +1,138 @@ -_getAccountId(); - } - $rows = SqlHelper::ormSelect( - myself()->_getMysql($account), - 't_power_exchange_record', - array( - 'account_id'=>$account, - 'period' => $period - ) - ); - $my_total_num = 0; - if ($rows){ - foreach ($rows as $row){ - $my_total_num += $row['total_num']; - } - } - - return NumberService::ceilEx($my_total_num,6); - } - - //获取全服总算力 - public static function getTotalBH($period){ - $rows = SqlHelper::select( - myself()->_getMysql(''), - 't_power_exchange_record', - array( - "period", - "total_num" - ), - array( - 'period' => $period - ) - ); - $total_num = 0; - if ($rows){ - foreach ($rows as $row){ - $total_num += $row['total_num']; - } - } - return $total_num; - } - - //获取我的总算力 - public static function getMyTotalBH(){ - $rows = SqlHelper::select( - myself()->_getSelfMysql(), - 't_power_exchange_record', - array( - "period", - "total_num" - ), - array( - 'account_id'=>myself()->_getAccountId(), - ) - ); - $total_num = 0; - if ($rows){ - foreach ($rows as $row){ - $total_num += $row['total_num']; - } - } - return $total_num; - } - - public static function findByPeriod($period){ - $rows = SqlHelper::ormSelect( - myself()->_getSelfMysql(), - 't_power_exchange_record', - array( - 'account_id'=>myself()->_getAccountId(), - 'period' => $period - ) - ); - $list = array( - 'num1' => 0, - 'num2' => 0, - 'num3' => 0, - 'num4' => 0, - ); - if ($rows){ - foreach ($rows as $row){ - $list['num1'] += $row['item_num1']; - $list['num2'] += $row['item_num2']; - $list['num3'] += $row['item_num3']; - $list['num4'] += $row['item_num4']; - } - } - return $list; - } - - public static function addPowerRecord($fieldKv){ - SqlHelper::insert( - myself()->_getSelfMysql(), - 't_power_exchange_record', - array( - 'account_id'=>myself()->_getAccountId(), - 'address'=>myself()->_getAddress(), - 'period'=>$fieldKv['period'], - 'item_num1'=>$fieldKv['item_num1'], - 'item_num2' => $fieldKv['item_num2'], - 'item_num3' => $fieldKv['item_num3'], - 'item_num4' => $fieldKv['item_num4'], - 'total_num' => $fieldKv['total_num'], - 'createtime'=>myself()->_getNowTime(), - 'modifytime'=>myself()->_getNowTime(), - ) - ); - } - - public static function getAccountGroup($period){ - $sql = "select account_id,`period` from t_power_exchange_record where `period` = $period group by account_id"; - $rows = myself()->_getMysql('')->execQuery($sql); - return $rows; - } - - +_getAccountId(); + } + $rows = SqlHelper::ormSelect( + myself()->_getMysql($account), + 't_power_exchange_record', + array( + 'account_id'=>$account, + 'period' => $period + ) + ); + $my_total_num = 0; + if ($rows){ + foreach ($rows as $row){ + $my_total_num += $row['total_num']; + } + } + + return NumberService::ceilEx($my_total_num,6); + } + + //获取全服总算力 + public static function getTotalBH($period){ + $rows = SqlHelper::select( + myself()->_getMysql(''), + 't_power_exchange_record', + array( + "period", + "total_num" + ), + array( + 'period' => $period + ) + ); + $total_num = 0; + if ($rows){ + foreach ($rows as $row){ + $total_num += $row['total_num']; + } + } + return $total_num; + } + + //获取我的总算力 + public static function getMyTotalBH(){ + $rows = SqlHelper::select( + myself()->_getSelfMysql(), + 't_power_exchange_record', + array( + "period", + "total_num" + ), + array( + 'account_id'=>myself()->_getAccountId(), + ) + ); + $total_num = 0; + if ($rows){ + foreach ($rows as $row){ + $total_num += $row['total_num']; + } + } + return $total_num; + } + + public static function findByPeriod($period){ + $rows = SqlHelper::ormSelect( + myself()->_getSelfMysql(), + 't_power_exchange_record', + array( + 'account_id'=>myself()->_getAccountId(), + 'period' => $period + ) + ); + $list = array( + 'num1' => 0, + 'num2' => 0, + 'num3' => 0, + 'num4' => 0, + ); + if ($rows){ + foreach ($rows as $row){ + $list['num1'] += $row['item_num1']; + $list['num2'] += $row['item_num2']; + $list['num3'] += $row['item_num3']; + $list['num4'] += $row['item_num4']; + } + } + return $list; + } + + public static function addPowerRecord($fieldKv){ + SqlHelper::insert( + myself()->_getSelfMysql(), + 't_power_exchange_record', + array( + 'account_id'=>myself()->_getAccountId(), + 'address'=>myself()->_getAddress(), + 'period'=>$fieldKv['period'], + 'item_num1'=>$fieldKv['item_num1'], + 'item_num2' => $fieldKv['item_num2'], + 'item_num3' => $fieldKv['item_num3'], + 'item_num4' => $fieldKv['item_num4'], + 'total_num' => $fieldKv['total_num'], + 'createtime'=>myself()->_getNowTime(), + 'modifytime'=>myself()->_getNowTime(), + ) + ); + } + + public static function getAccountGroup($period){ + $sql = "select account_id,`period` from t_power_exchange_record where `period` = $period group by account_id"; + $rows = myself()->_getMysql('')->execQuery($sql); + return $rows; + } + + } \ No newline at end of file diff --git a/webapp/models/HashRateTask.php b/webapp/models/HashRateTask.php new file mode 100644 index 00000000..25a5d41c --- /dev/null +++ b/webapp/models/HashRateTask.php @@ -0,0 +1,175 @@ +_getSelfMysql(), + 't_hash_rate_task', + array( + 'account_id' => myself()->_getAccountId(), + ) + ); + if (count($rows) < 1){ + $rows = array(); + } + return $rows; + } + + public static function toDto($row){ + array( + 'task_id' => $row['task_id'] + ); + } + + public static function findByTaskId($taskId){ + return SqlHelper::ormSelectOne( + myself()->_getSelfMysql(), + 't_hash_rate_task', + array( + 'account_id' => myself()->_getAccountId(), + 'task_id' => $taskId, + ) + ); + } + + public static function incRecordNum($taskId,$num){ + SqlHelper::upsert + (myself()->_getSelfMysql(), + 't_hash_rate_task', + array( + 'account_id' => myself()->_getAccountId(), + 'task_id' => $taskId, + ), + array( + 'record_total' => function () use($num) { + return "record_total + ${num}"; + }, + 'modifytime' => myself()->_getNowTime() + ), + array( + 'account_id' => myself()->_getAccountId(), + 'task_id' => $taskId, + 'record_total' => $num, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) + ); + } + + public static function getDailyReward($taskId){ + $row = SqlHelper::ormSelectOne( + myself()->_getSelfMysql(), + 't_hash_rate_task', + array( + 'account_id' => myself()->_getAccountId(), + 'task_id' => $taskId, + ) + ); + $modifytime = $row ? $row['modifytime'] : myself()->_getNowTime(); + $num = $row ? $row['claim_day'] : 0; + + if (myself()->_getDaySeconds($modifytime) < myself()->_getNowDaySeconds()) { + $num = 0; + } + return $num; + } + + public static function incDailyReward($taskId,$val,$total){ + $oldVal = self::getDailyReward($taskId); + $val += $oldVal; + SqlHelper::upsert + (myself()->_getSelfMysql(), + 't_hash_rate_task', + array( + 'account_id' => myself()->_getAccountId(), + 'task_id' => $taskId, + ), + array( + 'claim_day' => $val, + 'claim_total' => function () use($total) { + return "claim_total + ${total}"; + }, + 'modifytime' => myself()->_getNowTime() + ), + array( + 'account_id' => myself()->_getAccountId(), + 'task_id' => $taskId, + 'claim_day' => $val, + 'claim_total' => $total, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) + ); + } + + public static function updateKv($taskId,$fieldKv){ + SqlHelper::update + (myself()->_getSelfMysql(), + 't_hash_rate_task', + array( + 'account_id' => myself()->_getAccountId(), + 'task_id' => $taskId, + ), + $fieldKv + ); + } + + public static function setRankedData(){ + $SeasonMeta = RankSeason::getCurrentSeason(); + if (!$SeasonMeta){ + error_log("当前赛季结束"); + return; + } + if (! self::findByTaskIdOrSeason(self::RANK_TYPE,$SeasonMeta['id'])){ + $userDb = myself()->_safeGetOrmUserInfo(); + $rankMeta = Rank::getRankById($userDb['rank']); + SqlHelper::insert + (myself()->_getSelfMysql(), + 't_hash_rate_task', + array( + 'account_id' => myself()->_getAccountId(), + 'task_id' => self::RANK_TYPE, + 'season' => $SeasonMeta['id'], + 'record_total' => $rankMeta['rank_order2'], + 'claim_total' => $rankMeta['rank_order2'], + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) + ); + + } + + } + + public static function findByTaskIdOrSeason($taskId,$season){ + return SqlHelper::ormSelectOne( + myself()->_getSelfMysql(), + 't_hash_rate_task', + array( + 'account_id' => myself()->_getAccountId(), + 'task_id' => $taskId, + 'season' => $season, + ) + ); + } + + +} \ No newline at end of file diff --git a/webapp/mt/HashRateTask.php b/webapp/mt/HashRateTask.php new file mode 100644 index 00000000..816b0e40 --- /dev/null +++ b/webapp/mt/HashRateTask.php @@ -0,0 +1,40 @@ + $crystalMeta['id'], - 'pending' => 0, - 'total' => array(), - 'claimed' => 0, - 'state' => self::NONE_STATE, - ); - $hashRateMeta = HashRate::findHash($crystalMeta['id']); - $ownedNum = CrystalRecord::getCrystalNum($crystalMeta['id']); - $crystalDto['claimed'] = intval($ownedNum); - switch ($crystalMeta['sub_type']){ - case 1 : { - $param = explode('|',$hashRateMeta['parameter']); - $killsNum = myself()->_getV(TN_TOTAL_KILLS_NUM,0); - $killsNumEd = myself()->_getV(TN_TOTAL_KILLS_NUM,-1); - $starNum = myself()->_getV(TN_TOTAL_STAR_NUM,0); - $starNumEd = myself()->_getV(TN_TOTAL_STAR_NUM,-1); - $killsNumEx = $killsNum - $killsNumEd; - $starNumEx = $starNum - $starNumEd ; - $crystalDto['total'] = array( - 'param1' => floatval($killsNumEx), - 'param2' => floatval($starNumEx), - ); - $paramKill = explode(':',$param[0]); - $paramStar = explode(':',$param[1]); - $totalNum = max(0,floor($killsNumEx / $paramKill[0]) * $paramKill[1] + - floor($starNumEx / $paramStar[0]) * $paramStar[1] ); - $crystalDto['pending'] = intval($totalNum); - $crystalDto['state'] = $crystalDto['pending'] > 0 ? self::RECEIVED_STATE : self::NONE_STATE; - } - break; - case 2 : { - // 游戏内消费总价值 - $param = explode(':',$hashRateMeta['parameter']); - $consumeCost = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,0); - $consumeCostEd = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,-1); - $consumeCostEx = $consumeCost - $consumeCostEd ; - $crystalDto['total'] = array( - 'param1' => floatval($consumeCostEx / self::EXCHANGE_RATE), - ); - $totalNum = max(0,floor($consumeCostEx / self::EXCHANGE_RATE / $param[0]) * $param[1]); - $crystalDto['pending'] = intval($totalNum); - $crystalDto['state'] = $crystalDto['pending'] > 0 ? self::RECEIVED_STATE : self::NONE_STATE; - } - break; - case 3 : { - // Market交易总价值 - $param = explode(':',$hashRateMeta['parameter']); - $consumeCost = myself()->_getV(TN_TOTAL_CEG_CONSUME,0); - $consumeCostEd = myself()->_getV(TN_TOTAL_CEG_CONSUME,-1); - $consumeCostEx = $consumeCost - $consumeCostEd ; - $crystalDto['total'] = array( - 'param1' => floatval($consumeCostEx / self::EXCHANGE_RATE), - ); - $totalNum = max(0,floor($consumeCostEx / self::EXCHANGE_RATE / $param[0]) * $param[1]); - $crystalDto['pending'] = intval($totalNum); - $crystalDto['state'] = $crystalDto['pending'] > 0 ? self::RECEIVED_STATE : self::NONE_STATE; - } - break; - case 4 : { - // 质压总价值 - $param = explode(':',$hashRateMeta['parameter']); -// $rate = Parameter::getVal('cec_exchange_rate',10); - $cecVal = Staking::getStakingTotalValue(); - $crystalDto['total'] = array( - 'param1' => floatval($cecVal ), - ); - $recordDb = CrystalRecord::getNewestRecordOne($crystalMeta['id']); - if ($recordDb && myself()->_getNowDaySeconds() == myself()->_getDaySeconds($recordDb['createtime'])){ - $crystalDto['pending'] = 0; - }else{ - $totalNum = max(0,floor($cecVal / $param[0]) * $param[1]); - $crystalDto['pending'] = intval($totalNum); - } - $crystalDto['state'] = $crystalDto['pending'] > 0 ? self::RECEIVED_STATE : self::NONE_STATE; - } - break; - } - } - + $crystalMeta['id'], + 'pending' => 0, + 'total' => array(), + 'claimed' => 0, + 'state' => self::NONE_STATE, + ); + $hashRateMeta = HashRate::findHash($crystalMeta['id']); + $ownedNum = CrystalRecord::getCrystalNum($crystalMeta['id']); + $crystalDto['claimed'] = intval($ownedNum); + switch ($crystalMeta['sub_type']){ + case 1 : { + $param = explode('|',$hashRateMeta['parameter']); + $killsNum = myself()->_getV(TN_TOTAL_KILLS_NUM,0); + $killsNumEd = myself()->_getV(TN_TOTAL_KILLS_NUM,-1); + $starNum = myself()->_getV(TN_TOTAL_STAR_NUM,0); + $starNumEd = myself()->_getV(TN_TOTAL_STAR_NUM,-1); + $killsNumEx = $killsNum - $killsNumEd; + $starNumEx = $starNum - $starNumEd ; + $crystalDto['total'] = array( + 'param1' => floatval($killsNumEx), + 'param2' => floatval($starNumEx), + ); + $paramKill = explode(':',$param[0]); + $paramStar = explode(':',$param[1]); + $totalNum = max(0,floor($killsNumEx / $paramKill[0]) * $paramKill[1] + + floor($starNumEx / $paramStar[0]) * $paramStar[1] ); + $crystalDto['pending'] = intval($totalNum); + $crystalDto['state'] = $crystalDto['pending'] > 0 ? self::RECEIVED_STATE : self::NONE_STATE; + } + break; + case 2 : { + // 游戏内消费总价值 + $param = explode(':',$hashRateMeta['parameter']); + $consumeCost = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,0); + $consumeCostEd = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,-1); + $consumeCostEx = $consumeCost - $consumeCostEd ; + $crystalDto['total'] = array( + 'param1' => floatval($consumeCostEx / self::EXCHANGE_RATE), + ); + $totalNum = max(0,floor($consumeCostEx / self::EXCHANGE_RATE / $param[0]) * $param[1]); + $crystalDto['pending'] = intval($totalNum); + $crystalDto['state'] = $crystalDto['pending'] > 0 ? self::RECEIVED_STATE : self::NONE_STATE; + } + break; + case 3 : { + // Market交易总价值 + $param = explode(':',$hashRateMeta['parameter']); + $consumeCost = myself()->_getV(TN_TOTAL_CEG_CONSUME,0); + $consumeCostEd = myself()->_getV(TN_TOTAL_CEG_CONSUME,-1); + $consumeCostEx = $consumeCost - $consumeCostEd ; + $crystalDto['total'] = array( + 'param1' => floatval($consumeCostEx / self::EXCHANGE_RATE), + ); + $totalNum = max(0,floor($consumeCostEx / self::EXCHANGE_RATE / $param[0]) * $param[1]); + $crystalDto['pending'] = intval($totalNum); + $crystalDto['state'] = $crystalDto['pending'] > 0 ? self::RECEIVED_STATE : self::NONE_STATE; + } + break; + case 4 : { + // 质压总价值 + $param = explode(':',$hashRateMeta['parameter']); +// $rate = Parameter::getVal('cec_exchange_rate',10); + $cecVal = Staking::getStakingTotalValue(); + $crystalDto['total'] = array( + 'param1' => floatval($cecVal ), + ); + $recordDb = CrystalRecord::getNewestRecordOne($crystalMeta['id']); + if ($recordDb && myself()->_getNowDaySeconds() == myself()->_getDaySeconds($recordDb['createtime'])){ + $crystalDto['pending'] = 0; + }else{ + $totalNum = max(0,floor($cecVal / $param[0]) * $param[1]); + $crystalDto['pending'] = intval($totalNum); + } + $crystalDto['state'] = $crystalDto['pending'] > 0 ? self::RECEIVED_STATE : self::NONE_STATE; + } + break; + } + } + + public function getCrystalValue(){ + $chaimNum = 0; + $playing = array(); + $staking = array(); + $trading = array(); + $consuming = array(); + $nft = array(); +// $hashRateMt = \mt\HashRateTask::getListByType(\mt\HashRateTask::PLAYING); +// foreach ($hashRateMt as $meta){ +// $finalVal = 0; +// $uplimit = $meta['upperlimit'] ; +// if ($meta['id'] == HashRateTask::RANK_TYPE){ +// $seasonMeta = RankSeason::getCurrentSeason(); +// if (!$seasonMeta){ +// $seasonMeta = RankSeason::getLastSeason(); +// } +// $hashRateDb = HashRateTask::findByTaskIdOrSeason($meta['id'],$seasonMeta['id']); +// $userDb = myself()->_safeGetOrmUserInfo(); +// $rankMeta = Rank::getRankById($userDb['rank']); +// if ($rankMeta['rank_order2'] > $hashRateDb['record_total']){ +// $finalVal = ($rankMeta['rank_order2'] - $hashRateDb['claim_total']) * $meta['reward']; +// } +// } else { +// $hashRateDb = HashRateTask::findByTaskId($meta['id']); +// $targetVal = 0; +// if ($hashRateDb){ +// $total = $hashRateDb['record_total'] - $hashRateDb['claim_total']; +// if ($hashRateDb['task_id'] == HashRateTask::BATTLE_TIME_TYPE){ +// $targetVal = max(0,floor($total / 1000 / $meta['target'])) * $meta['reward']; +// }else{ +// $targetVal = max(0,floor($total / $meta['target'])) * $meta['reward']; +// } +// } +// +// +// $claim_day = HashRateTask::getDailyReward($meta['id']); +// $uplimit = $meta['upperlimit'] - $claim_day; +// $finalVal = min($targetVal , $uplimit); +// } +// $chaimNum += $finalVal; +// array_push($detail,array( +// 'task_id' => $meta['id'], +// 'uplimit' => $uplimit, +// 'chaim_num' => $finalVal +// )); +// } + $hashRateTask = \mt\HashRateTask::getMetaList(); + foreach ($hashRateTask as $metaTask){ + $finalVal = 0; + $uplimit = $metaTask['upperlimit'] ; + switch ($metaTask['type']){ + case \mt\HashRateTask::PLAYING :{ + if ($metaTask['id'] == HashRateTask::RANK_TYPE){ + $seasonMeta = RankSeason::getCurrentSeason(); + if (!$seasonMeta){ + $seasonMeta = RankSeason::getLastSeason(); + } + $hashRateDb = HashRateTask::findByTaskIdOrSeason($metaTask['id'],$seasonMeta['id']); + $userDb = myself()->_safeGetOrmUserInfo(); + $rankMeta = Rank::getRankById($userDb['rank']); + if ($rankMeta['rank_order2'] > $hashRateDb['record_total']){ + $finalVal = ($rankMeta['rank_order2'] - $hashRateDb['claim_total']) * $metaTask['reward']; + } + } else { + $hashRateDb = HashRateTask::findByTaskId($metaTask['id']); + $targetVal = 0; + if ($hashRateDb){ + $total = $hashRateDb['record_total'] - $hashRateDb['claim_total']; + if ($hashRateDb['task_id'] == HashRateTask::BATTLE_TIME_TYPE){ + $targetVal = max(0,floor($total / 1000 / $metaTask['target'])) * $metaTask['reward']; + }else{ + $targetVal = max(0,floor($total / $metaTask['target'])) * $metaTask['reward']; + } + } + + + $claim_day = HashRateTask::getDailyReward($metaTask['id']); + $uplimit = $metaTask['upperlimit'] - $claim_day; + $finalVal = min($targetVal , $uplimit); + } + $chaimNum += $finalVal; + array_push($playing,array( + 'task_id' => $metaTask['id'], + 'uplimit' => $uplimit, + 'chaim_num' => $finalVal + )); + } + break; + case \mt\HashRateTask::STAKING :{ + //质押价值 + $stakingVal = Staking::getStakingTotalValue(); + $targetVal = max(0,floor($stakingVal / $metaTask['target']) * $metaTask['reward']); + $claim_day = HashRateTask::getDailyReward($metaTask['id']); + if ($claim_day){ + $finalVal = 0; + }else{ + $finalVal = $targetVal; + } + $chaimNum += $finalVal; + array_push($staking,array( + 'task_id' => $metaTask['id'], + 'uplimit' => $uplimit, + 'chaim_num' => $finalVal + )); + } + break; +// case \mt\HashRateTask::TRADING : { +// $consumeCost = myself()->_getV(TN_TOTAL_CEG_CONSUME,0); +// $consumeCostEd = myself()->_getV(TN_TOTAL_CEG_CONSUME,-1); +// $total = $consumeCost - $consumeCostEd ; +// $finalVal = max(0,floor($total / self::EXCHANGE_RATE / $metaTask['target']) * $metaTask['reward']); +// $chaimNum += $finalVal; +// array_push($trading,array( +// 'task_id' => $metaTask['id'], +// 'uplimit' => $uplimit, +// 'chaim_num' => $finalVal +// )); +// } +// break; + case \mt\HashRateTask::CONSUMING : { + $consumeCost = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,0); + $consumeCostEd = myself()->_getV(TN_TOTAL_DIAMOND_CONSUME,-1); + $total = $consumeCost - $consumeCostEd; + $finalVal = max(0,floor($total / self::EXCHANGE_RATE / $metaTask['target']) * $metaTask['reward']); + $chaimNum += $finalVal; + array_push($consuming,array( + 'task_id' => $metaTask['id'], + 'uplimit' => $uplimit, + 'chaim_num' => $finalVal + )); + } + } + } + return array( + 'totalNum' => $chaimNum, + 'playing'=>$playing, + 'staking'=>$staking, + 'consuming'=>$consuming, + 'nft'=>$nft, + ); + } + + } \ No newline at end of file diff --git a/webapp/services/TameBattleDataService.php b/webapp/services/TameBattleDataService.php index 5bbfaedf..265e1e24 100644 --- a/webapp/services/TameBattleDataService.php +++ b/webapp/services/TameBattleDataService.php @@ -1,1226 +1,1245 @@ - array( - 'hero_uniid' => '', - 'gold_uplimit' => 0, - 'obtain_gold' => 0, - 'curr_gold' => 0, - ), - 'total_ceg' => 0, - 'items' => array(), - ); - private $teamReward = array(); - private $seasonDb = array(); - private $currSeasonMeta = null; - - public function updateBattleData() - { - error_log('updateBattleData'); - $matchMode = getXVal($this->allInfo,'room_mode', 0); - $userInfo = myself()->_getOrmUserInfo(); - if (!$userInfo){ - return false; - } - $this->userInfo = $userInfo; - $heroDb = Hero::find(getXVal($this->battleInfo,'hero_uniid', 0)); - if (!$heroDb) { - return false; - } - $this->heroDto = Hero::toDto($heroDb); - $heroMeta = mt\Hero::get($this->heroDto['hero_id']); - if (!$heroMeta) { - return false; - } - - //录入战斗记录 -// $this->saveBattleHistory(); - - switch ($matchMode) { - //PVP模式 - case self::ROOM_MODE_PVP: - { - $pvpMode = getXVal($this->allInfo,'pvp_match_mode', 0); - switch ($pvpMode){ - case self::MATCH_MODE_PVP: - { - //匹配赛模式 - $this->updatePvpData(); - $this->settlementReward(); - myself()->_incDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0, 1); - } - break; - case self::MATCH_MODE_RANK: - { - //排位赛 - $this->updatePvpData(); - $this->updateRankData(); - $this->updateScore(); - $this->settlementReward(); - myself()->_incDailyV(TN_DAILY_RANK_BATTLE_TIMES, 0, 1); - } - break; - default:{} - break; - } - - //记录战斗数据的排行榜 - $this->recordBattleRanking(); -// //结算用户star数量 -// $this->rewardStarNum(); - } - break; - //PVE模式 - case self::ROOM_MODE_PVE: - { - - //pve - $this->updatePveData(); - if ($this->pveGeminiMeta ) { - $this->rewardFragmentPve(); - } - myself()->_incDailyV(TN_DAILY_PVE_BATTLE_TIMES, 0, 1); - } - break; - default: - { - } - break; - } - - } - -// //每局战斗结算star数量 -// private function rewardStarNum(){ -// $paramMeta = mt\Parameter::getByName('star_get_num'); -// if ($paramMeta){ -// $star_get_num = getXVal($paramMeta,'param_value', 0); -// $num_arr = explode('|',$star_get_num); -// $rank = getXVal($this->battleInfo,'pvp_personal_rank', 0); -// if ($rank>count($num_arr) || $rank<1){ -// $finalNum = 0; -// }else{ -// $finalNum = $this->calFinalStarNum($num_arr[$rank-1]); -// } -// $items = array( -// array( -// 'item_id'=>V_ITEM_STAR, -// 'item_num'=>$finalNum -// ) -// );print_r($items); -// $propertyChgService = new services\PropertyChgService(); -// $awardService = new services\AwardService(); -//// myself()->_addItems($items, $awardService,$propertyChgService); -// myself()->_incDailyV(TN_DAILY_GET_STAR_NUM, 0,$finalNum); -// } -// } - - - - //记录战斗数据的排行榜 - private function recordBattleRanking(){ - $account = getXVal($this->battleInfo,'account_id', 0); - //游戏场次 (存活30S算有效场次) - if (getXVal($this->battleInfo,'pvp_survia_time', 0)/1000 > 30 && - getXVal($this->battleInfo,'abandon_battle', 0) == 0){ - RankBattle::upsert($account,RankBattle::GAME_TIMES,1); - } - //吃鸡数 //pvp_team_rank - if (getXVal($this->allInfo,'pvp_team_rank', 0) == 1){ - RankBattle::upsert($account,RankBattle::WIN_TIMES,1); - } - - //mvp - if (getXVal($this->battleInfo,'is_mvp', 0) == 1){ - RankBattle::upsert($account,RankBattle::MVP_TIMES,1); - } - - //前三 - if (getXVal($this->allInfo,'pvp_team_rank', 0) <= 3){ - RankBattle::upsert($account,RankBattle::TOP_THREE_TIMES,1); - } - - //击杀 - if (getXVal($this->battleInfo,'pvp_kill', 0) > 0){ - myself()->_incV(TN_TOTAL_KILLS_NUM, 0, getXVal($this->battleInfo,'pvp_kill', 0)); - RankBattle::upsert($account,RankBattle::KILL_TIMES,getXVal($this->battleInfo,'pvp_kill', 0)); - } - } - - private function updatePveData() - { - error_log('updatePveData'); - $instanceId = getXVal($this->allInfo,'pve_instance_id', 0); - $pveRankScore = getXVal($this->battleInfo,'pve_score', 0); - $pveBossKilled = getXVal($this->battleInfo,'pve_boss_killed', 0); - $userInfo = myself()->_getOrmUserInfo(); - $this->pveGeminiMeta = mt\PveGemini::get($instanceId); - if ($this->pveGeminiMeta) { - if (!( - ($instanceId == mt\PveGemini::FIRST_INSTANCE_ID && $userInfo['pve_instance_id'] == 0 ) || - $userInfo['pve_instance_id'] == $instanceId || - $userInfo['pve_instance_id'] + 1 == $instanceId) - ) { - $this->pveGeminiMeta = null; - } - } -// $this->pveGeminiModeMeta = mt\PveGeminiMode::get($instanceMode); -// if ($this->pveGeminiModeMeta) { -// $this->instanceRank = mt\PveGeminiMode::calcStar($this->pveGeminiModeMeta, $pveRankScore); -// } - if ($pveBossKilled == 1) { - if ($this->pveGeminiMeta) { - myself()->_updateUserInfo(array( - 'pve_instance_id' => $instanceId - )); - } - } - } - - private function rewardFragmentPve() - { - error_log('rewardFragmentPve'); - $bossReward = getXVal($this->battleInfo,'pve_boss_killed', 0) ? 1 : 0; - if ( !$bossReward) { - return; - } - $dropRate = $this->pveGeminiMeta['drop_rate']; - $todayPveGetHeroFragmentNum = myself()->_getDailyV(TN_DAILY_PVE_GET_HERO_FRAGMENT_NUM, 0); - $todayPveGetGunFragmentNum = myself()->_getDailyV(TN_DAILY_PVE_GET_GUN_FRAGMENT_NUM, 0); - $reward = array(); - if ($todayPveGetHeroFragmentNum < self::MAX_DROP_NUM) { - $gamesNum = FragmentRecord::getGamesNum(FragmentRecord::HERO_FRAGMENT); - $rate = $dropRate*($gamesNum+1); - if (rand(1,100) < $rate*100){ - $dropHeroFragmentId = $this->randWeight2(1); - $this->drop($reward,$dropHeroFragmentId,1); - FragmentRecord::upsertGamesNum(FragmentRecord::HERO_FRAGMENT,0); - }else{ - FragmentRecord::upsertGamesNum(FragmentRecord::HERO_FRAGMENT,$gamesNum+1); - } - - } - if ($todayPveGetGunFragmentNum < self::MAX_DROP_NUM) { - $gamesNum = FragmentRecord::getGamesNum(FragmentRecord::GUN_FRAGMENT); - $rate = $dropRate*($gamesNum+1); - if (rand(1,100) < $rate*100){ - $dropGunFragmentId = $this->randWeight2(2); - $this->drop($reward,$dropGunFragmentId,2); - FragmentRecord::upsertGamesNum(FragmentRecord::GUN_FRAGMENT,0); - }else{ - FragmentRecord::upsertGamesNum(FragmentRecord::GUN_FRAGMENT,$gamesNum+1); - } - - } - if ($reward){ - //记录获得得碎片奖励 - $battle_uuid = getXVal($this->allInfo,'battle_uuid', 0); - $room_uuid = getXVal($this->allInfo,'room_uuid', 0); - $db = BattleSettlement::findTeam($battle_uuid,$room_uuid); - if ($db){ - $data = emptyReplace(json_decode($db['data'], true), array()); - if ($data){ - foreach ($data['members'] as &$member){ - if ($member['account_id'] == myself()->_getAccountId()){ - $member['reward']['items'] = $reward; - } - } - } - BattleSettlement::addTeam($battle_uuid,$room_uuid,$data); - } - } - } - - private function randWeight2($type){ - $itemMeta = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE); - $heroFragment = array(); - $gunFragment = array(); - foreach ($itemMeta as $meta){ - if ($meta['sub_type'] == 3 || $meta['sub_type'] == 1){ - array_push($heroFragment,$meta['id']); - } - if ($meta['sub_type'] == 4 || $meta['sub_type'] == 2){ - array_push($gunFragment,$meta['id']); - } - } - $weightRate = array( - array(0,4), - array(1,12), - array(2,12), - array(3,12), - array(4,12), - array(5,12), - array(6,12), - array(7,12), - array(8,12), - ); - $weight = 0; - $tempData = array (); - foreach ($weightRate as $one) { - $weight += $one[1]; - for ($i = 0; $i < $one[1]; $i++) { - $tempData[] = $one; - - } - } - $key = $tempData[rand(0, $weight -1)][0]; - switch ($type){ - case 1:return $heroFragment[$key]; - case 2:return $gunFragment[$key]; - default:return null; - } - } - - private function drop(&$reward,$itemId,$type){ - $itemMeta = mt\Item::get($itemId); - if ($itemMeta){ - $propertyChgService = new services\PropertyChgService(); - $awardService = new services\AwardService(); - array_push($reward, - array( - 'item_id' => $itemId, - 'item_num' => 1 - )); - myself()->_addItems( - array( - array( - 'item_id' => $itemId, - 'item_num' => 1 - )), - $awardService, - $propertyChgService - ); - switch ($type){ - case 1:myself()->_incDailyV(TN_DAILY_PVE_GET_HERO_FRAGMENT_NUM, 0, 1);break; - case 2:myself()->_incDailyV(TN_DAILY_PVE_GET_GUN_FRAGMENT_NUM, 0, 1);break; - } - - } - - } - - - private function updatePvpData() - { - error_log('updatePvpData'); - $hisBattleData = Battle::getMyBattleData(); - if (!isset($hisBattleData['data'])) { - $hisBattleData['data'] = array( - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); - } - if (!isset($hisBattleData['today_data'])) { - $hisBattleData['today_data'] = array( - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); - } - if (!isset($hisBattleData['this_week_data'])) { - $hisBattleData['this_week_data'] = array( - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); - } - //上局游戏数据 - $hisBattleData['last_game_data'] = array( - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); - - - if (myself()->_getDaySeconds($hisBattleData['today_data']['modifytime']) < - myself()->_getNowDaySeconds()) { - $hisBattleData['today_data'] = array( - 'createtime' => $hisBattleData['today_data']['createtime'], - 'modifytime' => myself()->_getNowTime() - ); - } - if (myself()->_getDaySeconds($hisBattleData['this_week_data']['modifytime']) < - myself()->_getMondaySeconds()) { - $hisBattleData['this_week_data'] = array( - 'createtime' => $hisBattleData['this_week_data']['createtime'], - 'modifytime' => myself()->_getNowTime() - ); - } - $this->apply($hisBattleData['last_game_data']); - $this->apply($hisBattleData['today_data']); - $this->apply($hisBattleData['this_week_data']); - $oldDataKills = getXVal($hisBattleData['data'], 'total_kills_times', 0); - $this->apply($hisBattleData['data']); - $newDataKills = getXVal($hisBattleData['data'], 'total_kills_times', 0); - if ($newDataKills > $oldDataKills) { - Battle::update(array( - 'kills_modifytime' => myself()->_getNowTime(), - )); - } - Battle::add(json_encode($hisBattleData)); - } - - - - public function addBattleSettlementSingle() - { - error_log('BattleSettlementSingle'); - $pvp_mode = getXVal($this->allInfo,'pvp_match_mode', 0); - $battleUuid = getXVal($this->allInfo,'battle_uuid', 0); - $roomUuid = getXVal($this->allInfo,'room_uuid', 0); - - $newRank = $this->userInfo['rank']; - $newScore = $this->userInfo['score']; - $newElo = $this->userInfo['elo']; - - if ($pvp_mode == self::MATCH_MODE_RANK){ - myself()->_setV(TN_LAST_RANKING_TIME,0,getXVal($this->battleInfo,'game_time', 0)); - $winningPro = $this->celWinningPro($this->userInfo); - if ($winningPro){ - - $newElo = FormulaService::calcUserEloValue($this->userInfo,$this->battleInfo,$winningPro); //赛后elo积分 - $newScore = FormulaService::calcBattleAfterRankScore($this->userInfo,$this->battleInfo,$winningPro); //赛后排位积分 - //黄金以下段位,失败时不扣积分 - if ($newScore < $this->userInfo['score'] && $this->userInfo['score']< 1300){ - $newScore = $this->userInfo['score']; - } - mt\Rank::calcNewRankAndScore( $newRank, $newScore); - } - } - - $data = array( - "battle_uuid" => $battleUuid, - "account_id" => getXVal($this->battleInfo,'account_id', 0), - "room_mode" => getXVal($this->allInfo,'room_mode', 0), - "pvp_mode" => $pvp_mode, - "team_mode" => getXVal($this->allInfo,'team_mode', 0), - "battle_rank" => getXVal($this->battleInfo,'pvp_personal_rank', 0), - "team_rank" => getXVal($this->allInfo,'pvp_team_rank', 0), - "team_kills" => getXVal($this->allInfo,'pvp_team_kills', 0), - "is_win" => getXVal($this->battleInfo,'pve_boss_killed', 0), - "kills" => getXVal($this->battleInfo,'kills', 0), - "hero_id" => getXVal($this->battleInfo,'hero_uniid', 0), - "weapon1" => getXVal($this->battleInfo,'weapon_uuid1', 0), - "weapon2" => getXVal($this->battleInfo,'weapon_uuid2', 0), - "battle_end_time" => getXVal($this->battleInfo,'game_time', 0), - "current_level_class" => $newRank, - "current_level_class_score" => $newScore, - "level_class_score_chg" => $newScore - $this->userInfo['score'], // 排位分改变 - "pve_rank_score" => getXVal($this->battleInfo,'pve_score', 0), - "pve_kill_boss" => getXVal($this->battleInfo,'pve_boss_killed', 0), - "pve_instance_id" => getXVal($this->allInfo,'pve_instance_id', 0), -// "pve_instance_mode" => getXVal($this->allInfo,'pve_instance_mode', 0), - "old_elo" => $this->userInfo['elo'], - "new_elo" => $newElo, - ); - BattleSettlement::addSingle($battleUuid,$roomUuid,$data); - } - - public function addBattleSettlementTeam() - { - error_log('BattleSettlementTeam'); - $room_mode = getXVal($this->allInfo,'room_mode', 0); - switch ($room_mode){ - case self::ROOM_MODE_PVP: - { - $team_mode = getXVal($this->allInfo,'pvp_settelement_type', 0); - } - break; - case self::ROOM_MODE_PVE: - { - $team_mode = getXVal($this->allInfo,'pve_settelement_type', 0); - } - break; - default: - { - $team_mode = null; - } - break; - } - $data = array( - 'version'=> getXVal($this->allInfo,'version', 0), - 'team_id'=> getXVal($this->allInfo,'team_id', 0), - 'room_uuid'=> getXVal($this->allInfo,'room_uuid', 0), - 'room_mode'=> getXVal($this->allInfo,'room_mode', 0), - 'team_mode'=> $team_mode, - 'game_over'=>1, - 'victory'=> getXVal($this->allInfo,'victory', 0), - 'watchable'=> 1, - 'map_id'=> getXVal($this->allInfo,'map_id', 0), - 'battle_uuid'=> getXVal($this->allInfo,'battle_uuid', 0), - 'settlement_status'=>1, - 'pvp_settlement_type'=> getXVal($this->allInfo,'pvp_settelement_type', 0), - 'pvp_settlement_color'=> getXVal($this->allInfo,'pvp_settelement_color', 0), - 'pvp_team_rank'=> getXVal($this->allInfo,'pvp_team_rank', 0), - 'pvp_total_human_num'=> getXVal($this->allInfo,'pvp_total_human_num', 0), - 'pvp_alive_human_num'=> getXVal($this->allInfo,'pvp_alive_human_num', 0), - 'pvp_total_team_num'=> getXVal($this->allInfo,'pvp_total_team_num', 0), - 'pvp_match_mode'=> getXVal($this->allInfo,'pvp_match_mode', 0), - 'pve_settlement_color'=> getXVal($this->allInfo,'pve_settlement_color', 0), - 'pve_wave'=> getXVal($this->allInfo,'pve_wave', 0), - 'pve_max_wave'=> getXVal($this->allInfo,'pve_max_wave', 0), - 'pve_instance_id'=> getXVal($this->allInfo,'pve_instance_id', 0), - ); - - $data['members'] = array(); - $pvp_mode = getXVal($this->allInfo,'pvp_match_mode', 0); - foreach ($this->teamInfo as $info){ - $info['pvp_team_rank'] = getXVal($this->allInfo,'pvp_team_rank', 0); - $oldRank = 0; - $newRank = 0; - $oldScore = 0; - $newScore = 0; - $oldElo = 0; - $newElo = 0; - $userDb = User::find(getXVal($info,'account_id', 0)); - if ($userDb){ - $oldRank = $userDb['rank']; - $newRank = $userDb['rank']; - $oldScore = $userDb['score']; - $newScore = $userDb['score']; - $oldElo = $userDb['elo']; - $newElo = $userDb['elo']; - if ($pvp_mode == self::MATCH_MODE_RANK){ - $heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0)); - if ($heroDb){ - $winningPro = $this->celWinningPro($userDb); - if ($winningPro){ - $newElo = FormulaService::calcUserEloValue($userDb,$info,$winningPro); //赛后elo积分 - $newScore = FormulaService::calcBattleAfterRankScore($userDb,$info,$winningPro); //赛后排位积分 - //黄金以下段位,失败时不扣积分 - if ($newScore < $userDb['score'] && $userDb['score']< 1300){ - $newScore = $userDb['score']; - } - mt\Rank::calcNewRankAndScore( $newRank, $newScore); - } - } - - } - } - - $temp = array( - 'account_id'=> getXVal($info,'account_id', 0), - 'name'=> getXVal($info,'name', 0), - 'head'=> getXVal($info,'head', 0), - 'head_frame'=> getXVal($info,'head_frame', 0), - 'sex'=> getXVal($info,'sex', 0), - 'hero_uniid'=> getXVal($info,'hero_uniid', 0), - 'hero_id'=> getXVal($info,'hero_id', 0), - 'dead'=> getXVal($info,'dead', 0), - 'is_mvp'=> getXVal($info,'is_mvp', 0), - 'old_rank'=> $oldRank, - 'new_rank'=> $newRank, - 'old_score'=> $oldScore, - 'new_score'=> $newScore, - 'old_elo'=> $oldElo, - 'new_elo'=> $newElo, - 'pvp_kill'=> getXVal($info,'pvp_kill', 0), - 'pvp_damage'=> getXVal($info,'pvp_damage', 0), - 'pvp_assist'=> getXVal($info,'pvp_assist', 0), - 'pvp_survia_time'=> getXVal($info,'pvp_survia_time', 0), - 'pvp_recover'=> getXVal($info,'pvp_recover', 0), - 'pvp_rescue'=> getXVal($info,'pvp_rescue', 0), - 'pvp_personal_rank'=> getXVal($info,'pvp_personal_rank', 0), - 'pve_order'=> getXVal($info,'pve_order', 0), - 'pve_score'=> getXVal($info,'pve_score', 0), - 'pve_star'=> getXVal($info,'pve_star', 0), - 'pve_damage'=> getXVal($info,'pve_damage', 0), - 'pve_revive'=> getXVal($info,'pve_revive', 0), - 'pve_survia_time'=> getXVal($info,'pve_survia_time', 0), - 'pve_wave'=> getXVal($info,'pve_wave', 0), - 'pve_max_wave'=> getXVal($info,'pve_max_wave', 0), - 'pve_boss_killed'=> getXVal($info,'pve_boss_killed', 0), -// 'pve_rank_score'=> getXVal($info,'pve_rank_score', 0), - ); - - $temp['reward'] = array( - 'hero' => array( - 'hero_uniid' => '', - 'id' => '', - 'gold_uplimit' => 0, - 'obtain_gold' => 0, - 'curr_gold' => 0, - ), - 'items' => array(), - ); - - switch ($room_mode){ - case self::ROOM_MODE_PVP: - { - //pvp奖励 gold - if ($userDb){ - $this->calStarNum2($temp['reward'],getXVal($info,'pvp_personal_rank', 0),$userDb['account_id']); - $heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0)); - if (!$heroDb){ - break; - } - $heroDto = Hero::toDto($heroDb); - $temp['reward']['hero']['hero_uniid'] = $heroDto['hero_uniid']; - $temp['reward']['hero']['id'] = $heroDto['hero_id']; - $temp['reward']['hero']['gold_uplimit'] = $heroDto['gold_uplimit']; - $this->rewardGoldPvp($temp['reward'],$heroDto,$userDb['rank']); - - } - } - break; - case self::ROOM_MODE_PVE: - { - //pve 奖励碎片 -// print_r($data);die; - } - break; - default:{} - } - array_push($data['members'],$temp); - } - BattleSettlement::addTeam( - getXVal($this->allInfo,'battle_uuid', 0), - getXVal($this->allInfo,'room_uuid', 0), - $data - ); - } - - private function rewardGoldPvp(&$reward,$heroDto,$userRank) - { - $heroPvpGold = FormulaService::calcHeroPvpGold($heroDto, $this->allInfo,$userRank); - if ($heroPvpGold > 0) { - $heroPvpGold = Hero::gainGoldPvp($heroDto, $heroPvpGold); - $reward['hero']['curr_gold'] = '' . ($heroDto['current_get_gold'] + $heroPvpGold); - $reward['hero']['obtain_gold'] = '' . ($heroDto['current_get_gold'] + $heroPvpGold); - } - if ($heroPvpGold > 0) { - array_push($reward['items'],array( - 'item_id'=> V_ITEM_GOLD, - 'item_num'=>$heroPvpGold, - )); - } - } - - public function calStarNum(){ - $currStarMissionSeasonMeta = \mt\StarLevel::getCurrentSeason(); - if (!$currStarMissionSeasonMeta){ - return; - } - $battleData = Battle::getMyBattleData(); - $data = isset($battleData) ? getXVal($battleData, 'data', array()) : array(); - $battleTimes = getXVal($data, 'total_battle_times', 0); - $items = array(); - $totalNum = 0; - if ($battleTimes <= mt\Parameter::getVal('rookie_map_counts',10)){ - $totalNum = 10; - array_push($items,array( - 'item_id' => V_ITEM_STAR, - 'item_num' => 10 - )); - }else{ - $pvp_rank = getReqVal('pvp_personal_rank', 0); - $star_get_num = mt\Parameter::getVal('star_get_num',0); - $num_arr = explode('|',$star_get_num); - if ($pvp_rank>count($num_arr) || $pvp_rank<1){ - $finalNum = 0; - }else{ - $finalNum = $this->calFinalStarNum($num_arr[$pvp_rank-1]); - } - $totalNum = $finalNum; - if ($finalNum > 0){ - array_push($items,array( - 'item_id' => V_ITEM_STAR, - 'item_num' => $finalNum - )); - - } - } - if ($items){ - $propertyChgService = new services\PropertyChgService(); - $awardService = new services\AwardService(); - myself()->_addItems($items, $awardService,$propertyChgService); - myself()->_incV(TN_TOTAL_STAR_NUM, 0, $totalNum); - } - - } - public function calStarNum2(&$reward,$pvp_rank,$account_id){ - $currStarMissionSeasonMeta = \mt\StarLevel::getCurrentSeason(); - if (!$currStarMissionSeasonMeta){ - return; - } - $battleDb = Battle::find($account_id); - $battleTimes = 0; - if ($battleDb){ - $battleData = json_decode($battleDb['battle_data'], true); - $seasonBattleData = isset($battleData) ? getXVal($battleData, 'data', array()) : array(); - $battleTimes = getXVal($seasonBattleData, 'total_battle_times', 0); - } - if ($battleTimes <= mt\Parameter::getVal('rookie_map_counts',10)){ - array_push($reward['items'],array( - 'item_id' => V_ITEM_STAR, - 'item_num' => 10 - )); - }else{ - $star_get_num = mt\Parameter::getVal('star_get_num',0); - $num_arr = explode('|',$star_get_num); - if ($pvp_rank>count($num_arr) || $pvp_rank<1){ - $finalNum = 0; - }else{ - $finalNum = $this->calFinalStarNum($num_arr[$pvp_rank-1]); - } - if ($finalNum > 0){ - array_push($reward['items'],array( - 'item_id'=> V_ITEM_STAR, - 'item_num'=>$finalNum, - )); - } - } - } - - private function calFinalStarNum($num){ - $finalNum = 0; - if ($num <= 0) { - return $finalNum; - } - $starMax = mt\Parameter::getVal('starroad_max',0); - if ($starMax){ - $starNum = myself()->_getDailyV(TN_DAILY_GET_STAR_NUM, 0); - $newNum = min($starMax,$starNum + $num); - $finalNum = max(0,$newNum-$starNum); - } - return $finalNum; - } - - private function settlementReward(){ - error_log('settlementReward'); - $battle_uuid = getXVal($this->allInfo,'battle_uuid', 0); - $room_uuid = getXVal($this->allInfo,'room_uuid', 0); - $propertyChgService = new services\PropertyChgService(); - $awardService = new services\AwardService(); - $db = BattleSettlement::findTeam($battle_uuid,$room_uuid); - if ($db){ - $data = emptyReplace(json_decode($db['data'], true), array()); - if ($data){ - foreach ($data['members'] as $member){ - if ($member['account_id'] == myself()->_getAccountId()){ - if ($member['reward']['items']){ - $gold= 0; - $items = array(); - foreach ($member['reward']['items'] as $value){ - if ($value['item_id'] == V_ITEM_GOLD){ - $gold = $value['item_num']; - } - if ($value['item_id'] != V_ITEM_STAR){ - array_push($items,$value); - } - } - myself()->_addItems($items, $awardService,$propertyChgService); - if ($gold > 0){ - //埋点 - $event = [ - 'name' => LogService::BATTLE_AWARD_PVP, - 'val' => $gold - ]; - LogService::productGold($event); - } - } - if ($member['reward']['hero']['hero_uniid']){ - Hero::update($member['reward']['hero']['hero_uniid'], - array( - 'today_get_gold' => $member['reward']['hero']['curr_gold'] * 100, - 'last_get_gold_time' => myself()->_getNowTime() - )); - } - } - } - } - } - } - - private function updateRankData() - { - error_log('updateRankData'); - $this->currSeasonMeta = mt\RankSeason::getCurrentSeason(); - if ( $this->currSeasonMeta) { - $this->seasonDb = Season::find($this->currSeasonMeta['id']); - if (!$this->seasonDb) { - Season::add($this->currSeasonMeta['id']); - $this->seasonDb = Season::find($this->currSeasonMeta['id']); - } - if (!$this->seasonDb) { - return; - } -// $this->updateScore(); - $seasonBattleData = json_decode($this->seasonDb['battle_data'], true); - if (!isset($seasonBattleData['today_data'])) { - $seasonBattleData['today_data'] = array( - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); - } - if (!isset($seasonBattleData['season_data'])) { - $seasonBattleData['season_data'] = array( - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); - } - if (!isset($seasonBattleData['this_week_data'])) { - $seasonBattleData['this_week_data'] = array( - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); - } - if (myself()->_getDaySeconds($seasonBattleData['today_data']['modifytime']) < - myself()->_getNowDaySeconds()) { - $seasonBattleData['today_data'] = array( - 'createtime' => $seasonBattleData['today_data']['createtime'], - 'modifytime' => myself()->_getNowTime() - ); - } - if (myself()->_getDaySeconds($seasonBattleData['this_week_data']['modifytime']) < - myself()->_getMondaySeconds()) { - $seasonBattleData['this_week_data'] = array( - 'createtime' => $seasonBattleData['this_week_data']['createtime'], - 'modifytime' => myself()->_getNowTime() - ); - } - $oldSeasonDataKills = getXVal($seasonBattleData['season_data'], 'total_kills_times', 0); - $this->apply($seasonBattleData['season_data']); - $newSeasonDataKills = getXVal($seasonBattleData['season_data'], 'total_kills_times', 0); - if ($newSeasonDataKills > $oldSeasonDataKills) { - Season::upsert($this->currSeasonMeta['id'], array( - 'kills_modifytime' => myself()->_getNowTime(), - )); - Battle::update(array( - 'kills_modifytime' => myself()->_getNowTime(), - )); - } - $this->apply($seasonBattleData['today_data']); - $this->apply($seasonBattleData['this_week_data']); - Season::upsert( - $this->currSeasonMeta['id'], - array( - 'battle_data' => json_encode($seasonBattleData), - ) - ); - } - } - - private function updateScore() - { - error_log('updateScore'); - $newRank = $this->userInfo['rank']; - $winningPro = $this->celWinningPro($this->userInfo); - if ($winningPro){ - $newScore = FormulaService::calcBattleAfterRankScore($this->userInfo,$this->battleInfo,$winningPro); //赛后排位积分 - //黄金以下段位,失败时不扣积分 - if ($newScore < $this->userInfo['score'] && $this->userInfo['score']< 1300){ - $newScore = $this->userInfo['score']; - } - $newElo = FormulaService::calcUserEloValue($this->userInfo,$this->battleInfo,$winningPro); //赛后elo积分 - mt\Rank::calcNewRankAndScore( $newRank, $newScore); - if ( $newScore != $this->userInfo['score'] ) { - myself()->_updateUserInfo(array( - 'rank' => $newRank, - 'score' => $newScore, - 'elo' => $newElo, - 'history_best_rank' => max($this->userInfo['history_best_rank'], $newRank), - 'history_best_score' => max($this->userInfo['history_best_score'], $newScore), - 'score_modifytime' => myself()->_getNowTime(), - 'best_rank_modifytime' => $newRank > $this->userInfo['rank'] ? - myself()->_getNowTime() : $this->userInfo['best_rank_modifytime'], - )); - Season::upsert($this->currSeasonMeta['id'], array( - 'rank' => $newRank, - 'score' => $newScore, - 'elo' => $newElo, - 'history_best_rank' => max($this->userInfo['rank'], $newRank), - 'score_modifytime' => myself()->_getNowTime(), - 'best_rank_modifytime' => $newRank > $this->userInfo['rank'] ? - myself()->_getNowTime() : $this->userInfo['best_rank_modifytime'], - )); - } - } - } - - - public function celWinningPro($userInfo){ - $team_id = getXVal($this->allInfo,'team_id', 0); - if (empty($this->teamList) || ! count($this->teamList)){ - error_log('ELO1-----没获取到所有队伍信息:AllTeamList'); - return false; - } -// $userInfo = myself()->_getOrmUserInfo(); -// $myAvg = 0; -// $opponentAvg = 0; - $teamIdHash = array(); - foreach ($this->teamList as &$team){ - foreach ($team['members'] as $k=>$member){ - if (!empty($member['account_id'])){ - $channelId = phpcommon\extractChannel($member['account_id']); - if ($channelId == SELFSDK_CHANNEL) { - unset($team['members'][$k]); - } - }else{ - unset($team['members'][$k]); - } - } - $teamIdHash[$team['team_id']] = $team; - } - $myTeam = array_key_exists($team_id,$teamIdHash)?$teamIdHash[$team_id]:null; - unset($teamIdHash[$team_id]); - if (!$myTeam){ - error_log('ELO2-----没获取到我的队伍信息:MyTeamList'); - return false; - } - $myTeamEloSum = 0; - foreach ($myTeam['members'] as $value){ - $userDb = User::find($value['account_id']); - $myTeamEloSum+=$userDb['elo']; - } - $myAvg = $myTeamEloSum/count($myTeam['members']); - $tempSumList = array(); - foreach ($teamIdHash as $k=>&$item){ - if ($team_id != $item['team_id'] && count($item['members'])>0){ - $tempSum = 0; - foreach ($item['members'] as $value){ - $userDb = User::find($value['account_id']); - $tempSum += $userDb['elo']; - } - array_push($tempSumList,$tempSum/count($item['members'])); - } - } - if (count($tempSumList) > 0){ - $opponentAvg = array_sum($tempSumList)/count($tempSumList); - //总胜率=70%*P(个人ELO值-敌队平均ELO值)+30%*P(己队平均ELO值-敌队平均ELO值) --> P(D)=1/(1+10^(-D/400)) - $winningPro = 1/(1+pow(10,(-(0.7*($userInfo['elo']-$opponentAvg)+0.3*($myAvg-$opponentAvg))/400))); - }else{ - error_log('ELO3-----无真人敌对队伍'); -// $winningPro = 0.5; - $winningPro = 1/(1+pow(10,(-(0.7*($userInfo['elo']-$myAvg)+0.3*(0))/400))); - } - error_log(json_encode( - array( - 'account_id' => $userInfo['account_id'], - 'myElo' =>$userInfo['elo'], - 'myAvg' => $myAvg, - 'myTeam' =>$myTeam, - 'opponentAvg'=>$tempSumList, - 'winningPro' => $winningPro, - ) - )); - return $winningPro; - } - - private function apply(&$battleData) - { - //战斗次数 - $this->incValue($battleData, 'total_battle_times', 1); - if (getXVal($this->allInfo,'team_mode', 0) == 0) { - //单人模式战斗次数 - $this->incValue($battleData, 'total_single_battle_times', 1); - //单人模式最高排名 - $this->minValue($battleData, 'single_battle_rank', getXVal($this->battleInfo,'pvp_personal_rank', 0)); - } else { - //组队模式最高排名 - $this->minValue($battleData, 'team_battle_rank', getXVal($this->allInfo,'pvp_team_rank', 0)); - //组队模式战斗次数 - $this->incValue($battleData, 'total_team_battle_times', 1); - //组队模式前15名次数 - if (getXVal($this->battleInfo,'pvp_personal_rank', 0) <= 15){ - $this->incValue($battleData, 'total_team_top_X_battle_times', 1); - } - } - //排名 - $ranked = getXVal($this->battleInfo,'pvp_team_rank', 0); - if ($ranked == 1) { - //吃鸡次数 - $this->incValue($battleData, 'total_win_times', 1); - } - if ($ranked <= 3 && $ranked>0){ - //排名前十 总次数 - $this->incValue($battleData, 'total_top_three_times', 1); - } - //击杀 - $kills = getXVal($this->battleInfo,'kills', 0); - if ($kills > 0) { - //击杀总次数 - $this->incValue($battleData, 'total_kills_times', $kills); - //单局最大击杀数 - $this->maxValue($battleData, 'max_kills_times', $kills); - } - //输出 - $damageOut = getXVal($this->battleInfo,'damage_out', 0); - if ($damageOut > 0) { - //伤害输出总量 - $this->incValue($battleData, 'total_damage_out', $damageOut); - //单局最大伤害输出 - $this->maxValue($battleData, 'max_damage_out', $damageOut); - } - //承伤 - $damageIn = getXVal($this->battleInfo,'damage_in', 0); - if ($damageIn > 0) { - //受到伤害总量 - $this->incValue($battleData, 'total_damage_in', $damageIn); - //单局最大受到伤害量 - $this->maxValue($battleData, 'max_damage_in', $damageIn); - } - //回复 - $recoverHp = getXVal($this->battleInfo,'recover_hp', 0); - if ($recoverHp > 0) { - //自疗总量 - $this->incValue($battleData, 'total_recover_hp', $recoverHp); - //单局最大自疗量 - $this->maxValue($battleData, 'max_recover_hp', $recoverHp); - } - //存活时间 - $aliveTime = getXVal($this->battleInfo,'alive_time', 0); - if ($aliveTime > 0) { - //总存活时间 - $this->incValue($battleData, 'total_alive_time', $aliveTime); - //单局最大存活时间 - $this->maxValue($battleData, 'max_alive_time', $aliveTime); - } - //救援次数 - $this->incValue($battleData, 'rescue_teammate_times', getXVal($this->battleInfo,'rescue_teammate_times', 0)); - //潜水次数 - $this->incValue($battleData, 'diving_times', getXVal($this->battleInfo,'diving_times', 0)); - //开启空投次数 - $this->incValue($battleData, 'open_airdrop_times', getXVal($this->battleInfo,'open_airdrop_times', 0)); - //使用药品次数 - $this->incValue($battleData, 'use_medicine_times', getXVal($this->battleInfo,'use_medicine_times', 0)); - //击毁机甲次数 - $this->incValue($battleData, 'destory_car_times', getXVal($this->battleInfo,'destory_car_times', 0)); - //使用伪装次数 - $this->incValue($battleData, 'use_camouflage_times', getXVal($this->battleInfo,'use_camouflage_times', 0)); - //使用技能次数 - $this->incValue($battleData, 'use_skill_times', getXVal($this->battleInfo,'use_skill_times', 0)); - //驾驶机甲移动距离 - $this->incValue($battleData, 'ride_car_move_distance', getXVal($this->battleInfo,'ride_car_move_distance', 0)); - //驾驶机甲击杀数 - $this->incValue($battleData, 'ride_car_kills', getXVal($this->battleInfo,'ride_car_kills', 0)); - //使用的英雄最高等级 - $this->maxValue($battleData, 'max_single_battle_hero_lv', getXVal($this->battleInfo,'max_single_battle_hero_lv', 0)); - $this->procWeaponsEquip($battleData); - $this->procWeaponsSlot($battleData); - $this->procHeros($battleData); - if (!isset($battleData['createtime'])) { - $battleData['createtime'] = myself()->_getNowTime(); - } - $battleData['modifytime'] = myself()->_getNowTime(); - } - - private function procWeaponsEquip(&$battleData) - { - if (!isset($battleData['weapons_type_data'])) { - $battleData['weapons_type_data'] = array(); - } - //武器类型数据 - $weaponsTypeDb = &$battleData['weapons_type_data']; - { - $tmpStrs1 = explode('|', getXVal($this->battleInfo,'weapons_type', '')); - foreach ($tmpStrs1 as $str) { - $tmpStrs2 = explode(':', $str); - if (count($tmpStrs2) >= 4) { - list($weaponId, $kills, $damageOut, $obtainCount) = $tmpStrs2; - $weaponMeta = mt\Equip::get($weaponId); - if ($weaponMeta) { - $key = $weaponMeta['equip_type'] . '_' . $weaponMeta['equip_subtype']; - if (!isset($weaponsTypeDb[$key])) { - $weaponsTypeDb[$key] = array(); - } - //使用此种类型武器击杀数 - $this->incValue($weaponsTypeDb, 'kills', $kills); - //使用此种武器伤害输出 - $this->incValue($weaponsTypeDb, 'damage_out', $damageOut); - //战斗中获得此种武器数量 - $this->incValue($weaponsTypeDb, 'obtain_count', $obtainCount); - } - } - } - } - } - - private function procWeaponsSlot(&$battleData) - { - if (!isset($battleData['weapons_slot_data'])) { - $battleData['weapons_slot_data'] = array(); - } - //武器槽位数据 - $weaponsSlotDb = &$battleData['weapons_slot_data']; - { - $tmpStrs1 = explode('|', getXVal($this->battleInfo,'weapons_slot', '')); - foreach ($tmpStrs1 as $str) { - $tmpStrs2 = explode(':', $str); - if (count($tmpStrs2) >= 4) { - list($weaponId, $use_times) = $tmpStrs2; - $weaponMeta = mt\Equip::get($weaponId); - if ($weaponMeta && $weaponMeta['inventory_slot'] > 0) { - $key = $weaponMeta['inventory_slot']; - if (!isset($weaponsSlotDb[$key])) { - $weaponsSlotDb[$key] = array(); - } - //使用次数 - $this->incValue($weaponsSlotDb, 'use_times', $use_times); - } - } - } - } - } - - private function procHeros(&$battleData) - { - if (!isset($battleData['hero_data'])) { - $battleData['hero_data'] = array(); - } - //英雄数据 - $heroDb = &$battleData['hero_data']; - { - $tmpStrs1 = explode('|', getXVal($this->battleInfo,'heros', '')); - foreach ($tmpStrs1 as $str) { - $tmpStrs2 = explode(':', $str); - if (count($tmpStrs2) >= 4) { - list($heroId, $skillLv, $weaponLv) = $tmpStrs2; - $heroMeta = mt\Item::get($heroId); - if ($heroMeta && $heroMeta['type'] == mt\Item::HERO_TYPE) { - $key = $heroMeta['id']; - if (!isset($heroDb[$key])) { - $heroDb[$key] = array(); - } - //最大技能等级 - $this->maxValue($heroDb, 'skill_lv', $skillLv); - //最大武器等级 - $this->maxValue($heroDb, 'weapon_lv', $weaponLv); - } - } - } - } - - //统计使用的英雄及枪械的信息 - if (!isset($battleData['hero_info'])) { - $battleData['hero_info'] = array(); - } - $heroInfo = &$battleData['hero_info']; - { - $hero_uniid = getXVal($this->battleInfo,'hero_uniid', ''); - $hero = Hero::find($hero_uniid); - if ($hero){ - if (!isset($heroInfo[$hero['hero_id']])){ - $heroInfo[$hero['hero_id']] = array(); - } - $this->incValue($heroInfo[$hero['hero_id']], "use_times", 1); //每个英雄使用次数 - $ranked = getXVal($this->battleInfo,'pvp_team_rank', 0); - if ($ranked == 1) { - //吃鸡次数 - $this->incValue($heroInfo[$hero['hero_id']], 'win_times', 1);//使用该英雄吃鸡获胜次数 - } - if ($ranked <= 10){ - //排名前十 总次数 - $this->incValue($heroInfo[$hero['hero_id']], 'top_ten_times', 1);//使用该英雄进前十次数 - } - if (!isset($heroInfo[$hero['hero_id']]['weapon'])){ - $heroInfo[$hero['hero_id']]['weapon'] = array(); - } - $weapon_uuid1 = getXVal($this->battleInfo,'weapon_uuid1', 0); - $weapon1 = Gun::find($weapon_uuid1); - if ($weapon1){ - $this->incValue($heroInfo[$hero['hero_id']]['weapon'], $weapon1['gun_id'], 1);//该英雄下选用每个武器的次数 - } - $weapon_uuid2 = getXVal($this->battleInfo,'weapon_uuid2', 0); - $weapon2 = Gun::find($weapon_uuid2); - if ($weapon2){ - $this->incValue($heroInfo[$hero['hero_id']]['weapon'], $weapon2['gun_id'], 1);//该英雄下选用每个武器的次数 - } - } - } - } - - private function incValue(&$battleData, $key, $val) - { - if ($val > 0) { - $battleData[$key] = getXVal($battleData, $key, 0) + $val; - } - } - - private function minValue(&$battleData, $key, $val) - { - $battleData[$key] = min(getXVal($battleData, $key, 0), $val); - } - - private function maxValue(&$battleData, $key, $val) - { - $battleData[$key] = max(getXVal($battleData, $key, 0), $val); - } - + array( + 'hero_uniid' => '', + 'gold_uplimit' => 0, + 'obtain_gold' => 0, + 'curr_gold' => 0, + ), + 'total_ceg' => 0, + 'items' => array(), + ); + private $teamReward = array(); + private $seasonDb = array(); + private $currSeasonMeta = null; + + public function updateBattleData() + { + error_log('updateBattleData'); + $matchMode = getXVal($this->allInfo,'room_mode', 0); + $userInfo = myself()->_getOrmUserInfo(); + if (!$userInfo){ + return false; + } + $this->userInfo = $userInfo; + $heroDb = Hero::find(getXVal($this->battleInfo,'hero_uniid', 0)); + if (!$heroDb) { + return false; + } + $this->heroDto = Hero::toDto($heroDb); + $heroMeta = mt\Hero::get($this->heroDto['hero_id']); + if (!$heroMeta) { + return false; + } + + //记录算力系统有效行为 + $this->_addHashRateTask(); + + switch ($matchMode) { + //PVP模式 + case self::ROOM_MODE_PVP: + { + $pvpMode = getXVal($this->allInfo,'pvp_match_mode', 0); + switch ($pvpMode){ + case self::MATCH_MODE_PVP: + { + //匹配赛模式 + $this->updatePvpData(); + $this->settlementReward(); + myself()->_incDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0, 1); + } + break; + case self::MATCH_MODE_RANK: + { + //排位赛 + $this->updatePvpData(); + $this->updateRankData(); + $this->updateScore(); + $this->settlementReward(); + myself()->_incDailyV(TN_DAILY_RANK_BATTLE_TIMES, 0, 1); + } + break; + default:{} + break; + } + + //记录战斗数据的排行榜 + $this->recordBattleRanking(); +// //结算用户star数量 +// $this->rewardStarNum(); + } + break; + //PVE模式 + case self::ROOM_MODE_PVE: + { + + //pve + $this->updatePveData(); + if ($this->pveGeminiMeta ) { + $this->rewardFragmentPve(); + } + myself()->_incDailyV(TN_DAILY_PVE_BATTLE_TIMES, 0, 1); + } + break; + default: + { + } + break; + } + + } + +// //每局战斗结算star数量 +// private function rewardStarNum(){ +// $paramMeta = mt\Parameter::getByName('star_get_num'); +// if ($paramMeta){ +// $star_get_num = getXVal($paramMeta,'param_value', 0); +// $num_arr = explode('|',$star_get_num); +// $rank = getXVal($this->battleInfo,'pvp_personal_rank', 0); +// if ($rank>count($num_arr) || $rank<1){ +// $finalNum = 0; +// }else{ +// $finalNum = $this->calFinalStarNum($num_arr[$rank-1]); +// } +// $items = array( +// array( +// 'item_id'=>V_ITEM_STAR, +// 'item_num'=>$finalNum +// ) +// );print_r($items); +// $propertyChgService = new services\PropertyChgService(); +// $awardService = new services\AwardService(); +//// myself()->_addItems($items, $awardService,$propertyChgService); +// myself()->_incDailyV(TN_DAILY_GET_STAR_NUM, 0,$finalNum); +// } +// } + + + + //记录战斗数据的排行榜 + private function recordBattleRanking(){ + $account = getXVal($this->battleInfo,'account_id', 0); + //游戏场次 (存活30S算有效场次) + if (getXVal($this->battleInfo,'pvp_survia_time', 0)/1000 > 30 && + getXVal($this->battleInfo,'abandon_battle', 0) == 0){ + RankBattle::upsert($account,RankBattle::GAME_TIMES,1); + } + //吃鸡数 //pvp_team_rank + if (getXVal($this->allInfo,'pvp_team_rank', 0) == 1){ + RankBattle::upsert($account,RankBattle::WIN_TIMES,1); + } + + //mvp + if (getXVal($this->battleInfo,'is_mvp', 0) == 1){ + RankBattle::upsert($account,RankBattle::MVP_TIMES,1); + } + + //前三 + if (getXVal($this->allInfo,'pvp_team_rank', 0) <= 3){ + RankBattle::upsert($account,RankBattle::TOP_THREE_TIMES,1); + } + + //击杀 + if (getXVal($this->battleInfo,'pvp_kill', 0) > 0){ + myself()->_incV(TN_TOTAL_KILLS_NUM, 0, getXVal($this->battleInfo,'pvp_kill', 0)); + RankBattle::upsert($account,RankBattle::KILL_TIMES,getXVal($this->battleInfo,'pvp_kill', 0)); + } + } + + private function updatePveData() + { + error_log('updatePveData'); + $instanceId = getXVal($this->allInfo,'pve_instance_id', 0); + $pveRankScore = getXVal($this->battleInfo,'pve_score', 0); + $pveBossKilled = getXVal($this->battleInfo,'pve_boss_killed', 0); + $userInfo = myself()->_getOrmUserInfo(); + $this->pveGeminiMeta = mt\PveGemini::get($instanceId); + if ($this->pveGeminiMeta) { + if (!( + ($instanceId == mt\PveGemini::FIRST_INSTANCE_ID && $userInfo['pve_instance_id'] == 0 ) || + $userInfo['pve_instance_id'] == $instanceId || + $userInfo['pve_instance_id'] + 1 == $instanceId) + ) { + $this->pveGeminiMeta = null; + } + } +// $this->pveGeminiModeMeta = mt\PveGeminiMode::get($instanceMode); +// if ($this->pveGeminiModeMeta) { +// $this->instanceRank = mt\PveGeminiMode::calcStar($this->pveGeminiModeMeta, $pveRankScore); +// } + if ($pveBossKilled == 1) { + if ($this->pveGeminiMeta) { + myself()->_updateUserInfo(array( + 'pve_instance_id' => $instanceId + )); + } + } + } + + private function rewardFragmentPve() + { + error_log('rewardFragmentPve'); + $bossReward = getXVal($this->battleInfo,'pve_boss_killed', 0) ? 1 : 0; + if ( !$bossReward) { + return; + } + $dropRate = $this->pveGeminiMeta['drop_rate']; + $todayPveGetHeroFragmentNum = myself()->_getDailyV(TN_DAILY_PVE_GET_HERO_FRAGMENT_NUM, 0); + $todayPveGetGunFragmentNum = myself()->_getDailyV(TN_DAILY_PVE_GET_GUN_FRAGMENT_NUM, 0); + $reward = array(); + if ($todayPveGetHeroFragmentNum < self::MAX_DROP_NUM) { + $gamesNum = FragmentRecord::getGamesNum(FragmentRecord::HERO_FRAGMENT); + $rate = $dropRate*($gamesNum+1); + if (rand(1,100) < $rate*100){ + $dropHeroFragmentId = $this->randWeight2(1); + $this->drop($reward,$dropHeroFragmentId,1); + FragmentRecord::upsertGamesNum(FragmentRecord::HERO_FRAGMENT,0); + }else{ + FragmentRecord::upsertGamesNum(FragmentRecord::HERO_FRAGMENT,$gamesNum+1); + } + + } + if ($todayPveGetGunFragmentNum < self::MAX_DROP_NUM) { + $gamesNum = FragmentRecord::getGamesNum(FragmentRecord::GUN_FRAGMENT); + $rate = $dropRate*($gamesNum+1); + if (rand(1,100) < $rate*100){ + $dropGunFragmentId = $this->randWeight2(2); + $this->drop($reward,$dropGunFragmentId,2); + FragmentRecord::upsertGamesNum(FragmentRecord::GUN_FRAGMENT,0); + }else{ + FragmentRecord::upsertGamesNum(FragmentRecord::GUN_FRAGMENT,$gamesNum+1); + } + + } + if ($reward){ + //记录获得得碎片奖励 + $battle_uuid = getXVal($this->allInfo,'battle_uuid', 0); + $room_uuid = getXVal($this->allInfo,'room_uuid', 0); + $db = BattleSettlement::findTeam($battle_uuid,$room_uuid); + if ($db){ + $data = emptyReplace(json_decode($db['data'], true), array()); + if ($data){ + foreach ($data['members'] as &$member){ + if ($member['account_id'] == myself()->_getAccountId()){ + $member['reward']['items'] = $reward; + } + } + } + BattleSettlement::addTeam($battle_uuid,$room_uuid,$data); + } + } + } + + private function randWeight2($type){ + $itemMeta = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE); + $heroFragment = array(); + $gunFragment = array(); + foreach ($itemMeta as $meta){ + if ($meta['sub_type'] == 3 || $meta['sub_type'] == 1){ + array_push($heroFragment,$meta['id']); + } + if ($meta['sub_type'] == 4 || $meta['sub_type'] == 2){ + array_push($gunFragment,$meta['id']); + } + } + $weightRate = array( + array(0,4), + array(1,12), + array(2,12), + array(3,12), + array(4,12), + array(5,12), + array(6,12), + array(7,12), + array(8,12), + ); + $weight = 0; + $tempData = array (); + foreach ($weightRate as $one) { + $weight += $one[1]; + for ($i = 0; $i < $one[1]; $i++) { + $tempData[] = $one; + + } + } + $key = $tempData[rand(0, $weight -1)][0]; + switch ($type){ + case 1:return $heroFragment[$key]; + case 2:return $gunFragment[$key]; + default:return null; + } + } + + private function drop(&$reward,$itemId,$type){ + $itemMeta = mt\Item::get($itemId); + if ($itemMeta){ + $propertyChgService = new services\PropertyChgService(); + $awardService = new services\AwardService(); + array_push($reward, + array( + 'item_id' => $itemId, + 'item_num' => 1 + )); + myself()->_addItems( + array( + array( + 'item_id' => $itemId, + 'item_num' => 1 + )), + $awardService, + $propertyChgService + ); + switch ($type){ + case 1:myself()->_incDailyV(TN_DAILY_PVE_GET_HERO_FRAGMENT_NUM, 0, 1);break; + case 2:myself()->_incDailyV(TN_DAILY_PVE_GET_GUN_FRAGMENT_NUM, 0, 1);break; + } + + } + + } + + + private function updatePvpData() + { + error_log('updatePvpData'); + $hisBattleData = Battle::getMyBattleData(); + if (!isset($hisBattleData['data'])) { + $hisBattleData['data'] = array( + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ); + } + if (!isset($hisBattleData['today_data'])) { + $hisBattleData['today_data'] = array( + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ); + } + if (!isset($hisBattleData['this_week_data'])) { + $hisBattleData['this_week_data'] = array( + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ); + } + //上局游戏数据 + $hisBattleData['last_game_data'] = array( + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ); + + + if (myself()->_getDaySeconds($hisBattleData['today_data']['modifytime']) < + myself()->_getNowDaySeconds()) { + $hisBattleData['today_data'] = array( + 'createtime' => $hisBattleData['today_data']['createtime'], + 'modifytime' => myself()->_getNowTime() + ); + } + if (myself()->_getDaySeconds($hisBattleData['this_week_data']['modifytime']) < + myself()->_getMondaySeconds()) { + $hisBattleData['this_week_data'] = array( + 'createtime' => $hisBattleData['this_week_data']['createtime'], + 'modifytime' => myself()->_getNowTime() + ); + } + $this->apply($hisBattleData['last_game_data']); + $this->apply($hisBattleData['today_data']); + $this->apply($hisBattleData['this_week_data']); + $oldDataKills = getXVal($hisBattleData['data'], 'total_kills_times', 0); + $this->apply($hisBattleData['data']); + $newDataKills = getXVal($hisBattleData['data'], 'total_kills_times', 0); + if ($newDataKills > $oldDataKills) { + Battle::update(array( + 'kills_modifytime' => myself()->_getNowTime(), + )); + } + Battle::add(json_encode($hisBattleData)); + } + + + + public function addBattleSettlementSingle() + { + error_log('BattleSettlementSingle'); + $pvp_mode = getXVal($this->allInfo,'pvp_match_mode', 0); + $battleUuid = getXVal($this->allInfo,'battle_uuid', 0); + $roomUuid = getXVal($this->allInfo,'room_uuid', 0); + + $newRank = $this->userInfo['rank']; + $newScore = $this->userInfo['score']; + $newElo = $this->userInfo['elo']; + + if ($pvp_mode == self::MATCH_MODE_RANK){ + myself()->_setV(TN_LAST_RANKING_TIME,0,getXVal($this->battleInfo,'game_time', 0)); + $winningPro = $this->celWinningPro($this->userInfo); + if ($winningPro){ + + $newElo = FormulaService::calcUserEloValue($this->userInfo,$this->battleInfo,$winningPro); //赛后elo积分 + $newScore = FormulaService::calcBattleAfterRankScore($this->userInfo,$this->battleInfo,$winningPro); //赛后排位积分 + //黄金以下段位,失败时不扣积分 + if ($newScore < $this->userInfo['score'] && $this->userInfo['score']< 1300){ + $newScore = $this->userInfo['score']; + } + mt\Rank::calcNewRankAndScore( $newRank, $newScore); + } + } + + $data = array( + "battle_uuid" => $battleUuid, + "account_id" => getXVal($this->battleInfo,'account_id', 0), + "room_mode" => getXVal($this->allInfo,'room_mode', 0), + "pvp_mode" => $pvp_mode, + "team_mode" => getXVal($this->allInfo,'team_mode', 0), + "battle_rank" => getXVal($this->battleInfo,'pvp_personal_rank', 0), + "team_rank" => getXVal($this->allInfo,'pvp_team_rank', 0), + "team_kills" => getXVal($this->allInfo,'pvp_team_kills', 0), + "is_win" => getXVal($this->battleInfo,'pve_boss_killed', 0), + "kills" => getXVal($this->battleInfo,'kills', 0), + "hero_id" => getXVal($this->battleInfo,'hero_uniid', 0), + "weapon1" => getXVal($this->battleInfo,'weapon_uuid1', 0), + "weapon2" => getXVal($this->battleInfo,'weapon_uuid2', 0), + "battle_end_time" => getXVal($this->battleInfo,'game_time', 0), + "current_level_class" => $newRank, + "current_level_class_score" => $newScore, + "level_class_score_chg" => $newScore - $this->userInfo['score'], // 排位分改变 + "pve_rank_score" => getXVal($this->battleInfo,'pve_score', 0), + "pve_kill_boss" => getXVal($this->battleInfo,'pve_boss_killed', 0), + "pve_instance_id" => getXVal($this->allInfo,'pve_instance_id', 0), +// "pve_instance_mode" => getXVal($this->allInfo,'pve_instance_mode', 0), + "old_elo" => $this->userInfo['elo'], + "new_elo" => $newElo, + ); + BattleSettlement::addSingle($battleUuid,$roomUuid,$data); + } + + public function addBattleSettlementTeam() + { + error_log('BattleSettlementTeam'); + $room_mode = getXVal($this->allInfo,'room_mode', 0); + switch ($room_mode){ + case self::ROOM_MODE_PVP: + { + $team_mode = getXVal($this->allInfo,'pvp_settelement_type', 0); + } + break; + case self::ROOM_MODE_PVE: + { + $team_mode = getXVal($this->allInfo,'pve_settelement_type', 0); + } + break; + default: + { + $team_mode = null; + } + break; + } + $data = array( + 'version'=> getXVal($this->allInfo,'version', 0), + 'team_id'=> getXVal($this->allInfo,'team_id', 0), + 'room_uuid'=> getXVal($this->allInfo,'room_uuid', 0), + 'room_mode'=> getXVal($this->allInfo,'room_mode', 0), + 'team_mode'=> $team_mode, + 'game_over'=>1, + 'victory'=> getXVal($this->allInfo,'victory', 0), + 'watchable'=> 1, + 'map_id'=> getXVal($this->allInfo,'map_id', 0), + 'battle_uuid'=> getXVal($this->allInfo,'battle_uuid', 0), + 'settlement_status'=>1, + 'pvp_settlement_type'=> getXVal($this->allInfo,'pvp_settelement_type', 0), + 'pvp_settlement_color'=> getXVal($this->allInfo,'pvp_settelement_color', 0), + 'pvp_team_rank'=> getXVal($this->allInfo,'pvp_team_rank', 0), + 'pvp_total_human_num'=> getXVal($this->allInfo,'pvp_total_human_num', 0), + 'pvp_alive_human_num'=> getXVal($this->allInfo,'pvp_alive_human_num', 0), + 'pvp_total_team_num'=> getXVal($this->allInfo,'pvp_total_team_num', 0), + 'pvp_match_mode'=> getXVal($this->allInfo,'pvp_match_mode', 0), + 'pve_settlement_color'=> getXVal($this->allInfo,'pve_settlement_color', 0), + 'pve_wave'=> getXVal($this->allInfo,'pve_wave', 0), + 'pve_max_wave'=> getXVal($this->allInfo,'pve_max_wave', 0), + 'pve_instance_id'=> getXVal($this->allInfo,'pve_instance_id', 0), + ); + + $data['members'] = array(); + $pvp_mode = getXVal($this->allInfo,'pvp_match_mode', 0); + foreach ($this->teamInfo as $info){ + $info['pvp_team_rank'] = getXVal($this->allInfo,'pvp_team_rank', 0); + $oldRank = 0; + $newRank = 0; + $oldScore = 0; + $newScore = 0; + $oldElo = 0; + $newElo = 0; + $userDb = User::find(getXVal($info,'account_id', 0)); + if ($userDb){ + $oldRank = $userDb['rank']; + $newRank = $userDb['rank']; + $oldScore = $userDb['score']; + $newScore = $userDb['score']; + $oldElo = $userDb['elo']; + $newElo = $userDb['elo']; + if ($pvp_mode == self::MATCH_MODE_RANK){ + $heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0)); + if ($heroDb){ + $winningPro = $this->celWinningPro($userDb); + if ($winningPro){ + $newElo = FormulaService::calcUserEloValue($userDb,$info,$winningPro); //赛后elo积分 + $newScore = FormulaService::calcBattleAfterRankScore($userDb,$info,$winningPro); //赛后排位积分 + //黄金以下段位,失败时不扣积分 + if ($newScore < $userDb['score'] && $userDb['score']< 1300){ + $newScore = $userDb['score']; + } + mt\Rank::calcNewRankAndScore( $newRank, $newScore); + } + } + + } + } + + $temp = array( + 'account_id'=> getXVal($info,'account_id', 0), + 'name'=> getXVal($info,'name', 0), + 'head'=> getXVal($info,'head', 0), + 'head_frame'=> getXVal($info,'head_frame', 0), + 'sex'=> getXVal($info,'sex', 0), + 'hero_uniid'=> getXVal($info,'hero_uniid', 0), + 'hero_id'=> getXVal($info,'hero_id', 0), + 'dead'=> getXVal($info,'dead', 0), + 'is_mvp'=> getXVal($info,'is_mvp', 0), + 'old_rank'=> $oldRank, + 'new_rank'=> $newRank, + 'old_score'=> $oldScore, + 'new_score'=> $newScore, + 'old_elo'=> $oldElo, + 'new_elo'=> $newElo, + 'pvp_kill'=> getXVal($info,'pvp_kill', 0), + 'pvp_damage'=> getXVal($info,'pvp_damage', 0), + 'pvp_assist'=> getXVal($info,'pvp_assist', 0), + 'pvp_survia_time'=> getXVal($info,'pvp_survia_time', 0), + 'pvp_recover'=> getXVal($info,'pvp_recover', 0), + 'pvp_rescue'=> getXVal($info,'pvp_rescue', 0), + 'pvp_personal_rank'=> getXVal($info,'pvp_personal_rank', 0), + 'pve_order'=> getXVal($info,'pve_order', 0), + 'pve_score'=> getXVal($info,'pve_score', 0), + 'pve_star'=> getXVal($info,'pve_star', 0), + 'pve_damage'=> getXVal($info,'pve_damage', 0), + 'pve_revive'=> getXVal($info,'pve_revive', 0), + 'pve_survia_time'=> getXVal($info,'pve_survia_time', 0), + 'pve_wave'=> getXVal($info,'pve_wave', 0), + 'pve_max_wave'=> getXVal($info,'pve_max_wave', 0), + 'pve_boss_killed'=> getXVal($info,'pve_boss_killed', 0), +// 'pve_rank_score'=> getXVal($info,'pve_rank_score', 0), + ); + + $temp['reward'] = array( + 'hero' => array( + 'hero_uniid' => '', + 'id' => '', + 'gold_uplimit' => 0, + 'obtain_gold' => 0, + 'curr_gold' => 0, + ), + 'items' => array(), + ); + + switch ($room_mode){ + case self::ROOM_MODE_PVP: + { + //pvp奖励 gold + if ($userDb){ + $this->calStarNum2($temp['reward'],getXVal($info,'pvp_personal_rank', 0),$userDb['account_id']); + $heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0)); + if (!$heroDb){ + break; + } + $heroDto = Hero::toDto($heroDb); + $temp['reward']['hero']['hero_uniid'] = $heroDto['hero_uniid']; + $temp['reward']['hero']['id'] = $heroDto['hero_id']; + $temp['reward']['hero']['gold_uplimit'] = $heroDto['gold_uplimit']; + $this->rewardGoldPvp($temp['reward'],$heroDto,$userDb['rank']); + + } + } + break; + case self::ROOM_MODE_PVE: + { + //pve 奖励碎片 +// print_r($data);die; + } + break; + default:{} + } + array_push($data['members'],$temp); + } + BattleSettlement::addTeam( + getXVal($this->allInfo,'battle_uuid', 0), + getXVal($this->allInfo,'room_uuid', 0), + $data + ); + } + + private function rewardGoldPvp(&$reward,$heroDto,$userRank) + { + $heroPvpGold = FormulaService::calcHeroPvpGold($heroDto, $this->allInfo,$userRank); + if ($heroPvpGold > 0) { + $heroPvpGold = Hero::gainGoldPvp($heroDto, $heroPvpGold); + $reward['hero']['curr_gold'] = '' . ($heroDto['current_get_gold'] + $heroPvpGold); + $reward['hero']['obtain_gold'] = '' . ($heroDto['current_get_gold'] + $heroPvpGold); + } + if ($heroPvpGold > 0) { + array_push($reward['items'],array( + 'item_id'=> V_ITEM_GOLD, + 'item_num'=>$heroPvpGold, + )); + } + } + + public function calStarNum(){ + $currStarMissionSeasonMeta = \mt\StarLevel::getCurrentSeason(); + if (!$currStarMissionSeasonMeta){ + return; + } + $battleData = Battle::getMyBattleData(); + $data = isset($battleData) ? getXVal($battleData, 'data', array()) : array(); + $battleTimes = getXVal($data, 'total_battle_times', 0); + $items = array(); + $totalNum = 0; + if ($battleTimes <= mt\Parameter::getVal('rookie_map_counts',10)){ + $totalNum = 10; + array_push($items,array( + 'item_id' => V_ITEM_STAR, + 'item_num' => 10 + )); + }else{ + $pvp_rank = getReqVal('pvp_personal_rank', 0); + $star_get_num = mt\Parameter::getVal('star_get_num',0); + $num_arr = explode('|',$star_get_num); + if ($pvp_rank>count($num_arr) || $pvp_rank<1){ + $finalNum = 0; + }else{ + $finalNum = $this->calFinalStarNum($num_arr[$pvp_rank-1]); + } + $totalNum = $finalNum; + if ($finalNum > 0){ + array_push($items,array( + 'item_id' => V_ITEM_STAR, + 'item_num' => $finalNum + )); + + } + } + if ($items){ + $propertyChgService = new services\PropertyChgService(); + $awardService = new services\AwardService(); + myself()->_addItems($items, $awardService,$propertyChgService); + myself()->_incV(TN_TOTAL_STAR_NUM, 0, $totalNum); + } + + } + public function calStarNum2(&$reward,$pvp_rank,$account_id){ + $currStarMissionSeasonMeta = \mt\StarLevel::getCurrentSeason(); + if (!$currStarMissionSeasonMeta){ + return; + } + $battleDb = Battle::find($account_id); + $battleTimes = 0; + if ($battleDb){ + $battleData = json_decode($battleDb['battle_data'], true); + $seasonBattleData = isset($battleData) ? getXVal($battleData, 'data', array()) : array(); + $battleTimes = getXVal($seasonBattleData, 'total_battle_times', 0); + } + if ($battleTimes <= mt\Parameter::getVal('rookie_map_counts',10)){ + array_push($reward['items'],array( + 'item_id' => V_ITEM_STAR, + 'item_num' => 10 + )); + }else{ + $star_get_num = mt\Parameter::getVal('star_get_num',0); + $num_arr = explode('|',$star_get_num); + if ($pvp_rank>count($num_arr) || $pvp_rank<1){ + $finalNum = 0; + }else{ + $finalNum = $this->calFinalStarNum($num_arr[$pvp_rank-1]); + } + + if ($finalNum > 0){ + array_push($reward['items'],array( + 'item_id'=> V_ITEM_STAR, + 'item_num'=>$finalNum, + )); + } + } + } + + private function calFinalStarNum($num){ + $finalNum = 0; + if ($num <= 0) { + return $finalNum; + } + $starMax = mt\Parameter::getVal('starroad_max',0); + if ($starMax){ + $starNum = myself()->_getDailyV(TN_DAILY_GET_STAR_NUM, 0); + $newNum = min($starMax,$starNum + $num); + $finalNum = max(0,$newNum-$starNum); + } + return $finalNum; + } + + private function settlementReward(){ + error_log('settlementReward'); + $battle_uuid = getXVal($this->allInfo,'battle_uuid', 0); + $room_uuid = getXVal($this->allInfo,'room_uuid', 0); + $propertyChgService = new services\PropertyChgService(); + $awardService = new services\AwardService(); + $db = BattleSettlement::findTeam($battle_uuid,$room_uuid); + if ($db){ + $data = emptyReplace(json_decode($db['data'], true), array()); + if ($data){ + foreach ($data['members'] as $member){ + if ($member['account_id'] == myself()->_getAccountId()){ + if ($member['reward']['items']){ + $gold= 0; + $items = array(); + foreach ($member['reward']['items'] as $value){ + if ($value['item_id'] == V_ITEM_GOLD){ + $gold = $value['item_num']; + } + if ($value['item_id'] != V_ITEM_STAR){ + array_push($items,$value); + } + } + myself()->_addItems($items, $awardService,$propertyChgService); + if ($gold > 0){ + //埋点 + $event = [ + 'name' => LogService::BATTLE_AWARD_PVP, + 'val' => $gold + ]; + LogService::productGold($event); + } + } + if ($member['reward']['hero']['hero_uniid']){ + Hero::update($member['reward']['hero']['hero_uniid'], + array( + 'today_get_gold' => $member['reward']['hero']['curr_gold'] * 100, + 'last_get_gold_time' => myself()->_getNowTime() + )); + } + } + } + } + } + } + + private function updateRankData() + { + error_log('updateRankData'); + $this->currSeasonMeta = mt\RankSeason::getCurrentSeason(); + if ( $this->currSeasonMeta) { + $this->seasonDb = Season::find($this->currSeasonMeta['id']); + if (!$this->seasonDb) { + Season::add($this->currSeasonMeta['id']); + $this->seasonDb = Season::find($this->currSeasonMeta['id']); + } + if (!$this->seasonDb) { + return; + } +// $this->updateScore(); + $seasonBattleData = json_decode($this->seasonDb['battle_data'], true); + if (!isset($seasonBattleData['today_data'])) { + $seasonBattleData['today_data'] = array( + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ); + } + if (!isset($seasonBattleData['season_data'])) { + $seasonBattleData['season_data'] = array( + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ); + } + if (!isset($seasonBattleData['this_week_data'])) { + $seasonBattleData['this_week_data'] = array( + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ); + } + if (myself()->_getDaySeconds($seasonBattleData['today_data']['modifytime']) < + myself()->_getNowDaySeconds()) { + $seasonBattleData['today_data'] = array( + 'createtime' => $seasonBattleData['today_data']['createtime'], + 'modifytime' => myself()->_getNowTime() + ); + } + if (myself()->_getDaySeconds($seasonBattleData['this_week_data']['modifytime']) < + myself()->_getMondaySeconds()) { + $seasonBattleData['this_week_data'] = array( + 'createtime' => $seasonBattleData['this_week_data']['createtime'], + 'modifytime' => myself()->_getNowTime() + ); + } + $oldSeasonDataKills = getXVal($seasonBattleData['season_data'], 'total_kills_times', 0); + $this->apply($seasonBattleData['season_data']); + $newSeasonDataKills = getXVal($seasonBattleData['season_data'], 'total_kills_times', 0); + if ($newSeasonDataKills > $oldSeasonDataKills) { + Season::upsert($this->currSeasonMeta['id'], array( + 'kills_modifytime' => myself()->_getNowTime(), + )); + Battle::update(array( + 'kills_modifytime' => myself()->_getNowTime(), + )); + } + $this->apply($seasonBattleData['today_data']); + $this->apply($seasonBattleData['this_week_data']); + Season::upsert( + $this->currSeasonMeta['id'], + array( + 'battle_data' => json_encode($seasonBattleData), + ) + ); + } + } + + private function updateScore() + { + error_log('updateScore'); + $newRank = $this->userInfo['rank']; + $winningPro = $this->celWinningPro($this->userInfo); + if ($winningPro){ + $newScore = FormulaService::calcBattleAfterRankScore($this->userInfo,$this->battleInfo,$winningPro); //赛后排位积分 + //黄金以下段位,失败时不扣积分 + if ($newScore < $this->userInfo['score'] && $this->userInfo['score']< 1300){ + $newScore = $this->userInfo['score']; + } + $newElo = FormulaService::calcUserEloValue($this->userInfo,$this->battleInfo,$winningPro); //赛后elo积分 + mt\Rank::calcNewRankAndScore( $newRank, $newScore); + if ( $newScore != $this->userInfo['score'] ) { + myself()->_updateUserInfo(array( + 'rank' => $newRank, + 'score' => $newScore, + 'elo' => $newElo, + 'history_best_rank' => max($this->userInfo['history_best_rank'], $newRank), + 'history_best_score' => max($this->userInfo['history_best_score'], $newScore), + 'score_modifytime' => myself()->_getNowTime(), + 'best_rank_modifytime' => $newRank > $this->userInfo['rank'] ? + myself()->_getNowTime() : $this->userInfo['best_rank_modifytime'], + )); + Season::upsert($this->currSeasonMeta['id'], array( + 'rank' => $newRank, + 'score' => $newScore, + 'elo' => $newElo, + 'history_best_rank' => max($this->userInfo['rank'], $newRank), + 'score_modifytime' => myself()->_getNowTime(), + 'best_rank_modifytime' => $newRank > $this->userInfo['rank'] ? + myself()->_getNowTime() : $this->userInfo['best_rank_modifytime'], + )); + } + } + } + + + public function celWinningPro($userInfo){ + $team_id = getXVal($this->allInfo,'team_id', 0); + if (empty($this->teamList) || ! count($this->teamList)){ + error_log('ELO1-----没获取到所有队伍信息:AllTeamList'); + return false; + } +// $userInfo = myself()->_getOrmUserInfo(); +// $myAvg = 0; +// $opponentAvg = 0; + $teamIdHash = array(); + foreach ($this->teamList as &$team){ + foreach ($team['members'] as $k=>$member){ + if (!empty($member['account_id'])){ + $channelId = phpcommon\extractChannel($member['account_id']); + if ($channelId == SELFSDK_CHANNEL) { + unset($team['members'][$k]); + } + }else{ + unset($team['members'][$k]); + } + } + $teamIdHash[$team['team_id']] = $team; + } + $myTeam = array_key_exists($team_id,$teamIdHash)?$teamIdHash[$team_id]:null; + unset($teamIdHash[$team_id]); + if (!$myTeam){ + error_log('ELO2-----没获取到我的队伍信息:MyTeamList'); + return false; + } + $myTeamEloSum = 0; + foreach ($myTeam['members'] as $value){ + $userDb = User::find($value['account_id']); + $myTeamEloSum+=$userDb['elo']; + } + $myAvg = $myTeamEloSum/count($myTeam['members']); + $tempSumList = array(); + foreach ($teamIdHash as $k=>&$item){ + if ($team_id != $item['team_id'] && count($item['members'])>0){ + $tempSum = 0; + foreach ($item['members'] as $value){ + $userDb = User::find($value['account_id']); + $tempSum += $userDb['elo']; + } + array_push($tempSumList,$tempSum/count($item['members'])); + } + } + if (count($tempSumList) > 0){ + $opponentAvg = array_sum($tempSumList)/count($tempSumList); + //总胜率=70%*P(个人ELO值-敌队平均ELO值)+30%*P(己队平均ELO值-敌队平均ELO值) --> P(D)=1/(1+10^(-D/400)) + $winningPro = 1/(1+pow(10,(-(0.7*($userInfo['elo']-$opponentAvg)+0.3*($myAvg-$opponentAvg))/400))); + }else{ + error_log('ELO3-----无真人敌对队伍'); +// $winningPro = 0.5; + $winningPro = 1/(1+pow(10,(-(0.7*($userInfo['elo']-$myAvg)+0.3*(0))/400))); + } + error_log(json_encode( + array( + 'account_id' => $userInfo['account_id'], + 'myElo' =>$userInfo['elo'], + 'myAvg' => $myAvg, + 'myTeam' =>$myTeam, + 'opponentAvg'=>$tempSumList, + 'winningPro' => $winningPro, + ) + )); + return $winningPro; + } + + private function apply(&$battleData) + { + //战斗次数 + $this->incValue($battleData, 'total_battle_times', 1); + if (getXVal($this->allInfo,'team_mode', 0) == 0) { + //单人模式战斗次数 + $this->incValue($battleData, 'total_single_battle_times', 1); + //单人模式最高排名 + $this->minValue($battleData, 'single_battle_rank', getXVal($this->battleInfo,'pvp_personal_rank', 0)); + } else { + //组队模式最高排名 + $this->minValue($battleData, 'team_battle_rank', getXVal($this->allInfo,'pvp_team_rank', 0)); + //组队模式战斗次数 + $this->incValue($battleData, 'total_team_battle_times', 1); + //组队模式前15名次数 + if (getXVal($this->battleInfo,'pvp_personal_rank', 0) <= 15){ + $this->incValue($battleData, 'total_team_top_X_battle_times', 1); + } + } + //排名 + $ranked = getXVal($this->battleInfo,'pvp_team_rank', 0); + if ($ranked == 1) { + //吃鸡次数 + $this->incValue($battleData, 'total_win_times', 1); + } + if ($ranked <= 3 && $ranked>0){ + //排名前十 总次数 + $this->incValue($battleData, 'total_top_three_times', 1); + } + //击杀 + $kills = getXVal($this->battleInfo,'kills', 0); + if ($kills > 0) { + //击杀总次数 + $this->incValue($battleData, 'total_kills_times', $kills); + //单局最大击杀数 + $this->maxValue($battleData, 'max_kills_times', $kills); + } + //输出 + $damageOut = getXVal($this->battleInfo,'damage_out', 0); + if ($damageOut > 0) { + //伤害输出总量 + $this->incValue($battleData, 'total_damage_out', $damageOut); + //单局最大伤害输出 + $this->maxValue($battleData, 'max_damage_out', $damageOut); + } + //承伤 + $damageIn = getXVal($this->battleInfo,'damage_in', 0); + if ($damageIn > 0) { + //受到伤害总量 + $this->incValue($battleData, 'total_damage_in', $damageIn); + //单局最大受到伤害量 + $this->maxValue($battleData, 'max_damage_in', $damageIn); + } + //回复 + $recoverHp = getXVal($this->battleInfo,'recover_hp', 0); + if ($recoverHp > 0) { + //自疗总量 + $this->incValue($battleData, 'total_recover_hp', $recoverHp); + //单局最大自疗量 + $this->maxValue($battleData, 'max_recover_hp', $recoverHp); + } + //存活时间 + $aliveTime = getXVal($this->battleInfo,'alive_time', 0); + if ($aliveTime > 0) { + //总存活时间 + $this->incValue($battleData, 'total_alive_time', $aliveTime); + //单局最大存活时间 + $this->maxValue($battleData, 'max_alive_time', $aliveTime); + } + //救援次数 + $this->incValue($battleData, 'rescue_teammate_times', getXVal($this->battleInfo,'rescue_teammate_times', 0)); + //潜水次数 + $this->incValue($battleData, 'diving_times', getXVal($this->battleInfo,'diving_times', 0)); + //开启空投次数 + $this->incValue($battleData, 'open_airdrop_times', getXVal($this->battleInfo,'open_airdrop_times', 0)); + //使用药品次数 + $this->incValue($battleData, 'use_medicine_times', getXVal($this->battleInfo,'use_medicine_times', 0)); + //击毁机甲次数 + $this->incValue($battleData, 'destory_car_times', getXVal($this->battleInfo,'destory_car_times', 0)); + //使用伪装次数 + $this->incValue($battleData, 'use_camouflage_times', getXVal($this->battleInfo,'use_camouflage_times', 0)); + //使用技能次数 + $this->incValue($battleData, 'use_skill_times', getXVal($this->battleInfo,'use_skill_times', 0)); + //驾驶机甲移动距离 + $this->incValue($battleData, 'ride_car_move_distance', getXVal($this->battleInfo,'ride_car_move_distance', 0)); + //驾驶机甲击杀数 + $this->incValue($battleData, 'ride_car_kills', getXVal($this->battleInfo,'ride_car_kills', 0)); + //使用的英雄最高等级 + $this->maxValue($battleData, 'max_single_battle_hero_lv', getXVal($this->battleInfo,'max_single_battle_hero_lv', 0)); + $this->procWeaponsEquip($battleData); + $this->procWeaponsSlot($battleData); + $this->procHeros($battleData); + if (!isset($battleData['createtime'])) { + $battleData['createtime'] = myself()->_getNowTime(); + } + $battleData['modifytime'] = myself()->_getNowTime(); + } + + private function procWeaponsEquip(&$battleData) + { + if (!isset($battleData['weapons_type_data'])) { + $battleData['weapons_type_data'] = array(); + } + //武器类型数据 + $weaponsTypeDb = &$battleData['weapons_type_data']; + { + $tmpStrs1 = explode('|', getXVal($this->battleInfo,'weapons_type', '')); + foreach ($tmpStrs1 as $str) { + $tmpStrs2 = explode(':', $str); + if (count($tmpStrs2) >= 4) { + list($weaponId, $kills, $damageOut, $obtainCount) = $tmpStrs2; + $weaponMeta = mt\Equip::get($weaponId); + if ($weaponMeta) { + $key = $weaponMeta['equip_type'] . '_' . $weaponMeta['equip_subtype']; + if (!isset($weaponsTypeDb[$key])) { + $weaponsTypeDb[$key] = array(); + } + //使用此种类型武器击杀数 + $this->incValue($weaponsTypeDb, 'kills', $kills); + //使用此种武器伤害输出 + $this->incValue($weaponsTypeDb, 'damage_out', $damageOut); + //战斗中获得此种武器数量 + $this->incValue($weaponsTypeDb, 'obtain_count', $obtainCount); + } + } + } + } + } + + private function procWeaponsSlot(&$battleData) + { + if (!isset($battleData['weapons_slot_data'])) { + $battleData['weapons_slot_data'] = array(); + } + //武器槽位数据 + $weaponsSlotDb = &$battleData['weapons_slot_data']; + { + $tmpStrs1 = explode('|', getXVal($this->battleInfo,'weapons_slot', '')); + foreach ($tmpStrs1 as $str) { + $tmpStrs2 = explode(':', $str); + if (count($tmpStrs2) >= 4) { + list($weaponId, $use_times) = $tmpStrs2; + $weaponMeta = mt\Equip::get($weaponId); + if ($weaponMeta && $weaponMeta['inventory_slot'] > 0) { + $key = $weaponMeta['inventory_slot']; + if (!isset($weaponsSlotDb[$key])) { + $weaponsSlotDb[$key] = array(); + } + //使用次数 + $this->incValue($weaponsSlotDb, 'use_times', $use_times); + } + } + } + } + } + + private function procHeros(&$battleData) + { + if (!isset($battleData['hero_data'])) { + $battleData['hero_data'] = array(); + } + //英雄数据 + $heroDb = &$battleData['hero_data']; + { + $tmpStrs1 = explode('|', getXVal($this->battleInfo,'heros', '')); + foreach ($tmpStrs1 as $str) { + $tmpStrs2 = explode(':', $str); + if (count($tmpStrs2) >= 4) { + list($heroId, $skillLv, $weaponLv) = $tmpStrs2; + $heroMeta = mt\Item::get($heroId); + if ($heroMeta && $heroMeta['type'] == mt\Item::HERO_TYPE) { + $key = $heroMeta['id']; + if (!isset($heroDb[$key])) { + $heroDb[$key] = array(); + } + //最大技能等级 + $this->maxValue($heroDb, 'skill_lv', $skillLv); + //最大武器等级 + $this->maxValue($heroDb, 'weapon_lv', $weaponLv); + } + } + } + } + + //统计使用的英雄及枪械的信息 + if (!isset($battleData['hero_info'])) { + $battleData['hero_info'] = array(); + } + $heroInfo = &$battleData['hero_info']; + { + $hero_uniid = getXVal($this->battleInfo,'hero_uniid', ''); + $hero = Hero::find($hero_uniid); + if ($hero){ + if (!isset($heroInfo[$hero['hero_id']])){ + $heroInfo[$hero['hero_id']] = array(); + } + $this->incValue($heroInfo[$hero['hero_id']], "use_times", 1); //每个英雄使用次数 + $ranked = getXVal($this->battleInfo,'pvp_team_rank', 0); + if ($ranked == 1) { + //吃鸡次数 + $this->incValue($heroInfo[$hero['hero_id']], 'win_times', 1);//使用该英雄吃鸡获胜次数 + } + if ($ranked <= 10){ + //排名前十 总次数 + $this->incValue($heroInfo[$hero['hero_id']], 'top_ten_times', 1);//使用该英雄进前十次数 + } + if (!isset($heroInfo[$hero['hero_id']]['weapon'])){ + $heroInfo[$hero['hero_id']]['weapon'] = array(); + } + $weapon_uuid1 = getXVal($this->battleInfo,'weapon_uuid1', 0); + $weapon1 = Gun::find($weapon_uuid1); + if ($weapon1){ + $this->incValue($heroInfo[$hero['hero_id']]['weapon'], $weapon1['gun_id'], 1);//该英雄下选用每个武器的次数 + } + $weapon_uuid2 = getXVal($this->battleInfo,'weapon_uuid2', 0); + $weapon2 = Gun::find($weapon_uuid2); + if ($weapon2){ + $this->incValue($heroInfo[$hero['hero_id']]['weapon'], $weapon2['gun_id'], 1);//该英雄下选用每个武器的次数 + } + } + } + } + + private function incValue(&$battleData, $key, $val) + { + if ($val > 0) { + $battleData[$key] = getXVal($battleData, $key, 0) + $val; + } + } + + private function minValue(&$battleData, $key, $val) + { + $battleData[$key] = min(getXVal($battleData, $key, 0), $val); + } + + private function maxValue(&$battleData, $key, $val) + { + $battleData[$key] = max(getXVal($battleData, $key, 0), $val); + } + + private function _addHashRateTask(){ + error_log("_addHashRateTask"); + //击杀 + HashRateTask::incRecordNum(HashRateTask::KILL_TYPE,getXVal($this->battleInfo,'kills', 0)); + //存活时间、战斗时长 + HashRateTask::incRecordNum(HashRateTask::BATTLE_TIME_TYPE,getXVal($this->battleInfo,'alive_time', 0)); + //吃鸡、4v4吃鸡 + $ranked = getXVal($this->battleInfo,'pvp_team_rank', 0); + if ($ranked == 1){ + HashRateTask::incRecordNum(HashRateTask::BATTLE_WIN_TYPE,1); +// HashRateTask::incRecordNum(HashRateTask::VS_FOUR_BATTLE_WIN_TYPE,1); + } + //承伤 + HashRateTask::incRecordNum(HashRateTask::DAMAGE_TYPE,getXVal($this->battleInfo,'damage_in', 0)); + } + } \ No newline at end of file