This commit is contained in:
wangwei01 2019-05-15 16:48:28 +08:00
parent 7fac9a43fe
commit 3b3c1cae09
3 changed files with 34 additions and 14 deletions

View File

@ -38,8 +38,8 @@ DROP TABLE IF EXISTS `user`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`user_name` varchar(50) DEFAULT '' COMMENT '用户名字',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`user_name` varchar(50) NOT NULL DEFAULT '' COMMENT '用户名字',
`avatar_url` varchar(256) NOT NULL DEFAULT '' COMMENT '用户头像',
`rank` int(11) NOT NULL COMMENT '用户排名(世界排名)',
`game_times` int(11) NOT NULL COMMENT '游戏场次',
@ -55,7 +55,7 @@ CREATE TABLE `user` (
`harm_his` int(11) NOT NULL COMMENT '最高伤害',
`add_HP_his` int(11) NOT NULL COMMENT '最多治疗量',
PRIMARY KEY (`idx`),
KEY `accountid` (`accountid`)
UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
@ -67,7 +67,7 @@ DROP TABLE IF EXISTS `skin`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `skin` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`skin_id` int(11) NOT NULL COMMENT '皮肤id',
`skin_status` int(11) NOT NULL COMMENT '皮肤状态',
`fragment_id` int(11) NOT NULL COMMENT '碎片id',
@ -87,7 +87,7 @@ DROP TABLE IF EXISTS `equip`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `equip` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`equip_id` int(11) NOT NULL COMMENT '装备id',
`equip_level` int(11) NOT NULL COMMENT '装备等级',
`equip_experience_level` int(11) NOT NULL COMMENT '装备体验等级',
@ -106,7 +106,7 @@ DROP TABLE IF EXISTS `supplybox`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `supplybox` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`box_id` int(11) NOT NULL COMMENT '补给箱id',
`box_num` int(11) NOT NULL COMMENT '补给箱数量',
`buy_times` int(11) NOT NULL COMMENT '购买次数',
@ -125,12 +125,12 @@ DROP TABLE IF EXISTS `sign`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sign` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`sign_days` int(11) NOT NULL COMMENT '已签天数',
`signable` int(11) NOT NULL COMMENT '是否可签',
`sign_time` varchar(50) NOT NULL DEFAULT '签到时间',
PRIMARY KEY (`idx`),
KEY `accountid` (`accountid`)
UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -143,10 +143,10 @@ DROP TABLE IF EXISTS `hang`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `hang` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`hang_time` varchar(50) NOT NULL DEFAULT '领取时间',
PRIMARY KEY (`idx`),
KEY `accountid` (`accountid`)
UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -159,7 +159,7 @@ DROP TABLE IF EXISTS `quest`;
/*!40101 SET character_set_client = utf8*/;
CREATE TABLE `quest` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`quest_id` int(11) NOT NULL COMMENT '任务id',
`quest_num` int(11) NOT NULL COMMENT '任务进度',
`quest_type` int(11) NOT NULL COMMENT '任务类型',
@ -177,13 +177,13 @@ DROP TABLE IF EXISTS `active`;
/*!40101 SET character_set_client = utf8*/;
CREATE TABLE `active` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`active_num` int(11) NOT NULL COMMENT '日活跃度',
`num_time` varchar(50) NOT NULL DEFAULT '日活跃度时间',
`active_sum` int(11) NOT NULL COMMENT '周活跃度',
`sum_time` varchar(50) NOT NULL DEFAULT '周活跃度时间',
PRIMARY KEY (`idx`),
KEY `accountid` (`accountid`)
UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -196,7 +196,7 @@ DROP TABLE IF EXISTS `history_record`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `history_record`(
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`map_name` varchar(50) DEFAULT '' COMMENT '地图名字',
`game_time` int(11) NOT NULL COMMENT '游戏完成时间',
`rank` int(11) NOT NULL COMMENT '游戏排名',

View File

@ -52,6 +52,9 @@ class RankController{
$kill_db = json_decode($kill_rank_db);
$i = 0;
foreach ($kill_db as $kill) {
if ($i > 99) {
break;
}
if ($kill_db[$i][0] == $account_id) {
$kill_rank = $i + 1;
}
@ -73,6 +76,9 @@ class RankController{
$alive_db = json_decode($alive_rank_db);
$i = 0;
foreach ($alive_db as $alive) {
if ($i > 99) {
break;
}
if ($alive_db[$i][0] == $account_id) {
$alive_rank = $i + 1;
}
@ -94,6 +100,9 @@ class RankController{
$harm_db = json_decode($harm_rank_db);
$i = 0;
foreach ($harm_db as $harm) {
if ($i > 99) {
break;
}
if ($harm_db[$i][0] == $account_id) {
$harm_rank = $i + 1;
}
@ -115,6 +124,9 @@ class RankController{
$rate_db = json_decode($rate_rank_db);
$i = 0;
foreach ($rate_db as $rate) {
if ($i > 99) {
break;
}
if ($rate_db[$i][0] == $account_id) {
$rate_rank = $i + 1;
}
@ -136,6 +148,9 @@ class RankController{
$win_db = json_decode($win_rank_db);
$i = 0;
foreach ($win_db as $win) {
if ($i > 99) {
break;
}
if ($win_db[$i][0] == $account_id) {
$win_rank = $i + 1;
}

View File

@ -27,6 +27,10 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
if (empty($_REQUEST['account_id'])) {
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
return;
}
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id
@ -39,6 +43,7 @@ class RoleController{
':user_name' => $user_name,
':avatar_url' => $avatar_url
));
var_dump($ret);
if (!$ret) {
die();
return;