Browse Source

update

master
shenjiachi 1 week ago
parent
commit
c15ae5604f
3 changed files with 8 additions and 7 deletions
  1. +2
    -0
      app/hdl/friend_circle/hdl_friend_circle.go
  2. +1
    -1
      app/router/router.go
  3. +5
    -6
      app/svc/friend_circle/svc_firend_circle.go

+ 2
- 0
app/hdl/friend_circle/hdl_friend_circle.go View File

@@ -44,6 +44,8 @@ func MySelfList(c *gin.Context) {
e.OutErr(c, e.ERR, err.Error()) e.OutErr(c, e.ERR, err.Error())
return return
} }
resp.Page = args.Page
resp.PageSize = args.PageSize
e.OutSuc(c, resp, nil) e.OutSuc(c, resp, nil)
} }




+ 1
- 1
app/router/router.go View File

@@ -199,7 +199,7 @@ func route(r *gin.RouterGroup) {


func rCircleFriends(r *gin.RouterGroup) { func rCircleFriends(r *gin.RouterGroup) {
r.POST("/mySelfList", friend_circle.MySelfList) // 我的朋友圈列表 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("/commentList", friend_circle.CommentList) // 评论列表
r.POST("/commentDetail", friend_circle.CommentDetail) // 评论详情 r.POST("/commentDetail", friend_circle.CommentDetail) // 评论详情
r.POST("/publish", friend_circle.Publish) // 发送朋友圈 r.POST("/publish", friend_circle.Publish) // 发送朋友圈


+ 5
- 6
app/svc/friend_circle/svc_firend_circle.go View File

@@ -72,7 +72,7 @@ func MySelfList(c *gin.Context, req friend_circles.MySelfListReq) (resp friend_c


//获取当前用户在im中的user_id //获取当前用户在im中的user_id
var friends []*model.Friend 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 { if err != nil {
return return
} }
@@ -127,18 +127,17 @@ func GetRecommendList(c *gin.Context, req friend_circles.RecommendListReq) (resp


// 构建查询 // 构建查询
query := elastic.NewBoolQuery() 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(). searchResult, err := es.EsClient.Search().
Index(md.EggFriendCircleEsIndex). // 替换为你的索引名称
Index(md.EggFriendCircleEsAlias). // 替换为你的索引名称
Query(query). Query(query).
Sort("create_at", false). // 按时间倒排
//Sort("create_at", false). // 按时间倒排
From(from). From(from).
Size(req.PageSize). Size(req.PageSize).
Pretty(true). Pretty(true).
Do(context.Background()) Do(context.Background())
if err != nil { if err != nil {
logx.Fatalf("Error searching for documents: %v", err)
return return
} }




Loading…
Cancel
Save