diff --git a/app/build.gradle b/app/build.gradle index 13cf503..eaafd26 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -100,4 +100,7 @@ dependencies { } // 显示错误提示 https://github.com/nhaarman/supertooltips implementation 'com.nhaarman.supertooltips:library:3.0.0' + // 网络请求包 https://square.github.io/retrofit/ + implementation 'com.squareup.retrofit2:retrofit:2.9.0' + implementation 'com.squareup.retrofit2:converter-gson:2.9.0' } \ No newline at end of file diff --git a/app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoCall.kt b/app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoCall.kt new file mode 100644 index 0000000..97d342b --- /dev/null +++ b/app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoCall.kt @@ -0,0 +1,23 @@ +package com.navinfo.volvo.http + +import retrofit2.Retrofit +import retrofit2.converter.gson.GsonConverterFactory + +class NavinfoVolvoCall { + private val retrofit by lazy { + Retrofit.Builder().baseUrl("http://ec2-52-81-73-5.cn-north-1.compute.amazonaws.com.cn:8088/") + .addConverterFactory(GsonConverterFactory.create()) + .build() + } + companion object { + private var instance: NavinfoVolvoCall? = null + get() { + if (field == null) { + field = NavinfoVolvoCall() + } + return field + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoService.kt b/app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoService.kt new file mode 100644 index 0000000..52ea7ca --- /dev/null +++ b/app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoService.kt @@ -0,0 +1,23 @@ +package com.navinfo.volvo.http + +import retrofit2.http.Body +import retrofit2.http.Multipart +import retrofit2.http.POST +import retrofit2.http.Part +import java.io.File + +interface NavinfoVolvoService { + @POST("/navi/cardDelivery/insertCardByApp") + fun insertCardByApp(@Body insertData: MutableMap) + @POST("/navi/cardDelivery/updateCardByApp") + fun updateCardByApp(@Body updateData: MutableMap) + @POST("/navi/cardDelivery/queryCardListByApp") + fun queryCardListByApp(@Body queryData: MutableMap) + @POST("/navi/cardDelivery/deleteCardByApp") + fun deleteCardByApp(@Body deleteData: MutableMap) + @POST("/img/upload") + @Multipart + fun uploadAttachment(@Part("picture") attachmentFile: File) + @POST("/img/download") + fun downLoadAttachment(@Body downloadData: MutableMap) +} \ No newline at end of file