138 lines
3.7 KiB
Go
138 lines
3.7 KiB
Go
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
|
||
EasyPay EasyPayConfig
|
||
Tianyuanapi TianyuanapiConfig
|
||
SystemConfig SystemConfig
|
||
WechatH5 WechatH5Config
|
||
Authorization AuthorizationConfig // 授权书配置
|
||
WechatMini WechatMiniConfig
|
||
Query QueryConfig
|
||
AdminConfig AdminConfig
|
||
TaxConfig TaxConfig
|
||
Promotion PromotionConfig // 推广链接配置
|
||
}
|
||
|
||
// 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
|
||
ComplaintTemplate string // 投诉通知短信模板
|
||
}
|
||
type Encrypt struct {
|
||
SecretKey string
|
||
}
|
||
|
||
type AlipayConfig struct {
|
||
Enabled bool // 是否启用支付宝支付
|
||
AppID string
|
||
PrivateKey string
|
||
AlipayPublicKey string
|
||
AppCertPath string // 应用公钥证书路径
|
||
AlipayCertPath string // 支付宝公钥证书路径
|
||
AlipayRootCertPath string // 根证书路径
|
||
IsProduction bool
|
||
NotifyUrl string
|
||
ReturnURL string
|
||
}
|
||
type WxpayConfig struct {
|
||
Enabled bool // 是否启用微信支付
|
||
AppID string
|
||
MchID string
|
||
MchCertificateSerialNumber string
|
||
MchApiv3Key string
|
||
MchPrivateKeyPath string
|
||
MchPublicKeyID string
|
||
MchPublicKeyPath string
|
||
MchPlatformRAS string
|
||
NotifyUrl string
|
||
RefundNotifyUrl string
|
||
}
|
||
type ApplepayConfig struct {
|
||
Enabled bool // 是否启用Apple支付
|
||
ProductionVerifyURL string
|
||
SandboxVerifyURL string // 沙盒环境的验证 URL
|
||
Sandbox bool
|
||
BundleID string
|
||
IssuerID string
|
||
KeyID string
|
||
LoadPrivateKeyPath string
|
||
}
|
||
type SystemConfig struct {
|
||
ThreeVerify bool
|
||
}
|
||
type WechatH5Config struct {
|
||
Enabled bool // 是否启用微信公众号登录
|
||
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 TaxConfig struct {
|
||
TaxRate float64
|
||
TaxExemptionAmount float64
|
||
}
|
||
type TianyuanapiConfig struct {
|
||
AccessID string
|
||
Key string
|
||
BaseURL string
|
||
Timeout int64
|
||
}
|
||
|
||
type AuthorizationConfig struct {
|
||
FileBaseURL string // 授权书文件访问基础URL
|
||
}
|
||
|
||
// PromotionConfig 推广链接配置
|
||
type PromotionConfig struct {
|
||
PromotionDomain string // 推广域名(用于生成短链)
|
||
OfficialDomain string // 正式站点域名(短链重定向的目标域名)
|
||
}
|
||
|
||
// EasyPayConfig 易支付配置
|
||
type EasyPayConfig struct {
|
||
Enabled bool // 是否启用易支付
|
||
ApiURL string // 接口地址
|
||
PID string // 商户ID
|
||
PKEY string // 商户密钥
|
||
CIDs []string // 支付渠道ID数组(可配置一个或多个)
|
||
RotateMode string // 轮询模式:day(天数轮询)或 count(次数轮询),默认day
|
||
RotateDays int // 渠道轮询天数(默认3天,仅在RotateMode=day时生效)
|
||
NotifyUrl string // 异步通知地址
|
||
ReturnUrl string // 页面跳转地址
|
||
}
|