feat(API): 吧浏览历史

This commit is contained in:
HuanCheng65 2024-02-01 13:14:28 +08:00
parent c513006fd4
commit 6a6f350cc3
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
9 changed files with 128 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import com.huanchengfly.tieba.post.api.models.protos.forumRuleDetail.ForumRuleDe
import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse
import com.huanchengfly.tieba.post.api.models.protos.getBawuInfo.GetBawuInfoResponse import com.huanchengfly.tieba.post.api.models.protos.getBawuInfo.GetBawuInfoResponse
import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailResponse import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailResponse
import com.huanchengfly.tieba.post.api.models.protos.getHistoryForum.GetHistoryForumResponse
import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoResponse import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoResponse
import com.huanchengfly.tieba.post.api.models.protos.getMemberInfo.GetMemberInfoResponse import com.huanchengfly.tieba.post.api.models.protos.getMemberInfo.GetMemberInfoResponse
import com.huanchengfly.tieba.post.api.models.protos.getUserInfo.GetUserInfoResponse import com.huanchengfly.tieba.post.api.models.protos.getUserInfo.GetUserInfoResponse
@ -1508,4 +1509,11 @@ interface ITiebaApi {
bduss: String?, bduss: String?,
sToken: String?, sToken: String?,
): Flow<GetUserInfoResponse> ): Flow<GetUserInfoResponse>
/**
* 获取吧浏览历史信息
*/
fun getHistoryForumFlow(
history: String,
): Flow<GetHistoryForumResponse>
} }

View File

@ -66,6 +66,9 @@ import com.huanchengfly.tieba.post.api.models.protos.getBawuInfo.GetBawuInfoResp
import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailRequest import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailRequest
import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailRequestData import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailRequestData
import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailResponse import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailResponse
import com.huanchengfly.tieba.post.api.models.protos.getHistoryForum.GetHistoryForumRequest
import com.huanchengfly.tieba.post.api.models.protos.getHistoryForum.GetHistoryForumRequestData
import com.huanchengfly.tieba.post.api.models.protos.getHistoryForum.GetHistoryForumResponse
import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoRequest import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoRequest
import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoRequestData import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoRequestData
import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoResponse import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoResponse
@ -1453,4 +1456,19 @@ object MixedTiebaApiImpl : ITiebaApi {
) )
) )
} }
override fun getHistoryForumFlow(history: String): Flow<GetHistoryForumResponse> {
return RetrofitTiebaApi.OFFICIAL_PROTOBUF_TIEBA_V12_API.getHistoryForumFlow(
buildProtobufRequestBody(
GetHistoryForumRequest(
GetHistoryForumRequestData(
common = buildCommonRequest(clientVersion = ClientVersion.TIEBA_V12),
history = history,
)
),
clientVersion = ClientVersion.TIEBA_V12,
needSToken = true
)
)
}
} }

View File

@ -6,6 +6,7 @@ import com.huanchengfly.tieba.post.api.models.protos.forumRuleDetail.ForumRuleDe
import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse
import com.huanchengfly.tieba.post.api.models.protos.getBawuInfo.GetBawuInfoResponse import com.huanchengfly.tieba.post.api.models.protos.getBawuInfo.GetBawuInfoResponse
import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailResponse import com.huanchengfly.tieba.post.api.models.protos.getForumDetail.GetForumDetailResponse
import com.huanchengfly.tieba.post.api.models.protos.getHistoryForum.GetHistoryForumResponse
import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoResponse import com.huanchengfly.tieba.post.api.models.protos.getLevelInfo.GetLevelInfoResponse
import com.huanchengfly.tieba.post.api.models.protos.getMemberInfo.GetMemberInfoResponse import com.huanchengfly.tieba.post.api.models.protos.getMemberInfo.GetMemberInfoResponse
import com.huanchengfly.tieba.post.api.models.protos.getUserInfo.GetUserInfoResponse import com.huanchengfly.tieba.post.api.models.protos.getUserInfo.GetUserInfoResponse
@ -121,4 +122,9 @@ interface OfficialProtobufTiebaApi {
fun getUserInfoFlow( fun getUserInfoFlow(
@Body body: MyMultipartBody, @Body body: MyMultipartBody,
): Flow<GetUserInfoResponse> ): Flow<GetUserInfoResponse>
@POST("/c/f/forum/gethistoryforum?cmd=309601&format=protobuf")
fun getHistoryForumFlow(
@Body body: MyMultipartBody,
): Flow<GetHistoryForumResponse>
} }

View File

@ -0,0 +1,12 @@
package com.huanchengfly.tieba.post.models
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class HistoryForumItem(
@SerialName("forum_id")
val forumId: Long,
@SerialName("visit_time")
val visitTime: String,
)

View File

@ -0,0 +1,12 @@
syntax = "proto3";
package tieba.getHistoryForum;
option java_package = "com.huanchengfly.tieba.post.api.models.protos.getHistoryForum";
import "GetHistoryForum/GetHistoryForumRequestData.proto";
message GetHistoryForumRequest {
GetHistoryForumRequestData data = 1;
}

View File

@ -0,0 +1,12 @@
syntax = "proto3";
package tieba.getHistoryForum;
option java_package = "com.huanchengfly.tieba.post.api.models.protos.getHistoryForum";
import "CommonRequest.proto";
message GetHistoryForumRequestData {
CommonRequest common = 1;
string history = 2;
}

View File

@ -0,0 +1,14 @@
syntax = "proto3";
package tieba.getHistoryForum;
option java_package = "com.huanchengfly.tieba.post.api.models.protos.getHistoryForum";
import "Error.proto";
import "GetHistoryForum/GetHistoryForumResponseData.proto";
message GetHistoryForumResponse {
Error error = 1;
GetHistoryForumResponseData data = 2;
}

View File

@ -0,0 +1,14 @@
syntax = "proto3";
package tieba.getHistoryForum;
option java_package = "com.huanchengfly.tieba.post.api.models.protos.getHistoryForum";
import "FrsTabInfo.proto";
import "HistoryForumInfo.proto";
message GetHistoryForumResponseData {
repeated HistoryForumInfo history_forum = 1;
repeated FrsTabInfo nav_tab_info = 2;
repeated HistoryForumInfo this_week_forums = 3;
}

View File

@ -0,0 +1,32 @@
syntax = "proto3";
package tieba;
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
import "BlockPopInfo.proto";
import "FrsTabInfo.proto";
import "RecomTagInfo.proto";
import "ThemeColorInfo.proto";
import "PostPrefix.proto";
message HistoryForumInfo {
int64 forum_id = 1;
string forum_name = 2;
string avatar = 3;
int32 is_liveforum = 4;
int32 unread_num = 5;
string visit_time = 6;
int32 follow_num = 7;
ThemeColorInfo theme_color = 8;
bool need_trans = 10;
BlockPopInfo block_pop_info = 14;
uint32 hot_num = 15;
int32 level_id = 16;
repeated FrsTabInfo tab_info = 17;
bool has_postpre = 18;
PostPrefix post_prefix = 19;
int32 is_forum_business_account = 20;
RecomTagInfo tag_info = 21;
string first_category = 22;
}