Merge branch 'main' of https://git.sparkus.cn/yangzhao/server
This commit is contained in:
commit
0b9a0b93fb
|
|
@ -45,6 +45,17 @@ export function getChinaDateKey(now = Date.now()) {
|
|||
return String(Math.floor((now + UTC_8_OFFSET_MS) / DAY_MS));
|
||||
}
|
||||
|
||||
export function getUserSignInTriggerLevel(user: any, config: SignInActivityConfig): number {
|
||||
let assignments = user?.abTests;
|
||||
if (typeof assignments === "string") {
|
||||
try { assignments = JSON.parse(assignments); } catch { assignments = null; }
|
||||
}
|
||||
const assignment = assignments?.layer_1;
|
||||
const isNewPlayerB = !!assignment && assignment.name === "new1_50" && assignment.enabled !== false
|
||||
&& ["B", "2"].includes(String(assignment.group).toUpperCase());
|
||||
return isNewPlayerB ? 15 : Number(config.triggerLevel);
|
||||
}
|
||||
|
||||
export function getUserSignInLevel(user: any) {
|
||||
const level = Number(user?.levelAmount);
|
||||
return Number.isFinite(level) && level > 0 ? level : 0;
|
||||
|
|
@ -133,7 +144,7 @@ export async function activateSignInActivity(user: any, now = Date.now()) {
|
|||
return { activated: false, state: normalizeSignInState(user?.signInActivity), config: null };
|
||||
}
|
||||
const config = await getActiveSignInConfig();
|
||||
if (!config || getUserSignInLevel(user) < Number(config.triggerLevel)) {
|
||||
if (!config || getUserSignInLevel(user) < getUserSignInTriggerLevel(user, config)) {
|
||||
return { activated: false, state: null, config };
|
||||
}
|
||||
const startAt = getChinaDayStart(now);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,18 @@ export default async function (ctx: FunctionContext) {
|
|||
count = 1;
|
||||
return;
|
||||
}
|
||||
let add = oldAdd + count;
|
||||
// B组前15关只推进主线;补报跨过15关时也只计算门槛之后的胜利。
|
||||
let assignments = res1.data?.abTests;
|
||||
if (typeof assignments === "string") {
|
||||
try { assignments = JSON.parse(assignments); } catch { assignments = null; }
|
||||
}
|
||||
const assignment = assignments?.layer_1;
|
||||
const isNewPlayerB = !!assignment && assignment.name === "new1_50" && assignment.enabled !== false
|
||||
&& ["B", "2"].includes(String(assignment.group).toUpperCase());
|
||||
const careerCount = isNewPlayerB
|
||||
? Math.max(levelAmount - 15, 0) - Math.max(oldlevelAmount - 15, 0)
|
||||
: count;
|
||||
let add = oldAdd + careerCount;
|
||||
let isWhite = res1.data?.isWhite;
|
||||
let careerAmount = res1.data?.careerAmount || 0;
|
||||
if (isWuXian == "true") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user