已完成用户APP首期功能开发

交付用户端首期页面、配套接口、后台资源及测试文档。用户APP构建、静态分析和三个管理后台构建通过;完整测试仍有2项失败,后端模型注释检查未通过,详见交付记录。
This commit is contained in:
czl231
2026-09-13 00:57:32 +08:00
parent a0a4bb1218
commit 3ef33b531d
793 changed files with 40959 additions and 1204 deletions

View File

@@ -0,0 +1,51 @@
// 功能描述:充值限额、渠道配置就绪状态及已发布充值协议;版本:1.0.0。
package common
import (
"os"
"git.apinb.com/bsm-sdk/core/infra"
"git.apinb.com/heqiapp/platforms/backend/api/internal/config"
"git.apinb.com/heqiapp/platforms/backend/api/internal/impl"
"git.apinb.com/heqiapp/platforms/backend/api/internal/models"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
// rechargeFileReady 仅检查渠道配置文件是否存在,不读取或返回私钥内容。
func rechargeFileReady(path string) bool {
if path == "" {
return false
}
info, err := os.Stat(path)
return err == nil && !info.IsDir()
}
// GetRechargeOptions 不提供Mock支付,不将配置存在等同于渠道支付一定成功。
func GetRechargeOptions(client string) gin.HandlerFunc {
return func(ctx *gin.Context) {
if _, ok := currentOwner(ctx, client); !ok {
return
}
ali, wx := config.Spec.Payment.Alipay, config.Spec.Payment.Wechat
alipayReady := ali.Enabled && ali.AppID != "" && ali.NotifyURL != "" &&
rechargeFileReady(ali.PrivateKeyPath) && rechargeFileReady(ali.AppPublicCertPath) &&
rechargeFileReady(ali.AlipayPublicCertPath) && rechargeFileReady(ali.AlipayRootCertPath)
wechatReady := wx.Enabled && wx.MerchantID != "" && wx.MerchantCertificateSerial != "" &&
len(wx.APIv3Key) == 32 && wx.AppAppID != "" && wx.NotifyURL != "" && rechargeFileReady(wx.MerchantPrivateKeyPath)
response := gin.H{"min_amount": 1, "max_amount": config.Spec.Global.ManualRechargeMaxAmount,
"channels": []gin.H{{"channel": "wechat", "app": wechatReady, "wap": false},
{"channel": "alipay", "app": alipayReady, "wap": alipayReady}}}
var agreement models.CmsContent
err := impl.DBService.Where("content_type = ? AND title = ? AND publish_status = ? AND status = ?",
"agreement", "充值协议", "published", StatusEnable).Order("version_no desc, id desc").First(&agreement).Error
if err != nil && err != gorm.ErrRecordNotFound {
infra.Response.Error(ctx, err)
return
}
if err == nil && agreement.Body != "" {
response["agreement"] = gin.H{"identity": agreement.Identity, "version": agreement.VersionNo, "title": agreement.Title, "body": agreement.Body}
}
infra.Response.Success(ctx, response)
}
}