mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
2 years ago
|
function maPost(method,args,callback){
|
||
|
var _args = null;
|
||
|
if (typeof(args) == 'string'){
|
||
|
_args = JSON.stringify(toArrayObject(args));
|
||
|
} else {
|
||
|
_args = JSON.stringify(args);
|
||
|
}
|
||
|
|
||
|
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||
|
$.post('/plugins/run', {name:'migration_api', func:method, args:_args}, 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');
|
||
|
}
|
||
|
|
||
|
function maAsyncPost(method,args){
|
||
|
var _args = null;
|
||
|
if (typeof(args) == 'string'){
|
||
|
_args = JSON.stringify(toArrayObject(args));
|
||
|
} else {
|
||
|
_args = JSON.stringify(args);
|
||
|
}
|
||
|
return syncPost('/plugins/run', {name:'migration_api', func:method, args:_args});
|
||
|
}
|
||
|
|
||
|
function maPostCallbak(method, args, callback){
|
||
|
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||
|
|
||
|
var req_data = {};
|
||
|
req_data['name'] = 'migration_api';
|
||
|
req_data['func'] = method;
|
||
|
args['version'] = '1.0';
|
||
|
|
||
|
if (typeof(args) == 'string'){
|
||
|
req_data['args'] = JSON.stringify(toArrayObject(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');
|
||
|
}
|