手机信息上报

This commit is contained in:
2024-07-23 11:03:23 +08:00
parent c45e623a58
commit 8ba586c204
7 changed files with 63 additions and 8 deletions
@@ -81,6 +81,39 @@ public class OkHttpUtil {
return request;
}
public static Request put(OkDate od, Context con){
MediaType mediaType = MediaType.parse("application/json");
if(od.getMadiaType()!=null && od.getMadiaType().equals("")){
od.setMadiaType("{}");
}
// JSONObject jsonObject = JSON.parseObject(od.getMadiaType());
// jsonObject.put("timestamp", DateUtil.current());
// jsonObject.put("deviceId", GetUtil.getDeviceId(con));
// String sign = SecureUtil.signParamsSha1(jsonObject,SIGN_PASSWORD);
// Log.e("jsonObject",jsonObject.toString());
// Log.e("sign",sign);
// Map<String,Object> map=new HashMap<>();
// map.put("data",SecurityUtil.encrypt(jsonObject.toString()));
// Log.e("参数1",od.getMadiaType());
// Log.e("参数2",MapUtil.mapJson(map));
//MapUtil.mapJson(map)
RequestBody body = RequestBody.create(mediaType,od.getMadiaType());
Headers.Builder hb=new Headers.Builder();
hb.add("Content-Type","application/json");
hb.add("Cache-Control","no-cache");
Request request = new Request.Builder()
.url(od.getUrl())
.put(body)
.headers(hb.build())
.addHeader("Version", VersionUtil.getVersion(con))
.addHeader("VersionCode",String.valueOf(AppUtils.getAppVersionCode()))
//.addHeader("sign",sign)
.removeHeader("User-Agent")
.addHeader("User-Agent",GetUtil.getUserAgent(con))
.build();
return request;
}
public static Request get(OkDate od){
Headers.Builder hb=new Headers.Builder();
hb.add("Content-Type","application/json");