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)) }