diff --git a/app/hdl/friend_circle/hdl_friend_circle.go b/app/hdl/friend_circle/hdl_friend_circle.go index 5f8ef75..fce2a06 100644 --- a/app/hdl/friend_circle/hdl_friend_circle.go +++ b/app/hdl/friend_circle/hdl_friend_circle.go @@ -44,6 +44,8 @@ func MySelfList(c *gin.Context) { e.OutErr(c, e.ERR, err.Error()) return } + resp.Page = args.Page + resp.PageSize = args.PageSize e.OutSuc(c, resp, nil) } diff --git a/app/router/router.go b/app/router/router.go index 5196b3b..e1867e4 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -199,7 +199,7 @@ func route(r *gin.RouterGroup) { func rCircleFriends(r *gin.RouterGroup) { r.POST("/mySelfList", friend_circle.MySelfList) // 我的朋友圈列表 - r.GET("/recommendList", friend_circle.RecommendList) // 推荐列表 + r.POST("/recommendList", friend_circle.RecommendList) // 推荐列表 r.POST("/commentList", friend_circle.CommentList) // 评论列表 r.POST("/commentDetail", friend_circle.CommentDetail) // 评论详情 r.POST("/publish", friend_circle.Publish) // 发送朋友圈 diff --git a/app/svc/friend_circle/svc_firend_circle.go b/app/svc/friend_circle/svc_firend_circle.go index 6357c5c..26f9b9a 100644 --- a/app/svc/friend_circle/svc_firend_circle.go +++ b/app/svc/friend_circle/svc_firend_circle.go @@ -72,7 +72,7 @@ func MySelfList(c *gin.Context, req friend_circles.MySelfListReq) (resp friend_c //获取当前用户在im中的user_id var friends []*model.Friend - err = db.DbIm.Where("`phone_number`=?", user.Phone).Limit(5000).Find(&friends) + err = db.DbIm.Where("`user_id`=?", user.Id).Limit(5000).Find(&friends) if err != nil { return } @@ -127,18 +127,17 @@ func GetRecommendList(c *gin.Context, req friend_circles.RecommendListReq) (resp // 构建查询 query := elastic.NewBoolQuery() - query.Must(elastic.NewTermQuery("state", "1")) - query.Should(elastic.NewTermQuery("is_top_up", "1")) + query.Must(elastic.NewTermQuery("state", 1)) + query.Should(elastic.NewTermQuery("is_top_up", 1)) searchResult, err := es.EsClient.Search(). - Index(md.EggFriendCircleEsIndex). // 替换为你的索引名称 + Index(md.EggFriendCircleEsAlias). // 替换为你的索引名称 Query(query). - Sort("create_at", false). // 按时间倒排 + //Sort("create_at", false). // 按时间倒排 From(from). Size(req.PageSize). Pretty(true). Do(context.Background()) if err != nil { - logx.Fatalf("Error searching for documents: %v", err) return }