|
|
@@ -19,14 +19,9 @@ import ( |
|
|
|
enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/enum" |
|
|
|
md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" |
|
|
|
svc2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/svc" |
|
|
|
es2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/es" |
|
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" |
|
|
|
"context" |
|
|
|
"encoding/json" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"github.com/olivere/elastic/v7" |
|
|
|
"github.com/shopspring/decimal" |
|
|
|
"strconv" |
|
|
|
"time" |
|
|
@@ -687,50 +682,6 @@ func GetContributionValueFlow(c *gin.Context) { |
|
|
|
e.OutSuc(c, resp, nil) |
|
|
|
} |
|
|
|
|
|
|
|
func GetPointMap(c *gin.Context) { |
|
|
|
val, exists := c.Get("user") |
|
|
|
if !exists { |
|
|
|
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
user, ok := val.(*model.User) |
|
|
|
if !ok { |
|
|
|
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
now := time.Now() |
|
|
|
// 1. 获取当期有效蛋蛋分 |
|
|
|
nowIndex := md2.EggEnergyUserEggScoreEsAlias + "_" + es2.GetLatestEffectiveIndexFromAlias(now) |
|
|
|
boolQuery := elastic.NewBoolQuery() |
|
|
|
boolQuery.Filter(elastic.NewTermQuery("uid", user.Id)) |
|
|
|
searchResult, err := es.EsClient.Search(). |
|
|
|
Index(nowIndex). |
|
|
|
Query(boolQuery). |
|
|
|
Pretty(true). |
|
|
|
Do(context.Background()) |
|
|
|
if searchResult == nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, errors.New("failed to get current egg score")) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
var results []md.UserEggFlowReqRespList |
|
|
|
if searchResult.Hits.TotalHits.Value != 0 { |
|
|
|
// 解析结果 |
|
|
|
for _, hit := range searchResult.Hits.Hits { |
|
|
|
var doc md.UserEggFlowReqRespList |
|
|
|
err = json.Unmarshal(hit.Source, &doc) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
results = append(results, doc) |
|
|
|
} |
|
|
|
} |
|
|
|
// nowScore := utils.Float64ToStr(results[0].ScoreValue) |
|
|
|
// todo 计算分数权重 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// GetEggPointRecord |
|
|
|
// @Summary 蛋蛋星球-积分中心-蛋蛋分明细(获取) |
|
|
|
// @Tags 积分中心 |
|
|
|