mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-18 04:57:26 +00:00
🎨 style: format all code with gofmt and lint:fix
Apply consistent code formatting across the entire codebase using gofmt and lint:fix tools. This ensures adherence to Go community standards and improves code readability and maintainability. Changes include: - Run gofmt on all .go files to standardize formatting - Apply lint:fix to automatically resolve linting issues - Fix code style inconsistencies and formatting violations No functional changes were made in this commit.
This commit is contained in:
@@ -115,7 +115,7 @@ func GetStatus(c *gin.Context) {
|
||||
"user_agreement_enabled": legalSetting.UserAgreement != "",
|
||||
"privacy_policy_enabled": legalSetting.PrivacyPolicy != "",
|
||||
"checkin_enabled": operation_setting.GetCheckinSetting().Enabled,
|
||||
"_qn": "new-api",
|
||||
"_qn": "new-api",
|
||||
}
|
||||
|
||||
// 根据启用状态注入可选内容
|
||||
|
||||
@@ -91,11 +91,11 @@ func GetPerformanceStats(c *gin.Context) {
|
||||
// 获取配置信息
|
||||
diskConfig := common.GetDiskCacheConfig()
|
||||
config := PerformanceConfig{
|
||||
DiskCacheEnabled: diskConfig.Enabled,
|
||||
DiskCacheThresholdMB: diskConfig.ThresholdMB,
|
||||
DiskCacheMaxSizeMB: diskConfig.MaxSizeMB,
|
||||
DiskCachePath: diskConfig.Path,
|
||||
IsRunningInContainer: common.IsRunningInContainer(),
|
||||
DiskCacheEnabled: diskConfig.Enabled,
|
||||
DiskCacheThresholdMB: diskConfig.ThresholdMB,
|
||||
DiskCacheMaxSizeMB: diskConfig.MaxSizeMB,
|
||||
DiskCachePath: diskConfig.Path,
|
||||
IsRunningInContainer: common.IsRunningInContainer(),
|
||||
}
|
||||
|
||||
// 获取磁盘空间信息
|
||||
@@ -199,4 +199,3 @@ func getDiskCacheInfo() DiskCacheInfo {
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ import (
|
||||
// ---- Shared types ----
|
||||
|
||||
type SubscriptionPlanDTO struct {
|
||||
Plan model.SubscriptionPlan `json:"plan"`
|
||||
Items []model.SubscriptionPlanItem `json:"items"`
|
||||
Plan model.SubscriptionPlan `json:"plan"`
|
||||
Items []model.SubscriptionPlanItem `json:"items"`
|
||||
}
|
||||
|
||||
type BillingPreferenceRequest struct {
|
||||
|
||||
@@ -97,4 +97,3 @@ func SubscriptionRequestCreemPay(c *gin.Context) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/Calcium-Ion/go-epay/epay"
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/model"
|
||||
"github.com/QuantumNous/new-api/service"
|
||||
"github.com/QuantumNous/new-api/setting/operation_setting"
|
||||
"github.com/QuantumNous/new-api/setting/system_setting"
|
||||
"github.com/Calcium-Ion/go-epay/epay"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
@@ -151,4 +151,3 @@ func SubscriptionEpayReturn(c *gin.Context) {
|
||||
}
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/topup?pay=pending")
|
||||
}
|
||||
|
||||
|
||||
@@ -116,4 +116,3 @@ func genStripeSubscriptionLink(referenceId string, customerId string, email stri
|
||||
}
|
||||
return result.URL, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -169,10 +169,10 @@ func sessionCompleted(event stripe.Event) {
|
||||
// Subscription order takes precedence
|
||||
if model.GetSubscriptionOrderByTradeNo(referenceId) != nil {
|
||||
payload := map[string]any{
|
||||
"customer": customerId,
|
||||
"customer": customerId,
|
||||
"amount_total": event.GetObjectValue("amount_total"),
|
||||
"currency": strings.ToUpper(event.GetObjectValue("currency")),
|
||||
"event_type": string(event.Type),
|
||||
"currency": strings.ToUpper(event.GetObjectValue("currency")),
|
||||
"event_type": string(event.Type),
|
||||
}
|
||||
if err := model.CompleteSubscriptionOrder(referenceId, jsonString(payload)); err != nil {
|
||||
log.Println("complete subscription order failed:", err.Error(), referenceId)
|
||||
|
||||
Reference in New Issue
Block a user