diff --git a/server/jccommon/utils.go b/server/jccommon/utils.go index 77669a13..c7052a51 100644 --- a/server/jccommon/utils.go +++ b/server/jccommon/utils.go @@ -26,16 +26,8 @@ func IsAirDropNft(tokenId string) bool { return tokenIdInt64 >= 6000000000000000 && tokenIdInt64 <= 7000000000000000 } -func IsGenesisHero(tokenId string) bool { - tokenIdInt64, err := strconv.ParseInt(tokenId, 10, 64) - if err != nil { - tokenIdInt64 = 0 - } - return tokenIdInt64 > 6240603010001668 && tokenIdInt64 <= 6240603010002168 -} - -func GetHeroStackingScore(quality int32) int64 { - var score int64 +func GetHeroStackingScore(quality int32) float64 { + var score float64 switch quality { case 2: score = 10 @@ -53,8 +45,8 @@ func GetHeroStackingScore(quality int32) int64 { return score } -func GetFounderTagStackingScore(quality int32) int64 { - var score int64 +func GetFounderTagStackingScore(quality int32) float64 { + var score float64 switch quality { case 1: score = 20 @@ -68,15 +60,15 @@ func GetFounderTagStackingScore(quality int32) int64 { return score } -func CalcContributionScore(nfts []*NftStacking) int64 { - var score int64 - var baseScore int64 +func CalcContributionScore(nfts []*NftStacking) float64 { + var score float64 + var baseScore float64 var rate float64 for _, v := range nfts { switch v.TokenType { case NFT_TYPE_CFHERO, NFT_TYPE_CFHERO_NORMAL: { baseScore += GetHeroStackingScore(v.Quality) - if IsGenesisHero(v.TokenId) { + if v.TokenType == NFT_TYPE_CFHERO { rate += 0.05 } } @@ -89,6 +81,6 @@ func CalcContributionScore(nfts []*NftStacking) int64 { if rate > 1 { rate = 1 } - score = int64(float64(baseScore) * (1 + rate)) + score = baseScore * (1 + rate) return score } diff --git a/server/light_backtask/task/contribution.go b/server/light_backtask/task/contribution.go index a797083d..84f69fbf 100644 --- a/server/light_backtask/task/contribution.go +++ b/server/light_backtask/task/contribution.go @@ -19,7 +19,7 @@ type accountStacking struct { nfts []*jccommon.NftStacking } -func (this* accountStacking) calcScore() int64 { +func (this* accountStacking) calcScore() float64 { return jccommon.CalcContributionScore(this.nfts) }