From c95096d4fdb31165e3b8b772e98add40f6fa1feb Mon Sep 17 00:00:00 2001 From: xiaoyan Date: Tue, 3 Jan 2023 17:03:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 3 +++ .../navinfo/volvo/http/NavinfoVolvoCall.kt | 23 +++++++++++++++++++ .../navinfo/volvo/http/NavinfoVolvoService.kt | 23 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoCall.kt create mode 100644 app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoService.kt 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