shenjiachi vor 1 Woche
Ursprung
Commit
01b3c2f1a1
3 geänderte Dateien mit 30 neuen und 4 gelöschten Zeilen
  1. +1
    -1
      app/hdl/friend_circle/hdl_friend_circle.go
  2. +3
    -3
      app/svc/friend_circle/svc_firend_circle.go
  3. +26
    -0
      app/svc/friend_circle/svc_firend_circle_test.go

+ 1
- 1
app/hdl/friend_circle/hdl_friend_circle.go Datei anzeigen

@@ -154,7 +154,7 @@ func RecommendList(c *gin.Context) {
e.OutErr(c, err1.Code, err1.Error())
return
}
resp, err := svc2.GetRecommendList(c, req)
resp, err := svc2.GetRecommendList(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return


+ 3
- 3
app/svc/friend_circle/svc_firend_circle.go Datei anzeigen

@@ -91,7 +91,7 @@ func MySelfList(c *gin.Context, req friend_circles.MySelfListReq) (resp friend_c
searchResult, err := es.EsClient.Search().
Index(md.EggFriendCircleEsIndex). // 替换为你的索引名称
Query(query).
Sort("create_at", false). // 按时间倒排
Sort("created_at", false). // 按时间倒排
From(from).
Size(req.PageSize).
Pretty(true).
@@ -121,7 +121,7 @@ func MySelfList(c *gin.Context, req friend_circles.MySelfListReq) (resp friend_c
return
}

func GetRecommendList(c *gin.Context, req friend_circles.RecommendListReq) (resp friend_circles.RecommendListResp, err error) {
func GetRecommendList(req friend_circles.RecommendListReq) (resp friend_circles.RecommendListResp, err error) {
// 分页参数
from := (req.Page - 1) * req.PageSize

@@ -132,7 +132,7 @@ func GetRecommendList(c *gin.Context, req friend_circles.RecommendListReq) (resp
searchResult, err := es.EsClient.Search().
Index(md.EggFriendCircleEsAlias). // 替换为你的索引名称
Query(query).
//Sort("create_at", false). // 按时间倒排
Sort("created_at", false). // 按时间倒排
From(from).
Size(req.PageSize).
Pretty(true).


+ 26
- 0
app/svc/friend_circle/svc_firend_circle_test.go Datei anzeigen

@@ -0,0 +1,26 @@
package svc

import (
"applet/app/md/friend_circles"
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
"fmt"
"testing"
)

func TestGetRecommendList(test *testing.T) {
req := friend_circles.RecommendListReq{
Page: 1,
PageSize: 10,
}
es.Init("http://120.55.48.175:9200", "elastic", "fnuo123")
fmt.Println("start")
list, err := GetRecommendList(req)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
if &list != nil {
fmt.Println(list)
}
}

Laden…
Abbrechen
Speichern