feat(custom): CNY native billing, daily check-in button, subscription plans page, usage docs and promo banner

Based on QuantumNous/new-api v1.0.0-rc.36 (shallow history squashed).

- CNY quota display mode: RMB-denominated top-up and crediting across Epay/Waffo channels
- New CheckinButton in both authenticated and public headers (Turnstile supported)
- New /subscribe page with public plan snapshot, Alipay/balance payment, auto group upgrade/reset
- New /docs 12-section beginner guide with anchor navigation
- New home PromoBanner linking to /docs; i18n synced (en/zh/zh-TW/fr/ja/ru/vi)
- README: document custom features, live demo https://ai.88531.cn
This commit is contained in:
CaIon committed 2026-09-23 16:28:52 +08:00
commit 14a9acd368
2368 files changed
+551035

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
package common
import "github.com/gin-gonic/gin"
// BillingSettler 抽象计费会话的生命周期操作。
// 由 service.BillingSession 实现,存储在 RelayInfo 上以避免循环引用。
type BillingSettler interface {
// Settle 根据实际消耗额度进行结算,计算 delta = actualQuota - preConsumedQuota,
// 同时调整资金来源(钱包/订阅)和令牌额度。
Settle(actualQuota int) error
// Refund 退还所有预扣费额度(资金来源 + 令牌),幂等安全。
// 通过 gopool 异步执行。如果已经结算或退款则不做任何操作。
Refund(c *gin.Context)
// NeedsRefund 返回会话是否存在需要退还的预扣状态(未结算且未退款)。
NeedsRefund() bool
// GetPreConsumedQuota 返回实际预扣的额度值(信任用户可能为 0)。
GetPreConsumedQuota() int
// Reserve 将预扣额度补到目标值;若目标值不高于当前预扣额度则不做任何事。
Reserve(targetQuota int) error
}