diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/ITiebaApi.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/ITiebaApi.kt index 94b80b8d..608e4598 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/ITiebaApi.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/ITiebaApi.kt @@ -8,6 +8,7 @@ import com.huanchengfly.tieba.post.api.models.protos.forumRecommend.ForumRecomme import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse import com.huanchengfly.tieba.post.api.models.protos.hotThreadList.HotThreadListResponse import com.huanchengfly.tieba.post.api.models.protos.personalized.PersonalizedResponse +import com.huanchengfly.tieba.post.api.models.protos.profile.ProfileResponse import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse import com.huanchengfly.tieba.post.api.models.protos.topicList.TopicListResponse import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeResponse @@ -1215,4 +1216,13 @@ interface ITiebaApi { postId: String? = null, replyUserId: String? = null ): Flow + + /** + * 用户信息(Flow) + * + * @param uid 用户 ID + */ + fun profileFlow( + uid: Long + ): Flow } \ No newline at end of file diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/impls/MixedTiebaApiImpl.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/impls/MixedTiebaApiImpl.kt index 3c76c8ce..2e0d50af 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/impls/MixedTiebaApiImpl.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/impls/MixedTiebaApiImpl.kt @@ -59,6 +59,9 @@ import com.huanchengfly.tieba.post.api.models.protos.hotThreadList.HotThreadList import com.huanchengfly.tieba.post.api.models.protos.personalized.PersonalizedRequest import com.huanchengfly.tieba.post.api.models.protos.personalized.PersonalizedRequestData import com.huanchengfly.tieba.post.api.models.protos.personalized.PersonalizedResponse +import com.huanchengfly.tieba.post.api.models.protos.profile.ProfileRequest +import com.huanchengfly.tieba.post.api.models.protos.profile.ProfileRequestData +import com.huanchengfly.tieba.post.api.models.protos.profile.ProfileResponse import com.huanchengfly.tieba.post.api.models.protos.threadList.AdParam import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListRequest import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListRequestData @@ -971,4 +974,31 @@ object MixedTiebaApiImpl : ITiebaApi { post_from = if (postId == null) "3" else "11" ) } + + override fun profileFlow(uid: Long): Flow { + val selfUid = AccountUtil.getUid()?.toLongOrNull() + val isSelf = selfUid == uid + return RetrofitTiebaApi.OFFICIAL_PROTOBUF_TIEBA_API.profileFlow( + buildProtobufRequestBody( + ProfileRequest( + ProfileRequestData( + common = buildCommonRequest(), + friend_uid = uid.takeIf { !isSelf }, + friend_uid_portrait = "", + has_plist = 1, + is_from_usercenter = 1, + need_post_count = 1, + page = 2, + pn = 1, + q_type = 0, + rn = 20, + scr_dip = App.ScreenInfo.DENSITY.toDouble(), + scr_h = getScreenHeight(), + scr_w = getScreenWidth(), + uid = selfUid, + ) + ) + ) + ) + } } \ No newline at end of file diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/interfaces/OfficialProtobufTiebaApi.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/interfaces/OfficialProtobufTiebaApi.kt index 0764eed5..2cc52b1b 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/interfaces/OfficialProtobufTiebaApi.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/interfaces/OfficialProtobufTiebaApi.kt @@ -4,6 +4,7 @@ import com.huanchengfly.tieba.post.api.models.protos.forumRecommend.ForumRecomme import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse import com.huanchengfly.tieba.post.api.models.protos.hotThreadList.HotThreadListResponse import com.huanchengfly.tieba.post.api.models.protos.personalized.PersonalizedResponse +import com.huanchengfly.tieba.post.api.models.protos.profile.ProfileResponse import com.huanchengfly.tieba.post.api.models.protos.threadList.ThreadListResponse import com.huanchengfly.tieba.post.api.models.protos.topicList.TopicListResponse import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeResponse @@ -47,4 +48,9 @@ interface OfficialProtobufTiebaApi { fun threadListFlow( @Body body: MyMultipartBody, ): Flow + + @POST("/c/u/user/profile?cmd=303012") + fun profileFlow( + @Body body: MyMultipartBody, + ): Flow } \ No newline at end of file diff --git a/app/src/main/protos/Profile.proto b/app/src/main/protos/Profile/Profile.proto similarity index 85% rename from app/src/main/protos/Profile.proto rename to app/src/main/protos/Profile/Profile.proto index a12c9cbb..0655c84b 100644 --- a/app/src/main/protos/Profile.proto +++ b/app/src/main/protos/Profile/Profile.proto @@ -12,19 +12,19 @@ import "Error.proto"; message ProfileRequestData { CommonRequest common = 9; - int64 friend_uid = 3; - string friend_uid_portrait = 16; + optional int64 friend_uid = 3; + optional string friend_uid_portrait = 16; uint32 has_plist = 8; int32 is_from_usercenter = 14; uint32 need_post_count = 2; int32 page = 15; uint32 pn = 6; - uint32 q_type = 12; + optional uint32 q_type = 12; uint32 rn = 7; double scr_dip = 13; int32 scr_h = 11; int32 scr_w = 10; - int64 uid = 1; + optional int64 uid = 1; } message ProfileRequest { diff --git a/app/src/main/protos/User.proto b/app/src/main/protos/User.proto index cd0ce9c9..41c1e4df 100644 --- a/app/src/main/protos/User.proto +++ b/app/src/main/protos/User.proto @@ -17,10 +17,20 @@ message User { int32 is_manager = 11; int32 is_bawu = 25; string bawu_type = 26; + int32 fans_num = 30; + int32 concern_num = 31; + int32 sex = 32; + int32 my_like_num = 33; + string intro = 34; int32 has_concerned = 35; + int32 post_num = 37; + string tb_age = 38; int32 gender = 42; PrivSets privSets = 45; string fansNickname = 57; + int32 thread_num = 87; + int32 agree_num = 88; int32 priv_thread = 92; int32 isDefaultAvatar = 106; + uint32 total_agree_num = 118; } \ No newline at end of file