助力宝箱获得积分

This commit is contained in:
CounterFire2023 2024-04-08 17:13:15 +08:00
parent ce047114f6
commit 4c1a059ee0
2 changed files with 22 additions and 2 deletions

View File

@ -46,6 +46,8 @@ export const SCORE_GAME_STEP = 'game_step'
export const SCORE_SOCIAL_TASK = 'Social Tasks'
// 积分类型-邀请用户额外收益
export const SCORE_INVITE_REBATE = 'invite_rebate'
// 积分类型-宝箱助力
export const SCORE_ENHANCE_CHEST_GIFT = 'enhance_chest_gift'
// google reCaptcha最小分数
export const RECAPTCHA_MIN_SCORE = 0.5
@ -54,3 +56,5 @@ export const RECAPTCHA_MIN_SCORE = 0.5
export const MAX_ENHANCE_COUNT_BASE = 1
// 高级用户每日可助力次数
export const MAX_ENHANCE_COUNT_ADV = 10
// 宝箱助力增加的分数
export const ENHANCE_CHEST_GIFT = 10

View File

@ -6,7 +6,13 @@ import { formatDate } from 'zutils/utils/date.util'
import { ScoreRecord } from 'models/ScoreRecord'
import { ChestRecord } from 'models/chain/ChestRecord'
import { generateNewChest } from 'services/game.svr'
import { MAX_ENHANCE_COUNT_ADV, MAX_ENHANCE_COUNT_BASE, SCORE_OPEN_CHEST } from 'common/Constants'
import {
ENHANCE_CHEST_GIFT,
MAX_ENHANCE_COUNT_ADV,
MAX_ENHANCE_COUNT_BASE,
SCORE_ENHANCE_CHEST_GIFT,
SCORE_OPEN_CHEST,
} from 'common/Constants'
import { formatAddress } from 'zutils/utils/chain.util'
import { isObjectIdString, isValidShareCode } from 'common/Utils'
import { checkReCaptcha } from 'services/google.svr'
@ -196,8 +202,18 @@ class BoxController extends BaseController {
score,
})
await enhanceRecord.save()
await updateRankScore({
user: user.id,
score: ENHANCE_CHEST_GIFT,
activity: user.activity,
scoreType: SCORE_ENHANCE_CHEST_GIFT,
scoreParams: {
date: dateTag,
chestId: chest.id,
},
})
return {
score,
score: ENHANCE_CHEST_GIFT,
}
// const chestsForUser = await ActivityChest.find({ user: uid, activity: user.activity })
// 如果用户没有宝箱, 则说明用户是新用户, 生成一个宝箱