美文网首页
retrofit2学习笔记之长字符串请求

retrofit2学习笔记之长字符串请求

作者: 小宋敲码 | 来源:发表于2018-03-19 15:58 被阅读73次

在实现外卖的下单功能时发现的,需要传到后台的数据较多且其中有数组,一开始是用@Body。但是其中有包含菜的数组,相当与对象中有个list后台获取到的格式有点问题,然后就曲线救国,传个json格式的字符串给后台,就有了下面这个

长字符串请求

请求数据格式:{"money":110.0,"orderDishesVoList":[{"dishesUid":"c96e6cac71bf4e368fd8834e728e2505","number":2,"price":30.0},{"dishesUid":"6c33247ef0ef4e469482f65695117696","number":1,"price":15.0},{"dishesUid":"a164cc4efe3e4fff897aa4e9171590dc","number":1,"price":10.0},{"dishesUid":"e7caeddac5fc4c00ae3985816f740f2b","number":1,"price":15.0}],"remarks":"没有","restaurantUid":"36359334"}

@FormUrlEncoded

@POST("order/addOrderJson")

Observable>orderddOrder(@Field("data") String order);

相关文章

网友评论

      本文标题:retrofit2学习笔记之长字符串请求

      本文链接:https://www.haomeiwen.com/subject/cblpqftx.html