feat: 公众号服务新增 GetJSSDKConfig 方法及 JSSDK 配置 DTO

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-16 18:37:59 +08:00
parent 0cba6fd6d5
commit ed1facc1b8
3 changed files with 57 additions and 0 deletions

View File

@@ -10,11 +10,23 @@ type Service interface {
GetUserInfo(ctx context.Context, code string) (openID, unionID string, err error)
}
// JSSDKConfig JSSDK 签名配置
// 用于前端调用 wx.config() 初始化微信 JS-SDK
type JSSDKConfig struct {
AppID string // 公众号 AppID
Timestamp int64 // 时间戳(秒)
NonceStr string // 随机字符串
Signature string // 签名SHA1
}
// OfficialAccountServiceInterface 微信公众号服务接口
type OfficialAccountServiceInterface interface {
Service
GetUserInfoDetailed(ctx context.Context, code string) (*UserInfo, error)
GetUserInfoByToken(ctx context.Context, accessToken, openID string) (*UserInfo, error)
// GetJSSDKConfig 获取 JSSDK 签名配置,用于前端调用 wx.config() 初始化
// url 为当前页面完整 URL含协议和路径不含 # 及其后内容)
GetJSSDKConfig(ctx context.Context, url string) (*JSSDKConfig, error)
}
// PaymentServiceInterface 微信支付服务接口