|
@@ -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 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|