瀏覽代碼

restore

master
shenjiachi 4 天之前
父節點
當前提交
d07a63d1f5
共有 3 個檔案被更改,包括 30 行新增30 行删除
  1. +1
    -5
      app/hdl/friend_circle/hdl_friend_circle._test.go
  2. +29
    -24
      app/hdl/hdl_member_center.go
  3. +0
    -1
      app/hdl/hdl_points_center.go

+ 1
- 5
app/hdl/friend_circle/hdl_friend_circle._test.go 查看文件

@@ -120,15 +120,11 @@ func TestCreateTempEggScoreIndex(t *testing.T) {
// 创建蛋蛋分记录
func TestCreateEggScoreIndex(t *testing.T) {
es.Init("http://120.55.48.175:9200", "elastic", "fnuo123")
index := fmt.Sprintf("%s_%d", md.EggEnergyUserEggScoreEsAlias, 202451)
index := fmt.Sprintf("%s_%d", md.EggEnergyUserEggScoreEsAlias, 202452)
err := es.CreateIndexIfNotExists(index, md.EggEnergyUserEggScoreEsMapping)
if err != nil {
fmt.Println(err)
}

for i := 1; i < 650; i++ {
egg_energy.ExistOrDefaultUserEggScore(int64(i))
}

fmt.Println("success")
}

+ 29
- 24
app/hdl/hdl_member_center.go 查看文件

@@ -8,9 +8,15 @@ import (
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
es2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/es"
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"github.com/olivere/elastic/v7"
"github.com/shopspring/decimal"
"time"
)

// MemberCenterGetBasic
@@ -108,18 +114,17 @@ func MemberCenterGetBasic(c *gin.Context) {

// 5. 查询蛋蛋分
score := 60.00
// todo 解除注释
//now := time.Now()
//esIndex := es2.GetLatestEffectiveIndexFromAlias(now)
//esIndexName := md2.EggEnergyUserEggScoreEsAlias + "_" + esIndex
//results, err := es.FirstDoc(esIndexName, esIndex+"_"+utils.Int64ToStr(user.Id))
//if err != nil {
// if !elastic.IsNotFound(err) {
// e.OutErr(c, e.ERR, err.Error())
// return
// }
//}
// todo 解除注释
now := time.Now()
esIndex := es2.GetLatestEffectiveIndexFromAlias(now)
esIndexName := md2.EggEnergyUserEggScoreEsAlias + "_" + esIndex
results, err := es.FirstDoc(esIndexName, esIndex+"_"+utils.Int64ToStr(user.Id))
if err != nil {
if !elastic.IsNotFound(err) {
e.OutErr(c, e.ERR, err.Error())
return
}
}

//// 构建查询条件
//boolQuery := elastic.NewBoolQuery()
//boolQuery.Filter(elastic.NewTermQuery("uid", user.Id))
@@ -139,18 +144,18 @@ func MemberCenterGetBasic(c *gin.Context) {
// // 解析结果
// for _, hit := range searchResult.Hits.Hits {
// todo 解除注释
//if !elastic.IsNotFound(err) {
// var doc md.UserEggFlowReqRespList
// err = json.Unmarshal(results.Source, &doc)
// if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, nil)
// return
// }
// // results = append(results, doc)
// // }
// //}
// score = doc.ScoreValue
//}
if !elastic.IsNotFound(err) {
var doc md.UserEggFlowReqRespList
err = json.Unmarshal(results.Source, &doc)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, nil)
return
}
// results = append(results, doc)
// }
//}
score = doc.ScoreValue
}
ratio := decimal.NewFromInt(1).Div(nowPrice).StringFixed(16)
ratioStr := fmt.Sprintf("%s:1", ratio)



+ 0
- 1
app/hdl/hdl_points_center.go 查看文件

@@ -744,7 +744,6 @@ func GetEggPointRecord(c *gin.Context) {
now := time.Now()

list, nowScore, indexNum, err := svc.GetEggPointRecordBase(now, user.Id, page, limit)
err = errors.New("修改es索引默认返回")
if err != nil {
resp := md.GetEggPointRecordResp{
NowScore: "60",


Loading…
取消
儲存