mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-06 00:05:30 +00:00
The automatic reset sorts the available credits by expiry and consumes the first one by id, but the admin reset button sent no credit_id and let upstream pick. Upstream can then spend a later credit and leave the one closest to expiry to lapse, while the account list shows that earliest expiry next to the button. ResetCredit now reads the credit list first and targets the credit that expires first. When the list cannot name it (request failed, a credit without expiry or id, fewer credits listed than available, unparsable expiry) the request stays untargeted as before.