...
|
...
|
@@ -63,41 +63,11 @@ class Service { |
|
|
|
|
|
_post(path, data) {
|
|
|
let method = path ? this.url + path : API_HOST;
|
|
|
let pathIndex = g_sourceApiArry.indexOf(path);
|
|
|
|
|
|
let executeReq = () => {
|
|
|
//适配服务器更换Java接口,开关控制是否切换
|
|
|
if (app.globalData.switch_javaApiEnable && pathIndex >= 0 && pathIndex < g_toJavaApiArry.length) {
|
|
|
method = API_HOST;
|
|
|
data.method = g_toJavaApiArry[pathIndex];
|
|
|
}
|
|
|
return POST(method, data).then(result => {
|
|
|
|
|
|
//适配服务器更换Java接口,开关控制是否切换
|
|
|
if (app.globalData.switch_javaApiEnable && pathIndex >= 0) {
|
|
|
let newData = Humps.decamelizeKeys(result.data);
|
|
|
result.data = newData;
|
|
|
}
|
|
|
return result;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (!app.globalData.hasSetSwitch) {
|
|
|
return iconfSwitch().then(data => {
|
|
|
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> _post switch');
|
|
|
app.globalData.hasSetSwitch = true;
|
|
|
if (data['disableJavaApi'] && md5('disableJavaApi') === data['disableJavaApi']) { // TODO 键值确认
|
|
|
app.globalData.switch_javaApiEnable = false;
|
|
|
}
|
|
|
return executeReq();
|
|
|
}, () => {
|
|
|
app.globalData.hasSetSwitch = true;
|
|
|
return executeReq();
|
|
|
});
|
|
|
} else {
|
|
|
return executeReq();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export default Service; |
|
|
\ No newline at end of file |
...
|
...
|
|