diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 09c9479..ba1c997 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -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 */; diff --git a/webapp/bootstrap/config_loader.php b/webapp/bootstrap/config_loader.php index e85f138..dde2fb6 100644 --- a/webapp/bootstrap/config_loader.php +++ b/webapp/bootstrap/config_loader.php @@ -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();