改包名com.aiosman.ravenow
This commit is contained in:
19
app/src/main/java/com/aiosman/ravenow/data/DictService.kt
Normal file
19
app/src/main/java/com/aiosman/ravenow/data/DictService.kt
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.aiosman.ravenow.data
|
||||
|
||||
import com.aiosman.ravenow.data.api.ApiClient
|
||||
import com.aiosman.ravenow.data.api.DictItem
|
||||
|
||||
|
||||
interface DictService {
|
||||
/**
|
||||
* 获取字典项
|
||||
*/
|
||||
suspend fun getDictByKey(key: String): DictItem
|
||||
}
|
||||
|
||||
class DictServiceImpl : DictService {
|
||||
override suspend fun getDictByKey(key: String): DictItem {
|
||||
val resp = ApiClient.api.getDict(key)
|
||||
return resp.body()?.data ?: throw Exception("failed to get dict")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user