mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('webstats');">服务</p>
|
||||
<p onclick="pluginConfig('webstats');">概览</p>
|
||||
<p onclick="pluginConfig('webstats');">全局设置</p>
|
||||
<p onclick="wsGlobalSetting();">全局设置</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
@@ -12,7 +12,12 @@
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
resetPluginWinWidth(800);
|
||||
|
||||
$.getScript( "/plugins/file?name=webstats&f=js/stats.js", function(){
|
||||
pluginService('webstats');
|
||||
});
|
||||
|
||||
$.getScript( "/plugins/file?name=webstats&f=js/setting.js", function(){
|
||||
console.log("webstats setting load done");
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
function wsGlobalSetting(){
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
function str2Obj(str){
|
||||
var data = {};
|
||||
kv = str.split('&');
|
||||
for(i in kv){
|
||||
v = kv[i].split('=');
|
||||
data[v[0]] = v[1];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function wsPost(method, version, args,callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'webstats';
|
||||
req_data['func'] = method;
|
||||
req_data['version'] = version;
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
req_data['args'] = JSON.stringify(str2Obj(args));
|
||||
} else {
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/run', req_data, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
//错误展示10S
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function wsPostCallbak(method, version, args,callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'webstats';
|
||||
req_data['func'] = method;
|
||||
args['version'] = version;
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
req_data['args'] = JSON.stringify(str2Obj(args));
|
||||
} else {
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/callback', req_data, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
@@ -12,11 +12,7 @@ log_by_lua_block {
|
||||
package.path = cpath .. "?.lua;" .. package.path
|
||||
end
|
||||
|
||||
local server_name,ip,today,day,body_length,method,config,cache_count
|
||||
|
||||
local db = nil
|
||||
local cache = ngx.shared.mw_total
|
||||
|
||||
-- debug func
|
||||
local function D(msg)
|
||||
if not debug_mode then return true end
|
||||
local fp = io.open('{$SERVER_APP}/debug.log', 'ab')
|
||||
@@ -35,6 +31,33 @@ log_by_lua_block {
|
||||
end
|
||||
|
||||
|
||||
-- cache start ---
|
||||
local cache = ngx.shared.mw_total
|
||||
local function cache_set(server_name, id ,key, val)
|
||||
local line_kv = "log_kv_"..server_name..'_'..id.."_"..key
|
||||
cache:set(line_kv, val)
|
||||
end
|
||||
|
||||
local function cache_clear(server_name, id, key)
|
||||
local line_kv = "log_kv_"..server_name..'_'..id.."_"..key
|
||||
cache:delete(line_kv)
|
||||
end
|
||||
|
||||
local function cache_get(server_name, id, key)
|
||||
local line_kv = "log_kv_"..server_name..'_'..id.."_"..key
|
||||
local value = cache:get(line_kv)
|
||||
return value
|
||||
end
|
||||
-- cache end ---
|
||||
|
||||
-- domain config is import
|
||||
local server_name
|
||||
|
||||
local ip,today,day,body_length,method,config,cache_count
|
||||
local db = nil
|
||||
|
||||
|
||||
|
||||
local function run_app()
|
||||
D("debug start")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user