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:
commit
14a9acd368
2368 files changed
+551035
No files matched your search
@@ -0,0 +1,65 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func ListSystemInstances(c *gin.Context) {
|
||||
instances, err := model.ListSystemInstances()
|
||||
if err != nil {
|
||||
common.ApiError(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
now := common.GetTimestamp()
|
||||
responses := make([]model.SystemInstanceResponse, 0, len(instances))
|
||||
for _, instance := range instances {
|
||||
responses = append(responses, instance.ToResponse(now))
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"message": "",
|
||||
"data": responses,
|
||||
})
|
||||
}
|
||||
|
||||
func DeleteStaleSystemInstances(c *gin.Context) {
|
||||
deletedCount, err := model.DeleteStaleSystemInstances(common.GetTimestamp())
|
||||
if err != nil {
|
||||
common.ApiError(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
common.ApiSuccess(c, gin.H{
|
||||
"deleted_count": deletedCount,
|
||||
})
|
||||
}
|
||||
|
||||
func DeleteStaleSystemInstance(c *gin.Context) {
|
||||
nodeName := c.Param("node_name")
|
||||
if strings.TrimSpace(nodeName) == "" {
|
||||
common.ApiErrorMsg(c, "node name is required")
|
||||
return
|
||||
}
|
||||
|
||||
deleted, err := model.DeleteStaleSystemInstance(nodeName, common.GetTimestamp())
|
||||
if err != nil {
|
||||
common.ApiError(c, err)
|
||||
return
|
||||
}
|
||||
if !deleted {
|
||||
common.ApiErrorMsg(c, "instance is not stale or no longer exists")
|
||||
return
|
||||
}
|
||||
|
||||
common.ApiSuccess(c, gin.H{
|
||||
"deleted_count": 1,
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user