Skip to content

Commit

Permalink
feat: anonymity user
Browse files Browse the repository at this point in the history
  • Loading branch information
liaosunny123 committed Sep 1, 2023
1 parent ad67c5f commit 9cb52fb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/web/feed/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
_ "github.com/mbobakov/grpc-consul-resolver"
"github.com/sirupsen/logrus"
"net/http"
"strconv"
)

var Client feed.FeedServiceClient
Expand Down Expand Up @@ -42,7 +43,17 @@ func ListVideosByRecommendHandle(c *gin.Context) {
actorId := uint32(req.ActorId)
var res *feed.ListFeedResponse
var err error
if actorId == 0 {
anonymity, err := strconv.ParseUint(config.EnvCfg.AnonymityUser, 10, 32)
if err != nil {
c.JSON(http.StatusOK, models.ListVideosRes{
StatusCode: strings.FeedServiceInnerErrorCode,
StatusMsg: strings.FeedServiceInnerError,
NextTime: nil,
VideoList: nil,
})
return
}
if actorId == uint32(anonymity) {
res, err = Client.ListVideos(c.Request.Context(), &feed.ListFeedRequest{
LatestTime: &latestTime,
ActorId: &actorId,
Expand Down

0 comments on commit 9cb52fb

Please sign in to comment.