Skip to content

Commit

Permalink
quota: fix unlimited available point
Browse files Browse the repository at this point in the history
  • Loading branch information
pandadtdyy committed Oct 18, 2023
1 parent de37490 commit 40faebd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function apply(ctx: Context) {
if (moment(quota.expireTime).diff(moment(), 'days') <= 3) {
MessageModel.sendNotification(['Hydro & 洛谷开放平台提醒:', info, '点数有效期已不足3天,请及时联系Hydro开发组或洛谷官方进行充值或续费。'].join('\n'));
}
if (quota.availablePoints < 1000) {
if (quota.availablePoints > 0 && quota.availablePoints < 1000) {
MessageModel.sendNotification(['Hydro & 洛谷开放平台提醒:', info, '点数已不足1000,请及时联系Hydro开发组或洛谷官方进行充值或续费。'].join('\n'));
}
});
Expand Down
2 changes: 1 addition & 1 deletion provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default class LuoguProvider extends BasicFetcher implements IBasicProvide
const { body } = await this.get('/judge/quotaAvailable');
this.quota = {
orgName: body.quotas[0].org.name,
availablePoints: body.quotas[0].availablePoints,
availablePoints: body.quotas[0].availablePoints ?? -1,
createTime: body.quotas[0].createTime * 1000,
expireTime: body.quotas[0].expireTime * 1000,
updateAt: Date.now(),
Expand Down

0 comments on commit 40faebd

Please sign in to comment.