androd okhttp application/json 添加公共参数 ? 如何处理提问

139 阅读1分钟

okhttp MediaType contentType 为application/json 在body添加公共参数 怎么做   

Interceptor里面直接测试出现这个问题

Map<String, Object> hashMap = new HashMap<>();
hashMap.put("districtId","330104");
hashMap.put("mobile","13200000005");
hashMap.put("deviceId","4c1c0f5ed763d3fb");
jsonObject.put(
Constant.DISTRICT_ID,
 LocationLatLngUtil.getInstance().getAMapLocation().getAdCode());
LogUtils.e("jsonObject "+ jsonObject.toString());
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8")
        , new Gson().toJson(hashMap));
builder = oldRequest.newBuilder();
builder.post(requestBody);