应该是这么个形式
{"collectionDtoList":[{"collectionType":1,"typeId":3}]}
使用javabean进行解析对应
import java.util.List;
public class CancelCollectBean {
private List<CollectionDtoListDTO> collectionDtoList;
public List<CollectionDtoListDTO> getCollectionDtoList() {
return collectionDtoList;
}
public void setCollectionDtoList(List<CollectionDtoListDTO> collectionDtoList) {
this.collectionDtoList = collectionDtoList;
}
public static class CollectionDtoListDTO {
private int collectionType;
private int typeId;
public int getCollectionType() {
return collectionType;
}
public void setCollectionType(int collectionType) {
this.collectionType = collectionType;
}
public int getTypeId() {
return typeId;
}
public void setTypeId(int typeId) {
this.typeId = typeId;
}
}
}
参数组装
List<CancelCollectBean.CollectionDtoListDTO> collectionDtoList = new ArrayList<>();
CancelCollectBean.CollectionDtoListDTO collectionDtoListDTO = new CancelCollectBean.CollectionDtoListDTO();
collectionDtoListDTO.setCollectionType(1);
Log.e("wy", "156onItemClick: "+records.get(position).getTypeId() );
collectionDtoListDTO.setTypeId(records.get(position).getTypeId());
collectionDtoList.add(collectionDtoListDTO);
RequestParams params = new RequestParams(Constant.delCollection);
params.addHeader("Authorization", Constant.authorization);
params.addHeader("language", Constant.system_language);
params.setAsJsonContent(true);
收藏类型,1:商品,2:服务,3:SPU,4:专家,5,:品牌
// params.addBodyParameter("collectionType", 1);
// // expertRemarkName 专家备注名
params.addBodyParameter("expertRemarkName", "lbb");
// // 收藏对象ID。收藏商品时传商品ID,收藏服务时传服务ID,收藏SPU时传SpuId,收藏专家时传专家id
// params.addBodyParameter("typeId",records.get(position).getTypeId());
params.addBodyParameter("collectionDtoList", collectionDtoList);