feat: 增加网络请求模块
This commit is contained in:
@@ -100,4 +100,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
// 显示错误提示 https://github.com/nhaarman/supertooltips
|
// 显示错误提示 https://github.com/nhaarman/supertooltips
|
||||||
implementation 'com.nhaarman.supertooltips:library:3.0.0'
|
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'
|
||||||
}
|
}
|
||||||
23
app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoCall.kt
Normal file
23
app/src/main/java/com/navinfo/volvo/http/NavinfoVolvoCall.kt
Normal file
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<String, String>)
|
||||||
|
@POST("/navi/cardDelivery/updateCardByApp")
|
||||||
|
fun updateCardByApp(@Body updateData: MutableMap<String, String>)
|
||||||
|
@POST("/navi/cardDelivery/queryCardListByApp")
|
||||||
|
fun queryCardListByApp(@Body queryData: MutableMap<String, String>)
|
||||||
|
@POST("/navi/cardDelivery/deleteCardByApp")
|
||||||
|
fun deleteCardByApp(@Body deleteData: MutableMap<String, String>)
|
||||||
|
@POST("/img/upload")
|
||||||
|
@Multipart
|
||||||
|
fun uploadAttachment(@Part("picture") attachmentFile: File)
|
||||||
|
@POST("/img/download")
|
||||||
|
fun downLoadAttachment(@Body downloadData: MutableMap<String, String>)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user