mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 13:00:14 +09:00
39 lines
873 B
Go
39 lines
873 B
Go
package admin
|
|
|
|
import (
|
|
"chat/utils"
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
)
|
|
|
|
func InfoAPI(c *gin.Context) {
|
|
db := utils.GetDBFromContext(c)
|
|
cache := utils.GetCacheFromContext(c)
|
|
|
|
c.JSON(http.StatusOK, InfoForm{
|
|
SubscriptionCount: GetSubscriptionUsers(db),
|
|
BillingToday: GetBillingToday(cache),
|
|
BillingMonth: GetBillingMonth(cache),
|
|
})
|
|
}
|
|
|
|
func ModelAnalysisAPI(c *gin.Context) {
|
|
cache := utils.GetCacheFromContext(c)
|
|
c.JSON(http.StatusOK, GetModelData(cache))
|
|
}
|
|
|
|
func RequestAnalysisAPI(c *gin.Context) {
|
|
cache := utils.GetCacheFromContext(c)
|
|
c.JSON(http.StatusOK, GetRequestData(cache))
|
|
}
|
|
|
|
func BillingAnalysisAPI(c *gin.Context) {
|
|
cache := utils.GetCacheFromContext(c)
|
|
c.JSON(http.StatusOK, GetBillingData(cache))
|
|
}
|
|
|
|
func ErrorAnalysisAPI(c *gin.Context) {
|
|
cache := utils.GetCacheFromContext(c)
|
|
c.JSON(http.StatusOK, GetErrorData(cache))
|
|
}
|