This commit is contained in:
aozhiwei 2019-09-24 10:33:23 +08:00
parent dd03169d44
commit 5bc6c866b8
5 changed files with 184 additions and 2 deletions

View File

@ -41,12 +41,99 @@ CREATE TABLE `user` (
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`user_name` tinyblob COMMENT '用户名字', `user_name` tinyblob COMMENT '用户名字',
`avatar_url` varchar(256) NOT NULL DEFAULT '' COMMENT '用户头像', `avatar_url` varchar(256) NOT NULL DEFAULT '' COMMENT '用户头像',
`coin_num` bigint NOT NULL COMMENT '角色金币', `coin_num` bigint NOT NULL DEFAULT '0' COMMENT '角色金币',
`integral` bigint NOT NULL COMMENT '角色积分', `diamond_num` bigint NOT NULL DEFAULT '0' COMMENT '角色钻石',
`energy` int(11) NOT NULL DEFAULT '0' COMMENT '角色体力',
`create_time` int(11) NOT NULL DEFAULT '0'COMMENT '创建时间',
`modify_time` int(11) NOT NULL DEFAULT '0'COMMENT '修改时间',
`collect_status` int(11) NOT NULL DEFAULT '0'COMMENT '收藏状态(0:未领取,1:已领取)',
`kefu_status` int(11) NOT NULL DEFAULT '0' COMMENT '客服奖励状态(0:未领取,1:已领取)',
`pass_status` int(11) NOT NULL DEFAULT '0'COMMENT '浮窗状态(0:未领取,1:已领取)',
`sign_sum` int(11) NOT NULL DEFAULT '0' COMMENT '签到总天数',
`box_num` int(11) NOT NULL DEFAULT '0' COMMENT '空投宝箱数量',
`pass` int(11) NOT NULL DEFAULT '0' COMMENT '当前关卡',
PRIMARY KEY (`idx`), PRIMARY KEY (`idx`),
UNIQUE KEY `accountid` (`accountid`) UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Table structure for table `tank`
--
DROP TABLE IF EXISTS `tank`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tank` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`tank_id` int(11) NOT NULL DEFAULT '0' COMMENT '坦克位置id',
`tank_level` int(11) NOT NULL DEFAULT '0' COMMENT '坦克等级',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `tank_uuid` (`accountid`, `tank_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Table structure for table `sign`
--
DROP TABLE IF EXISTS `sign`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sign` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`sign_id` int(11) NOT NULL DEFAULT '0' COMMENT '补签id',
`signable` int(11) NOT NULL DEFAULT '0' COMMENT '是否签到',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
`sign_time` int(11) NOT NULL DEFAULT '0' COMMENT '签到时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `account_sign_id` (`accountid`, `sign_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Table structure for table `hang`
--
DROP TABLE IF EXISTS `hang`;·
/*!40101 SET @saved_cs_client = @@character_set_client*/;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `hang` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`hang_time` int(11) NOT NULL DEFAULT '0' COMMENT '领取时间',
`num` int(11) NOT NULL DEFAULT '0' COMMENT '每秒产生金币数量',
`speed_time` int(11) NOT NULL DEFAULT '0' COMMENT '加速截止时间',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Table structure for table `share_achievement`
--
DROP TABLE IF EXISTS `share_achievement`;
/*!40101 SET @saved_cs_client = @@character_set_client*/;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `share_achievement` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`ach_id` int(11) NOT NULL DEFAULT '0' COMMENT '分享邀请成就id',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '状态(0:未领取,1:已领取)',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `accountid_ach_id` (`accountid`, `ach_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;

View File

@ -0,0 +1,57 @@
<?php
$g_conf_mysql_cluster = require('../config/game2003api.mysql.cluster.php');
$g_conf_redis_cluster = require('../config/game2003api.redis.cluster.php');
function checkMysqlConfig()
{
$instance_id = 1;
global $g_conf_mysql_cluster;
foreach ($g_conf_mysql_cluster as $instance) {
if ($instance_id != $instance['instance_id']) {
error_log('game2001api.mysql.cluster.php config error');
die();
}
$instance_id++;
}
}
function checkRedisConfig()
{
$instance_id = 1;
global $g_conf_redis_cluster;
foreach ($g_conf_redis_cluster as $instance) {
if ($instance_id != $instance['instance_id']) {
error_log('game2001api.redis.cluster.php config error');
die();
}
$instance_id++;
}
}
function getMysqlConfig($hash_value)
{
if ($hash_value < 0) {
error_log('callstack:' . json_encode(debug_backtrace(), JSON_PRETTY_PRINT));
die('hash_value < 0 ' . $hash_value);
}
global $g_conf_mysql_cluster;
$idx = $hash_value % count($g_conf_mysql_cluster);
return $g_conf_mysql_cluster[$idx];
}
function getRedisConfig($hash_value)
{
if ($hash_value < 0) {
error_log('callstack:' . json_encode(debug_backtrace(), JSON_PRETTY_PRINT));
die('hash_value < 0 ' . $hash_value);
}
global $g_conf_redis_cluster;
$idx = $hash_value % count($g_conf_redis_cluster);
return $g_conf_redis_cluster[$idx];
}
checkMysqlConfig();
checkRedisConfig();

View File

@ -0,0 +1,5 @@
<?php
ini_set('date.timezone','Asia/Shanghai');
require 'phpcommon/common.php';
require 'config_loader.php';

32
webapp/index.php Normal file
View File

@ -0,0 +1,32 @@
<?php
require 'bootstrap/init.php';
if (empty($_REQUEST['c']) || empty($_REQUEST['a'])) {
die();
return;
}
function autoload_controller__($classname)
{
require_once "controller/$classname.class.php";
spl_autoload_unregister('autoload_controller__');
}
spl_autoload_register('autoload_controller__');
function loginVerify($accountid, $sessionid)
{
if (!phpcommon\isValidSessionId($accountid, $sessionid)) {
return false;
}
return true;
}
try{
$c = $_REQUEST['c'];
$a = $_REQUEST['a'];
$classname = $c .'Controller';
$obj = eval('return (new $classname())->$a();');
} catch (Exception $e){
echo($e);
}

1
webapp/phpcommon Symbolic link
View File

@ -0,0 +1 @@
../third_party/phpcommon