1
This commit is contained in:
parent
2f81f84c70
commit
8aa3b635c4
15
doc/Bag.py
15
doc/Bag.py
@ -38,4 +38,19 @@ class Bag(object):
|
|||||||
['property_chg', _common.PropertyChg(), '属性变更'],
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'rename',
|
||||||
|
'desc': '改名(优先扣改名卡没有则扣钻石)',
|
||||||
|
'group': 'Bag',
|
||||||
|
'url': 'webapp/index.php?c=Bag&a=rename',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
['name', '', '新的角色名'],
|
||||||
|
['name_sign', '', '名字签名)'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
23
doc/GM.py
Normal file
23
doc/GM.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import _common
|
||||||
|
|
||||||
|
class GM(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.apis = [
|
||||||
|
{
|
||||||
|
'name': 'exeCmd',
|
||||||
|
'desc': '执行gm指令(格式:".指令 参数1 参数2 ...", 查看指令帮助".help")',
|
||||||
|
'group': 'GM',
|
||||||
|
'url': 'webapp/index.php?c=GM&a=execCmd',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
['cmd', '', '指令及参数']
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['text', '', '回显文字']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
@ -10,50 +10,8 @@ class GMController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clearDB()
|
public function execCmd()
|
||||||
{
|
{
|
||||||
global $g_conf_mysql_cluster;
|
|
||||||
foreach ($g_conf_mysql_cluster as $mysql_conf) {
|
|
||||||
$conn = new phpcommon\Mysql(array(
|
|
||||||
'host' => $mysql_conf['host'],
|
|
||||||
'port' => $mysql_conf['port'],
|
|
||||||
'user' => $mysql_conf['user'],
|
|
||||||
'passwd' => $mysql_conf['passwd'],
|
|
||||||
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
|
|
||||||
));
|
|
||||||
$tables = $conn->execQueryAsArray('show tables;');
|
|
||||||
foreach ($tables as $table) {
|
|
||||||
$tblName = $table[0];
|
|
||||||
$conn->execScript("DELETE FROM {$tblName};",
|
|
||||||
arary());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSysTime()
|
|
||||||
{
|
|
||||||
echo phpcommon\timestamp_to_datetime(phpcommon\getNowTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setSysTime()
|
|
||||||
{
|
|
||||||
if (!defined('GLOBAL_TIME_OFFSET_KEY')) {
|
|
||||||
die('不支持设置系统时间');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$newtime = strtotime($_REQUET['newtime']);
|
|
||||||
if ($newtime <= 0) {
|
|
||||||
die('时间格式错误');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$time_offset = $newtime - phpcommon\getRealTime();
|
|
||||||
$r = new phpcommon\Redis(array(
|
|
||||||
'host' => '127.0.0.1',
|
|
||||||
'port' => 6379,
|
|
||||||
'passwd' => ''
|
|
||||||
|
|
||||||
));
|
|
||||||
$r->set(GLOBAL_TIME_OFFSET_KEY, $time_offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
59
webapp/controller/ToolsController.class.php
Normal file
59
webapp/controller/ToolsController.class.php
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ToolsController extends BaseController {
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
if (SERVER_ENV == _ONLINE) {
|
||||||
|
die("can't create GMController");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clearDB()
|
||||||
|
{
|
||||||
|
global $g_conf_mysql_cluster;
|
||||||
|
foreach ($g_conf_mysql_cluster as $mysql_conf) {
|
||||||
|
$conn = new phpcommon\Mysql(array(
|
||||||
|
'host' => $mysql_conf['host'],
|
||||||
|
'port' => $mysql_conf['port'],
|
||||||
|
'user' => $mysql_conf['user'],
|
||||||
|
'passwd' => $mysql_conf['passwd'],
|
||||||
|
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
|
||||||
|
));
|
||||||
|
$tables = $conn->execQueryAsArray('show tables;');
|
||||||
|
foreach ($tables as $table) {
|
||||||
|
$tblName = $table[0];
|
||||||
|
$conn->execScript("DELETE FROM {$tblName};",
|
||||||
|
arary());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSysTime()
|
||||||
|
{
|
||||||
|
echo phpcommon\timestamp_to_datetime(phpcommon\getNowTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSysTime()
|
||||||
|
{
|
||||||
|
if (!defined('GLOBAL_TIME_OFFSET_KEY')) {
|
||||||
|
die('不支持设置系统时间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$newtime = strtotime($_REQUET['newtime']);
|
||||||
|
if ($newtime <= 0) {
|
||||||
|
die('时间格式错误');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$time_offset = $newtime - phpcommon\getRealTime();
|
||||||
|
$r = new phpcommon\Redis(array(
|
||||||
|
'host' => '127.0.0.1',
|
||||||
|
'port' => 6379,
|
||||||
|
'passwd' => ''
|
||||||
|
|
||||||
|
));
|
||||||
|
$r->set(GLOBAL_TIME_OFFSET_KEY, $time_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user