找不到翻新注释。 (参数2)

时间:2018-09-28 12:41:56

标签: java kotlin retrofit

使用改造发送参数时出现问题。请帮我解决这个问题。

这是界面:

@POST(Config.URL_PAYMENT)
fun sendPayment(@Body id:String, total: Long): Call<List<ProgressAntar>>

剩下的

private fun sendPayment(id: String, total: Long){
    Log.i("getDataProgress", "dataProgress$id")

    val apiService : Service = Client.getClient()!!.create(Service::class.java)
    apiService.sendPayment(id,total).enqueue(object : Callback<List<ProgressAntar>> {

        override fun onResponse(call: Call<List<ProgressAntar>>?, response: Response<List<ProgressAntar>>?) {
            if (response != null && response.isSuccessful) {
                Log.i("tesSucess", "sucess" + response.body())
                val list = response.body()

                if (list == null || list.isEmpty()) {
                    Toast.makeText(activity, "Tidak ada daftar pembayaran", Toast.LENGTH_LONG).show()
                } else{
                    // refresh progress list
                    progressList = ArrayList(list)
                    dataProgressAdapter.updateData(progressList)
                }
            } else{
                Toast.makeText(activity, "Tidak ada daftar pembayaran", Toast.LENGTH_LONG).show()
            }
        }
    }

1 个答案:

答案 0 :(得分:1)

这是因为total: Long未被注释,因此Retrofit不知道如何将其转发到您的API。

您可能需要@Field而不是Body