From 0ac0214c411ffd5761939452fc150e079da11ceb Mon Sep 17 00:00:00 2001 From: ckt1031 <65409152+ckt1031@users.noreply.github.com> Date: Wed, 12 Jul 2023 15:15:07 +0800 Subject: [PATCH] fix: billing date json issue --- controller/billing.go | 3 +-- controller/channel-billing.go | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/controller/billing.go b/controller/billing.go index 933938d1..5f9de534 100644 --- a/controller/billing.go +++ b/controller/billing.go @@ -3,7 +3,6 @@ package controller import ( "one-api/common" "one-api/model" - "time" "github.com/gin-gonic/gin" ) @@ -47,7 +46,7 @@ func GetSubscription(c *gin.Context) { SoftLimitUSD: amount, HardLimitUSD: amount, SystemHardLimitUSD: amount, - AccessUntil: time.Unix(expirationDate, 0), + AccessUntil: expirationDate, } c.JSON(200, subscription) return diff --git a/controller/channel-billing.go b/controller/channel-billing.go index 474c69b3..894af426 100644 --- a/controller/channel-billing.go +++ b/controller/channel-billing.go @@ -17,12 +17,12 @@ import ( // https://github.com/songquanpeng/one-api/issues/79 type OpenAISubscriptionResponse struct { - Object string `json:"object"` - HasPaymentMethod bool `json:"has_payment_method"` - SoftLimitUSD float64 `json:"soft_limit_usd"` - HardLimitUSD float64 `json:"hard_limit_usd"` - SystemHardLimitUSD float64 `json:"system_hard_limit_usd"` - AccessUntil time.Time `json:"access_until"` + Object string `json:"object"` + HasPaymentMethod bool `json:"has_payment_method"` + SoftLimitUSD float64 `json:"soft_limit_usd"` + HardLimitUSD float64 `json:"hard_limit_usd"` + SystemHardLimitUSD float64 `json:"system_hard_limit_usd"` + AccessUntil int64 `json:"access_until"` } type OpenAIUsageDailyCost struct {