Files
tyc-server-v2/app/main/api/internal/config/config.go

148 lines
3.9 KiB
Go
Raw Normal View History

2026-01-22 16:04:12 +08:00
package config
import (
"github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/rest"
)
type Config struct {
rest.RestConf
DataSource string
CacheRedis cache.CacheConf
JwtAuth JwtAuth // JWT 鉴权相关配置
VerifyCode VerifyCode
Encrypt Encrypt
Alipay AlipayConfig
Wxpay WxpayConfig
Applepay ApplepayConfig
Ali AliConfig
Tianyuanapi TianyuanapiConfig
SystemConfig SystemConfig
WechatH5 WechatH5Config
Authorization AuthorizationConfig // 授权书配置
2026-02-12 15:16:54 +08:00
Upload UploadConfig // 图片上传(行驶证等)配置
2026-01-22 16:04:12 +08:00
WechatMini WechatMiniConfig
Query QueryConfig
AdminConfig AdminConfig
AdminPromotion AdminPromotion
TaxConfig TaxConfig
2026-02-12 17:04:10 +08:00
// PublicBaseURL 前台访问域名,用于构造对外可访问链接(上传图片、回调等),例如 https://www.tianyuancha.cn
PublicBaseURL string
ExtensionTime int64
2026-01-22 16:04:12 +08:00
}
// JwtAuth 用于 JWT 鉴权配置
type JwtAuth struct {
AccessSecret string // JWT 密钥,用于签发 Token
AccessExpire int64 // Token 过期时间,单位为秒
RefreshAfter int64
}
type VerifyCode struct {
AccessKeyID string
AccessKeySecret string
EndpointURL string
SignName string
TemplateCode string
ValidTime int
}
type Encrypt struct {
SecretKey string
}
type AlipayConfig struct {
AppID string
PrivateKey string
AlipayPublicKey string
AppCertPath string // 应用公钥证书路径
AlipayCertPath string // 支付宝公钥证书路径
AlipayRootCertPath string // 根证书路径
2026-02-06 14:05:53 +08:00
// Bak 仅用于 [2026-01-25 16:38:17, 2026-02-02 18:26) 区间内订单退款
2026-02-06 13:34:49 +08:00
AppIDBak string
PrivateKeyBak string
AlipayPublicKeyBak string
AppCertPathBak string
AlipayCertPathBak string
AlipayRootCertPathBak string
IsProduction bool
NotifyUrl string
ReturnURL string
2026-01-22 16:04:12 +08:00
}
type WxpayConfig struct {
AppID string
MchID string
MchCertificateSerialNumber string
MchApiv3Key string
MchPrivateKeyPath string
MchPublicKeyID string
MchPublicKeyPath string
NotifyUrl string
RefundNotifyUrl string
}
type AliConfig struct {
Code string
}
type ApplepayConfig struct {
ProductionVerifyURL string
SandboxVerifyURL string // 沙盒环境的验证 URL
Sandbox bool
BundleID string
IssuerID string
KeyID string
LoadPrivateKeyPath string
}
type WestConfig struct {
Url string
Key string
SecretId string
SecretSecondId string
}
type YushanConfig struct {
ApiKey string
AcctID string
Url string
}
type SystemConfig struct {
ThreeVerify bool // 是否开启三级实名认证
CommissionSafeMode bool // 佣金安全防御模式true-冻结模式(status=1,进入frozen_balance)false-直接结算(status=0,进入balance)
}
type WechatH5Config struct {
AppID string
AppSecret string
}
type WechatMiniConfig struct {
AppID string
AppSecret string
}
type QueryConfig struct {
ShareLinkExpire int64
}
type AdminConfig struct {
AccessSecret string
AccessExpire int64
RefreshAfter int64
}
type AdminPromotion struct {
URLDomain string
}
type TaxConfig struct {
TaxRate float64
TaxExemptionAmount float64
}
type TianyuanapiConfig struct {
AccessID string
Key string
BaseURL string
Timeout int64
}
type AuthorizationConfig struct {
FileBaseURL string // 授权书文件访问基础URL
}
2026-02-12 15:16:54 +08:00
// UploadConfig 图片上传(行驶证等)配置,临时存储,按 hash 去重
type UploadConfig struct {
FileBaseURL string `json:",optional"` // 上传文件访问基础 URL如 https://xxx/api/v1/upload/file
TempFileMaxAgeH int `json:",optional"` // 临时文件保留时长小时超时删除0 表示默认 24 小时
}