|
@@ -8,9 +8,15 @@ import ( |
|
|
"applet/app/utils" |
|
|
"applet/app/utils" |
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" |
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" |
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
"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" |
|
|
"fmt" |
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
|
|
|
"github.com/olivere/elastic/v7" |
|
|
"github.com/shopspring/decimal" |
|
|
"github.com/shopspring/decimal" |
|
|
|
|
|
"time" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
// MemberCenterGetBasic |
|
|
// MemberCenterGetBasic |
|
@@ -108,18 +114,17 @@ func MemberCenterGetBasic(c *gin.Context) { |
|
|
|
|
|
|
|
|
// 5. 查询蛋蛋分 |
|
|
// 5. 查询蛋蛋分 |
|
|
score := 60.00 |
|
|
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 := elastic.NewBoolQuery() |
|
|
//boolQuery.Filter(elastic.NewTermQuery("uid", user.Id)) |
|
|
//boolQuery.Filter(elastic.NewTermQuery("uid", user.Id)) |
|
@@ -139,18 +144,18 @@ func MemberCenterGetBasic(c *gin.Context) { |
|
|
// // 解析结果 |
|
|
// // 解析结果 |
|
|
// for _, hit := range searchResult.Hits.Hits { |
|
|
// for _, hit := range searchResult.Hits.Hits { |
|
|
// todo 解除注释 |
|
|
// 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) |
|
|
ratio := decimal.NewFromInt(1).Div(nowPrice).StringFixed(16) |
|
|
ratioStr := fmt.Sprintf("%s:1", ratio) |
|
|
ratioStr := fmt.Sprintf("%s:1", ratio) |
|
|
|
|
|
|
|
|