feat: 预留新网页版个人信息接口

This commit is contained in:
HuanCheng65 2022-06-10 11:31:44 +08:00
parent 1adb7d11d1
commit 4041b6284b
No known key found for this signature in database
GPG Key ID: E9031EF91A805148
4 changed files with 56 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import com.huanchengfly.tieba.post.api.models.*
import com.huanchengfly.tieba.post.api.models.web.ForumBean
import com.huanchengfly.tieba.post.api.models.web.ForumHome
import com.huanchengfly.tieba.post.api.models.web.HotMessageListBean
import com.huanchengfly.tieba.post.api.models.web.Profile
import com.huanchengfly.tieba.post.api.retrofit.ApiResult
import com.huanchengfly.tieba.post.models.DislikeBean
import com.huanchengfly.tieba.post.models.MyInfoBean
@ -111,6 +112,12 @@ interface ITiebaApi {
subPostId: String?
): Call<SubFloorListBean>
/**
* 获取首页关注吧列表网页版接口
*
* @param sortType 排序方式0 = 等级排序1 = 关注顺序
* @param page 分页页码 0 开始
*/
fun forumHomeAsync(
sortType: Int,
page: Int = 0
@ -172,6 +179,11 @@ interface ITiebaApi {
uid: String
): Call<ProfileBean>
/**
* 用户信息异步
*/
fun myProfileAsync(): Deferred<ApiResult<Profile>>
/**
* 取关一个吧
*

View File

@ -11,6 +11,7 @@ import com.huanchengfly.tieba.post.api.models.*
import com.huanchengfly.tieba.post.api.models.web.ForumBean
import com.huanchengfly.tieba.post.api.models.web.ForumHome
import com.huanchengfly.tieba.post.api.models.web.HotMessageListBean
import com.huanchengfly.tieba.post.api.models.web.Profile
import com.huanchengfly.tieba.post.api.retrofit.ApiResult
import com.huanchengfly.tieba.post.api.retrofit.RetrofitTiebaApi
import com.huanchengfly.tieba.post.models.DislikeBean
@ -29,6 +30,9 @@ object MixedTiebaApiImpl : ITiebaApi {
override fun personalized(loadType: Int, page: Int): Call<PersonalizedBean> =
RetrofitTiebaApi.MINI_TIEBA_API.personalized(loadType, page)
override fun myProfileAsync(): Deferred<ApiResult<Profile>> =
RetrofitTiebaApi.WEB_TIEBA_API.myProfileAsync("json", "", "")
override fun agree(
threadId: String,
postId: String
@ -75,8 +79,7 @@ object MixedTiebaApiImpl : ITiebaApi {
page,
20,
"",
"",
AccountUtil.getCookie(BaseApplication.instance)
""
)
}

View File

@ -0,0 +1,23 @@
package com.huanchengfly.tieba.post.api.models.web
import com.google.gson.annotations.SerializedName
class Profile : WebBase<ProfileData>()
data class ProfileData(
@SerializedName("is_login")
val isLogin: Int,
val sid: String,
val user: User
)
data class User(
val intro: String,
val name: String,
@SerializedName("name_show")
val nameShow: String,
val portrait: String,
val sex: Int,
@SerializedName("show_nickname")
val showNickName: String
)

View File

@ -41,10 +41,23 @@ interface WebTiebaApi {
@Query("pn") page: Int,
@Query("rn") pageSize: Int,
@Query("eqid") eqid: String,
@Query("refer") refer: String,
@retrofit2.http.Header("Cookie") cookie: String?
@Query("refer") refer: String
): Deferred<ApiResult<ForumHome>>
@Headers(
"${Header.FORCE_LOGIN}: ${Header.FORCE_LOGIN_TRUE}",
"${Header.REFERER}: https://tieba.baidu.com/index/tbwise/mine?source=index",
"sec-ch-ua: \".Not/A)Brand\";v=\"99\", \"Microsoft Edge\";v=\"103\", \"Chromium\";v=\"103\"",
"sec-ch-ua-mobile: ?1",
"sec-ch-ua-platform: Android"
)
@GET("/mg/o/profile")
fun myProfileAsync(
@Query("format") format: String,
@Query("eqid") eqid: String,
@Query("refer") refer: String
): Deferred<ApiResult<Profile>>
@GET("/mo/q/hotMessage/main")
fun hotTopicMain(
@Query("topic_id") topicId: String,
@ -118,6 +131,7 @@ interface WebTiebaApi {
@retrofit2.http.Header("cookie") cookie: String
): Deferred<ApiResult<MyInfoBean>>
@GET("/mo/q/search/forum")
fun searchForum(
@Query("word") keyword: String