You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
49 lines
1.2 KiB
1 year ago
|
import android.util.Log
|
||
|
import com.bingce.controlnetwork.http.RetrofitClient
|
||
|
import com.bingce.controlnetwork.http.sevice.CommonService
|
||
|
import kotlinx.coroutines.delay
|
||
|
import kotlinx.coroutines.launch
|
||
|
import kotlinx.coroutines.runBlocking
|
||
|
import org.junit.Test
|
||
|
|
||
|
class HelloKotlin {
|
||
|
|
||
|
@Test
|
||
|
fun test() {
|
||
|
runBlocking {
|
||
|
|
||
|
launch {
|
||
|
Log.d("hwhw", "请求1")
|
||
|
|
||
|
delay(1000)
|
||
|
Log.d("hwhw", "请求1 delay")
|
||
|
|
||
|
val apiCall = RetrofitClient.apiCall {
|
||
|
RetrofitClient.createService<CommonService>().getPassageData()
|
||
|
}
|
||
|
|
||
|
apiCall?.let {
|
||
|
Log.d("hwhw", "请求成功1,$it")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
launch {
|
||
|
Log.d("hwhw", "请求2")
|
||
|
|
||
|
delay(1000)
|
||
|
Log.d("hwhw", "请求2 delay")
|
||
|
|
||
|
val apiCall1 = RetrofitClient.apiCall {
|
||
|
RetrofitClient.createService<CommonService>().getPassageData()
|
||
|
}
|
||
|
apiCall1?.let {
|
||
|
Log.d("hwhw", "请求成功2,$it")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|