test release api

This commit is contained in:
Li ZongYing
2024-02-11 10:14:23 +08:00
parent 353dc0570f
commit ce678b8741
2 changed files with 10 additions and 6 deletions
@@ -74,7 +74,7 @@ class Request {
Log.i(TAG, "token ${liveInfo.data.token}") Log.i(TAG, "token ${liveInfo.data.token}")
ysp?.token = liveInfo.data.token ysp?.token = liveInfo.data.token
fetchVideo(tvModel, cookie) fetchVideo(tvModel, cookie)
} else { } else {
Log.e(TAG, "$title token error") Log.e(TAG, "$title token error")
if (tvModel.retryTimes < tvModel.retryMaxTimes) { if (tvModel.retryTimes < tvModel.retryMaxTimes) {
tvModel.retryTimes++ tvModel.retryTimes++
@@ -144,7 +144,13 @@ class Request {
tvModel.seq = 0 tvModel.seq = 0
val data = ysp?.switch(tvModel) val data = ysp?.switch(tvModel)
val request = data?.let { LiveInfoRequest(it) } val request = data?.let { LiveInfoRequest(it) }
call = request?.let { yspApiService.getLiveInfo("guid=${ysp?.getGuid()}; $cookie", ysp!!.token, it) } call = request?.let {
yspApiService.getLiveInfo(
"guid=${ysp?.getGuid()}; $cookie",
ysp!!.token,
it
)
}
call?.enqueue(object : Callback<LiveInfo> { call?.enqueue(object : Callback<LiveInfo> {
override fun onResponse(call: Call<LiveInfo>, response: Response<LiveInfo>) { override fun onResponse(call: Call<LiveInfo>, response: Response<LiveInfo>) {
@@ -307,7 +313,7 @@ class Request {
yspTokenService.getInfo() yspTokenService.getInfo()
.enqueue(object : Callback<Info> { .enqueue(object : Callback<Info> {
override fun onResponse(call: Call<Info>, response: Response<Info>) { override fun onResponse(call: Call<Info>, response: Response<Info>) {
if (response.isSuccessful) { if (response.isSuccessful && response.body()?.data?.token != null) {
token = response.body()?.data?.token!! token = response.body()?.data?.token!!
Log.i(TAG, "info success $token") Log.i(TAG, "info success $token")
val cookie = val cookie =
@@ -5,8 +5,6 @@ import okhttp3.OkHttpClient
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.converter.protobuf.ProtoConverterFactory import retrofit2.converter.protobuf.ProtoConverterFactory
import java.net.InetSocketAddress
import java.net.Proxy
import javax.net.ssl.SSLContext import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager import javax.net.ssl.X509TrustManager
@@ -40,7 +38,7 @@ class ApiClient {
val releaseService: ReleaseService by lazy { val releaseService: ReleaseService by lazy {
Retrofit.Builder() Retrofit.Builder()
.baseUrl(devUrl) .baseUrl(myUrl)
.client(okHttpClient) .client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.build().create(ReleaseService::class.java) .build().create(ReleaseService::class.java)