2
我做了地圖手動改造2 @FieldMap總是空
private Map<String, Object> getProducts(){
List<CartContentDMC> products = new Select().from(Data.class).execute();
Map<String, Object> productMap = new LinkedHashMap<>();
for(int j = 0; j < products.size(); j++){
productMap.put("products[" + Integer.toString(j) + "][code]", Integer.toString(products.get(j).id));
productMap.put("products[" + Integer.toString(j) + "][amount]", products.get(j).amount);
productMap.put("products[" + Integer.toString(j) + "][price]", Integer.toString(products.get(j).price));
}
return productMap;
}
,但在我的要求:
@FormUrlEncoded
@POST("orders.json/createOrder?")
Call<Response> sendOrder(@Query("client_id") String id, @Query("access_token") String access_token,
@Query("order_id") int order_id, @Query("buyer_name") String buyer_name,
@Query("buyer_phone") String buyer_phone, @Query("buyer_address") String buyer_address,
@FieldMap Map<String, Object> products, @Query("delivery_price") int delivery_price,
@Query("website") String website);
FieldMap總是請求空。
我在做什麼錯?
你確定'產品'填寫正確嗎? – Blackbelt
@Blackbelt絕對!它給這樣的地圖: 產品[0] [code],9 產品[0] [amount],3 產品[0] [price],15000 產品[1] [code],65 產品[ [數量],5 產品[1] [價格],15000 產品[2] [code],68 產品[2] [amount],2 產品[2] [price],25000 – micsha123