/** * Created by gqs on 2020/8/5. */ //"http://120.55.160.15:8081/Webservice/DMWebservice";// //WebService_URL = "http://localhost:8080/Webservice/DMWebservice"; //method 方法名 //variable 参数数组 //value 值数组 //callbackFun 查询结果返回监听方法 //keyValue 查询携带标识 查询结束返回 //showloading 请求是否需要进度条 function WsCommonClass(method, variable, value, callbackFun,keyValue){ var showloading = false; //var WebService_URL = "http://df.soyi.sh.cn:8081/CommonLibaryTwo/DMWebservice"; //var WebService_URL = "https://gc.china-gis.com:8080/CommonLibary/DMWebservice"; var WebService_URL = "https://df.soyi.sh.cn/wjsTwo/DMWebservice"; //var WebService_URL = "https://gc.china-gis.com:8080/wjsTwo/DMWebservice"; if(showloading != true) showloading = false; if(showloading) showLoadingWin(); //加载进度条 var _variable = variable; //变量名数组 var _value = value; //参数数组 if (_variable.length != _value.length) { return "参数不正确!"; } var data = ""; //请求参数 for (var i = 0; i < _variable.length; i++) { //遍历组合查询条件 if (i == 0) { data += _value[i].replace("/to_/g","dbo.to_").replace("/||/g","+") + "&"; }else { data += _value[i] + "&"; } } $.base64.utf8encode = true; data = $.base64.btoa(data); //base64 加密 console.log(data) $.ajax({ url : WebService_URL, type : 'post', dataType: "json", data:JSON.stringify({method:method,data:data}), //data:{method:method,data:data}, jsonp: "callback", contentType: "application/json", async: true, success: function(json) { if(showloading) hideLoadingWin(); //查询完成 隐藏进度条 if(json[0].IsSuc=="Success"){ if (callbackFun) callbackFun(json[0], keyValue); //回调函数 }else{ alert(json[0].Msg); console.log(json[0].Msg,value) } }, error: function(e) { if(showloading) hideLoadingWin(); //查询失败 隐藏进度条 // alert(e.responseText); console.log(e.responseText) }, }); // $.ajax({ // type: "POST", // url: WebService_URL, // data:{method:method,data:data}, // dataType: "json", // success: function(json) { // if(showloading) hideLoadingWin(); //查询完成 隐藏进度条 // if(json[0].IsSuc=="Success"){ // if (callbackFun) callbackFun(json[0], keyValue); //回调函数 // }else{ // alert(json[0].Msg); // } // }, // error: function(e) { // if(showloading) hideLoadingWin(); //查询失败 隐藏进度条 // alert(e.responseText); // }, // }); } function showLoadingWin(){ if($('#my-modal-loading').length>0) $('#my-modal-loading').modal('open'); } function hideLoadingWin(){ if($('#my-modal-loading').length>0) $('#my-modal-loading').modal('close'); } function WsCommonClassMsg(method, variable, value, callbackFun,keyValue,showloading,extraData){ var WebService_URL ="https://df.soyi.sh.cn/SendMsgApp/DMWebservice"; if(showloading != true) showloading = false; if(showloading) showLoadingWin(); //加载进度条 var _variable = variable; //变量名数组 var _value = value; //参数数组 if (_variable.length != _value.length) { return "参数不正确!"; } var data = ""; //请求参数 $.base64.utf8encode = true; data = $.base64.btoa(_value[0]); //base64 加密 $.ajax({ type: "POST", url: WebService_URL, data:{method:method,data:_value[0]}, dataType: "json", success: function(json) { if(json.code=="200"){ if (callbackFun) callbackFun(json, keyValue,extraData); //回调函数 }else if(json.code=="1"){ if (callbackFun) callbackFun(json, keyValue,extraData); //回调函数 } }, error: function(e) { if(showloading) hideLoadingWin(); //查询失败 隐藏进度条 //alert(e.responseText); }, }); }