feat: publish sanitized custom.97 source

This commit is contained in:
cneicy committed 2026-10-27 20:43:39 +08:00
1 parent 8e6ed0317b
commit 86c0276156
1022 files changed
+69903 -19207

No files matched your search

+10 -11
View File
@@ -2,7 +2,6 @@ package controller
import (
"bytes"
"fmt"
"io"
"net/http"
"time"
@@ -30,14 +29,14 @@ func SubscriptionRequestCreemPay(c *gin.Context) {
// Keep body for debugging consistency (like RequestCreemPay)
bodyBytes, err := io.ReadAll(c.Request.Body)
if err != nil {
logger.LogError(c.Request.Context(), fmt.Sprintf("Creem 订阅支付请求读取失败 error=%q", err.Error()))
logger.LogError(c.Request.Context(), common.LogText("Creem failed to read subscription payment request error=%q", err.Error()))
c.JSON(http.StatusOK, gin.H{"message": "error", "data": "read query error"})
return
}
c.Request.Body = io.NopCloser(bytes.NewReader(bodyBytes))
if err := c.ShouldBindJSON(&req); err != nil || req.PlanId <= 0 {
c.JSON(http.StatusOK, gin.H{"message": "error", "data": "参数错误"})
paymentError(c, common.NewMessage("Invalid parameters"))
return
}
@@ -47,15 +46,15 @@ func SubscriptionRequestCreemPay(c *gin.Context) {
return
}
if !plan.Enabled {
common.ApiErrorMsg(c, "套餐未启用")
common.ApiErrorT(c, "Subscription plan is not enabled")
return
}
if plan.CreemProductId == "" {
common.ApiErrorMsg(c, "该套餐未配置 CreemProductId")
common.ApiErrorT(c, "CreemProductId is not configured for this plan")
return
}
if setting.CreemWebhookSecret == "" && !setting.CreemTestMode {
common.ApiErrorMsg(c, "Creem Webhook 未配置")
common.ApiErrorT(c, "Creem webhook is not configured")
return
}
@@ -66,7 +65,7 @@ func SubscriptionRequestCreemPay(c *gin.Context) {
return
}
if user == nil {
common.ApiErrorMsg(c, "用户不存在")
common.ApiErrorT(c, "User does not exist")
return
}
@@ -77,7 +76,7 @@ func SubscriptionRequestCreemPay(c *gin.Context) {
return
}
if count >= int64(plan.MaxPurchasePerUser) {
common.ApiErrorMsg(c, "已达到该套餐购买上限")
common.ApiErrorT(c, "Purchase limit for this plan has been reached")
return
}
}
@@ -97,7 +96,7 @@ func SubscriptionRequestCreemPay(c *gin.Context) {
Status: common.TopUpStatusPending,
}
if err := order.Insert(); err != nil {
c.JSON(http.StatusOK, gin.H{"message": "error", "data": "创建订单失败"})
paymentError(c, common.NewMessage("Failed to create order"))
return
}
@@ -121,8 +120,8 @@ func SubscriptionRequestCreemPay(c *gin.Context) {
checkoutUrl, err := genCreemLink(c.Request.Context(), referenceId, product, user.Email, user.Username)
if err != nil {
logger.LogError(c.Request.Context(), fmt.Sprintf("Creem 订阅支付链接创建失败 trade_no=%s product_id=%s error=%q", referenceId, product.ProductId, err.Error()))
c.JSON(http.StatusOK, gin.H{"message": "error", "data": "拉起支付失败"})
logger.LogError(c.Request.Context(), common.LogText("Creem failed to create subscription payment link trade_no=%s product_id=%s error=%q", referenceId, product.ProductId, err.Error()))
paymentError(c, common.NewMessage("Failed to start payment"))
return
}