diff --git a/laf-cloud/functions/userProp.ts b/laf-cloud/functions/userProp.ts index 6c29e05..26e3933 100644 --- a/laf-cloud/functions/userProp.ts +++ b/laf-cloud/functions/userProp.ts @@ -46,7 +46,7 @@ export default async function (ctx: FunctionContext) { data.infiniteRocketTime = user.data?.infiniteRocketTime || 0; let propType = Number(ctx.body.propType); let propData = ctx.body.propData; - const boosterField = propType === 2004 ? "hourglassAmount" : propType === 2005 ? "rocketAmount" : null; + const boosterField = propType === 2006 ? "hourglassAmount" : propType === 2007 ? "rocketAmount" : null; if (!propType && propType != 0) { return { code: 0, data: null, msg: "未获取到propType" }; } diff --git a/laf-cloud/tests/user-prop-boosters.test.mjs b/laf-cloud/tests/user-prop-boosters.test.mjs index 10e24cd..63f1863 100644 --- a/laf-cloud/tests/user-prop-boosters.test.mjs +++ b/laf-cloud/tests/user-prop-boosters.test.mjs @@ -48,7 +48,7 @@ function save(propType, propData, extra = {}) { return userProp({ body: { uid: "u1", token: "valid", action: "save", propType, propData, ...extra } }); } -for (const [propType, field, responseField] of [[2004, "hourglassAmount", "hourglass"], [2005, "rocketAmount", "rocket"]]) { +for (const [propType, field, responseField] of [[2006, "hourglassAmount", "hourglass"], [2007, "rocketAmount", "rocket"]]) { test(`${propType} saves only its own count and timestamp`, async () => { reset(); const original = { ...user }; @@ -69,7 +69,7 @@ for (const [propType, field, responseField] of [[2004, "hourglassAmount", "hourg test(`${propType} does not undo concurrent changes to another prop or infinite entitlement`, async () => { reset(); - const otherField = propType === 2004 ? "rocketAmount" : "hourglassAmount"; + const otherField = propType === 2006 ? "rocketAmount" : "hourglassAmount"; beforeUpdate = () => Object.assign(user, { hammerAmount: 8, [otherField]: 9, infiniteRocketTime: 999 }); await save(propType, "2"); assert.equal(user[field], 2); @@ -88,7 +88,7 @@ for (const [propType, field, responseField] of [[2004, "hourglassAmount", "hourg } test("invalid token cannot change either new prop", async () => { - for (const propType of [2004, 2005]) { + for (const propType of [2006, 2007]) { reset(); assert.equal((await save(propType, "3", { token: "invalid" })).code, 0); assert.deepEqual(writes, []);