mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
fix(codebuddy-cn): show bonus packs as one-time, not monthly-replenishing
CodeBuddy CN bonus packs ("Bonus Pack N") are one-shot credits whose
CycleEndTime equals DeductionEndTime — they expire for good and never
replenish. The dashboard rendered their resetAt as "Reset in Xd",
implying a monthly refill.
Tag bonus packs recurring:false (refill packs recurring:true) in the
usage handler, forward the flag through parseQuotaData, and word the
quota table / progress bar as "Expires in" / "Expires at" for
one-shot packs.
This commit is contained in:
@@ -109,15 +109,22 @@ export async function getCodeBuddyCnUsage(accessToken, apiKey, providerSpecificD
|
||||
total: num(acc.CycleCapacitySizePrecise, acc.CycleCapacitySize),
|
||||
resetAt: parseResetTime(acc.CycleEndTime),
|
||||
unlimited: false,
|
||||
// Recurring allowance: the CycleEndTime is the next refresh, not the
|
||||
// final expiry. The UI must show "Resets in", not "Expires in".
|
||||
recurring: true,
|
||||
};
|
||||
});
|
||||
// Bonus packs: use the lifetime Capacity balance; resetAt is the expiry.
|
||||
// These are one-shot credits (CycleEndTime == DeductionEndTime), so they
|
||||
// never replenish — mark recurring:false so the UI shows "Expires in"
|
||||
// instead of implying a monthly refill.
|
||||
bonuses.forEach((acc, i) => {
|
||||
quotas[`Bonus Pack ${i + 1}`] = {
|
||||
used: num(acc.CapacityUsedPrecise, acc.CapacityUsed),
|
||||
total: num(acc.CapacitySizePrecise, acc.CapacitySize),
|
||||
resetAt: parseResetTime(acc.CycleEndTime),
|
||||
unlimited: false,
|
||||
recurring: false,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user