Skip to content

Commit

Permalink
Merge pull request #30 from zxhchime/master
Browse files Browse the repository at this point in the history
add:kitex批量查询关注状态&comment服务函数名更改
  • Loading branch information
zxhchime authored Feb 21, 2023
2 parents a2642b8 + c0d1028 commit c592d6d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
4 changes: 2 additions & 2 deletions kitex_server/interaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ func GetIsFavoriteMap(idSet []int64, currentUser int64, respIsFavoriteMap chan m
// 传入videoId切片,批量视频的评论数量
func GetCommentCountMap(idSet []int64, respIsFavoriteMap chan map[int64]int64, wg *sync.WaitGroup, errChan chan error) {
defer wg.Done()

res, err := CommentClient.VideosFavoriteCountMethod(context.Background(), &comment.VideosCommentCountReq{
// TODO comment服务改名了
res, err := CommentClient.VideosCommentCountMethod(context.Background(), &comment.VideosCommentCountReq{
VideoIdList: idSet,
})
if err != nil {
Expand Down
42 changes: 41 additions & 1 deletion kitex_server/relationservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,49 @@ func VerifyFollowParam(myUid int64, targetUid int64, actionType int32) *string {
return nil
}

// TODO : .GetIsFollowSetByUserIdSet
// 根据userIds 批量获取用户关注状态
func GetIsFollowSetByUserIdSet(myUid int64, idSet []int64) (map[int64]bool, error) {
resp, err := Relationclient.GetIsFollowsMethod(context.Background(), &relationserver.GetIsFollowsReq{MyUid: myUid, UserIds: idSet})
if err != nil {
log.Errorf("GetIsFollowSetByUserIdSet rpc请求relation服务失败,详情:%s", err)
return nil, fmt.Errorf("本次请求失败,请稍后重试")
}
switch resp.StatusCode {
case SUCCESS:
return resp.IsFollowMap, nil
case ERROR:
log.Errorf("relation服务异常,详情:%s", *resp.Msg)
break
case VERIFY:
log.Errorf("relation服务参数校验异常,详情:%s", *resp.Msg)
break
default:
break
}
return nil, fmt.Errorf("本次请求失败,请稍后重试")
}

// TODO : .GetIsFollowMapByUserIdSet
func GetIsFollowMapByUserIdSet(uid int64, idSet []int64) (isFollowMap map[int64]bool, err error) {
return nil, nil
resp, err := Relationclient.GetIsFollowsMethod(context.Background(), &relationserver.GetIsFollowsReq{MyUid: uid, UserIds: idSet})
if err != nil {
log.Errorf("GetIsFollowSetByUserIdSet rpc请求relation服务失败,详情:%s", err)
return nil, fmt.Errorf("本次请求失败,请稍后重试")
}
switch resp.StatusCode {
case SUCCESS:
return resp.IsFollowMap, nil
case ERROR:
log.Errorf("relation服务异常,详情:%s", *resp.Msg)
break
case VERIFY:
log.Errorf("relation服务参数校验异常,详情:%s", *resp.Msg)
break
default:
break
}
return nil, fmt.Errorf("本次请求失败,请稍后重试")
}

// 协程接口
Expand Down

0 comments on commit c592d6d

Please sign in to comment.