This commit is contained in:
aozhiwei 2019-03-26 10:05:38 +08:00
commit a117c1fa08
8 changed files with 98 additions and 0 deletions

10
boundle.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
tag_name=`git status |grep '# On branch '|sed 's/# On branch //g'`
dir_name=`basename $PWD`
package_name=${dir_name}.tar.gz
#echo $tag_name
#echo $dir_name
#echo $package_name
tar --exclude=*.git -chzf target/${package_name} webapp config reload.sh restart.sh

1
reload.sh Normal file
View File

@ -0,0 +1 @@
echo 'success'

1
restart.sh Normal file
View File

@ -0,0 +1 @@
echo 'success'

View File

@ -0,0 +1,54 @@
<?php
$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;
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) {
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) {
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,6 @@
<?php
ini_set('date.timezone','Asia/Shanghai');
require 'phpcommon/common.php';
require 'config_loader.php';

View File

@ -0,0 +1 @@
../phpcommon/Controller/OpsController.class.php

24
webapp/index.php Normal file
View File

@ -0,0 +1,24 @@
<?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__');
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