|
@ -199,7 +199,6 @@ public class MobileNetWork extends Plugin {
|
199
|
199
|
}
|
200
|
200
|
}
|
201
|
201
|
|
202
|
|
@SuppressWarnings({ "static-access" })
|
203
|
202
|
private String requestBizData(String dataAction, IData param) throws Exception {
|
204
|
203
|
Map<String,String> postData = transPostData(dataAction, param);
|
205
|
204
|
String encode = MobileConfig.getInstance().getEncode();
|
|
@ -207,7 +206,7 @@ public class MobileNetWork extends Plugin {
|
207
|
206
|
dataUrl = HttpTool.urlEncode(dataUrl, encode);
|
208
|
207
|
String result = HttpTool.httpRequest(MobileConfig.getInstance().getRequestUrl(),
|
209
|
208
|
dataUrl, Constant.HTTP_POST);
|
210
|
|
if (ServerDataConfig.getInstance().isEncrypt(dataAction)) {
|
|
209
|
if (ServerDataConfig.isEncrypt(dataAction)) {
|
211
|
210
|
result = MobileSecurity.responseDecrypt(result);
|
212
|
211
|
}
|
213
|
212
|
return result;
|
|
@ -218,15 +217,17 @@ public class MobileNetWork extends Plugin {
|
218
|
217
|
Map<String, String> postData = new HashMap<String, String>();
|
219
|
218
|
postData.put(Constant.Server.ACTION, dataAction);
|
220
|
219
|
if (ServerDataConfig.isEncrypt(dataAction)) {
|
221
|
|
String paramData = dataParam == null ? "{}" : dataParam.toString();
|
|
220
|
MobileSecurity.init(context);
|
222
|
221
|
/* 参数加密处理 */
|
223
|
|
String encryptData = MobileSecurity.requestEncrypt(paramData);
|
224
|
|
String key = MobileSecurity.getDesKey(context);
|
225
|
|
/* 将+号全部转换成-号 */
|
226
|
|
encryptData = encryptData.replace("+", "-");
|
227
|
|
key = key.replace("+", "-");
|
228
|
|
postData.put(Constant.Server.DATA, encryptData);
|
|
222
|
String key = MobileSecurity.getDesKey();
|
|
223
|
key = key.replace("+", "-");//将+号全部转换成-号
|
229
|
224
|
postData.put(Constant.Server.KEY, key);
|
|
225
|
|
|
226
|
if(dataParam!=null){
|
|
227
|
String encryptData = MobileSecurity.requestEncrypt(dataParam.toString());
|
|
228
|
encryptData = encryptData.replace("+", "-");
|
|
229
|
postData.put(Constant.Server.DATA, encryptData);
|
|
230
|
}
|
230
|
231
|
} else {
|
231
|
232
|
if (dataParam != null) {
|
232
|
233
|
postData.put(Constant.Server.DATA, dataParam.toString());
|
|
@ -311,7 +312,7 @@ public class MobileNetWork extends Plugin {
|
311
|
312
|
uploadWithServlet(filePaths, dataAction, dataParam);
|
312
|
313
|
}
|
313
|
314
|
|
314
|
|
public void uploadWithServlet(final JSONArray filePaths, String dataAction, IData dataParam) throws Exception {
|
|
315
|
public void uploadWithServlet(final JSONArray filePaths, final String dataAction, IData dataParam) throws Exception {
|
315
|
316
|
// TODO Auto-generated method stub
|
316
|
317
|
final Map<String, String> postData = transPostData(dataAction, dataParam);
|
317
|
318
|
final Map<String, Object> filePostData = new HashMap<String, Object>();
|
|
@ -333,6 +334,9 @@ public class MobileNetWork extends Plugin {
|
333
|
334
|
filePostData.put("FILE"+i, filePath);//再装载文件
|
334
|
335
|
}
|
335
|
336
|
result = UnirestUtil.uploadByPost(MobileConfig.getInstance().getRequestUrl(), filePostData);
|
|
337
|
if (ServerDataConfig.isEncrypt(dataAction)) {
|
|
338
|
result = MobileSecurity.responseDecrypt(result);
|
|
339
|
}
|
336
|
340
|
}catch(Exception e){
|
337
|
341
|
MobileNetWork.this.error(e.getMessage());// 报错回调
|
338
|
342
|
}
|