@FormUrlEncoded
@POST("xxxxxxx")
Call<ResponseBody> postSaveInfo(@Field("id") int id,
@Field("user_id") int user_id,
@Field("teacher_name") String teacher_name,
@Field("mobile") String mobile,
@Field("avatar") String image,
@Field("owner_type") String owner_type,
@Field("title") String title,
@Field("address") String address,
@Field("content") String content,
@Field("learn") String learn,
@Field("weigh") int weigh,
@Field("status") int status,
@Field("qualification") String qualification,
@Field("cate_id") String cate_id,
@Field("region") String region,
@Field("region_id") int region_id,
@Field("region_text") String region_text,
@Field("price") int price,
@Field("service") String service);
修改保存信息时service字段,让传的格式是{"1":"49","2":"49","3":"49"}这样的,使用postman上传是没问题的
代码中的写法是这样的,但是提交请求后 值没有成功修改,请大家帮忙看看
JSONObject jsonData = new JSONObject();
try {
jsonData.put("1", "49");
jsonData.put("2", "49");
jsonData.put("3", "49");
} catch (JSONException e) {
throw new RuntimeException(e);
}
//把json对象转换成字符串,然后提交
String serviceResult = jsonData.toString();

你直接做成一个bean类,用body不就可以了?搞那么多参数。