This commit is contained in:
wangwei01 2019-04-03 11:34:22 +08:00
parent a5ba40baee
commit ec9f18839f
2 changed files with 27 additions and 2 deletions

View File

@ -41,12 +41,26 @@ CREATE TABLE `user` (
`accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`user_name` varchar(50) DEFAULT '' COMMENT '用户名字',
`avatar_url` varchar(256) NOT NULL DEFAULT '' COMMENT '用户头像',
PRIMARY KEY (`idx`),
UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Table structure for table `skin`
--
DROP TABLE IF EXISTS `skin`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!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)',
`skin_id` int(11) NOT NULL COMMENT '皮肤id',
`skin_status` int(11) NOT NULL COMMENT '皮肤状态',
`frgment_num` int(11) NOT NULL COMMENT '碎片数量',
`active_time` varchar(50) NOT NULL DEFAULT '有效时间',
PRIMARY KEY (`idx`)
UNIQUE KEY `accountid` (`accountid`),
PRIMARY KEY (`idx`),
KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@ -3,6 +3,7 @@
$g_conf_mysql_cluster = require('../config/game2001api.mysql.cluster.php');
$g_conf_redis_cluster = require('../config/game2001api.redis.cluster.php');
function checkMysqlConfig()
{
$instance_id = 1;
@ -30,6 +31,7 @@ function checkRedisConfig()
}
}
function getMysqlConfig($hash_value)
{
if ($hash_value < 0) {
@ -50,5 +52,14 @@ function getRedisConfig($hash_value)
return $g_conf_redis_cluster[$idx];
}
function getSkinConfig($g_conf_skin_cluster ,$hash_value)
{
if ($hash_value < 0) {
die('hash_value < 0 ' . $hash_value);
}
$idx = $hash_value % count($g_conf_skin_cluster);
return $g_conf_skin_cluster[$idx];
}
checkMysqlConfig();
checkRedisConfig();