xutils3传集合

入参是集合,就这样传
核心:

  params.addBodyParameter("collectionDtoList", collectionDtoList);

都是集合的名字

   List<CancelCollectBean.CollectionDtoListDTO> collectionDtoList = new ArrayList<>();
                                    CancelCollectBean.CollectionDtoListDTO collectionDtoListDTO = new CancelCollectBean.CollectionDtoListDTO();
                                    collectionDtoListDTO.setCollectionType(1);
                                    collectionDtoListDTO.setTypeId(professionInfo.getData().getRecords().get(position).getProductId());
                                    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", 4);
//                                //                expertRemarkName  专家备注名
                params.addBodyParameter("expertRemarkName", "lbb");
//                                //                收藏对象ID。收藏商品时传商品ID,收藏服务时传服务ID,收藏SPU时传SpuId,收藏专家时传专家id
//                                params.addBodyParameter("typeId", professionInfo.getData().get(position).getExpertId());
                                    params.addBodyParameter("collectionDtoList", collectionDtoList);


                                    Log.e("wy", "249onViewCreated params: " + params);
                                    x.http().post(params, new Callback.CommonCallback<String>() {
    
    
                                        @Override
                                        public void onSuccess(String result) {
    
    


                                            LoveBean professionInfo = JSON.parseObject(result, LoveBean.class);

                                            if (professionInfo.getCode().equals("00000000")) {
    
    

                                                Toast.makeText(x.app(), R.string.cancels, Toast.LENGTH_SHORT).show();
                                                getData(keywords);

                                            } else {
    
    
                                                Toast.makeText(x.app(), professionInfo.getMsg(), Toast.LENGTH_LONG).show();
                                                startActivity(new Intent(ShopCustomSearchNewActivity.this, LoginActivity.class));
                                            }


                                        }

                                        @Override
                                        public void onError(Throwable ex, boolean isOnCallback) {
    
    
                                            Log.e("wy", "result: " + ex.getMessage());
                                        }

                                        @Override
                                        public void onCancelled(CancelledException cex) {
    
    
                                            Toast.makeText(x.app(), "cancelled", Toast.LENGTH_LONG).show();
                                        }

                                        @Override
                                        public void onFinished() {
    
    

                                        }
                                    });

猜你喜欢

转载自blog.csdn.net/xiyangyang8110/article/details/125528191