feat(api): 接入微信登录并原生实现咨询域(ECR-049/050)
小程序可在 Go 上完成微信手机号登录、测评、预约和下单,不再反代 Java。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -19,6 +19,29 @@ type Config struct {
|
||||
AppEnv string
|
||||
DeepSeek DeepSeekConfig
|
||||
Admin AdminConfig
|
||||
WeChat WeChatConfig
|
||||
Java JavaConfig
|
||||
Pay PayConfig
|
||||
}
|
||||
|
||||
// PayConfig is WeChat JSAPI merchant settings.
|
||||
type PayConfig struct {
|
||||
AppID string
|
||||
MchID string
|
||||
APIKey string
|
||||
NotifyURL string
|
||||
}
|
||||
|
||||
// WeChatConfig is mini-program jscode2session credentials.
|
||||
type WeChatConfig struct {
|
||||
AppID string
|
||||
Secret string
|
||||
}
|
||||
|
||||
// JavaConfig is the consult stack bridge (internal issue + proxy).
|
||||
type JavaConfig struct {
|
||||
BaseURL string
|
||||
InternalKey string
|
||||
}
|
||||
|
||||
// AdminConfig for ops console bootstrap (ECR-006).
|
||||
@@ -58,6 +81,20 @@ type fileConfig struct {
|
||||
BootstrapUsername string `yaml:"bootstrap_username"`
|
||||
BootstrapPassword string `yaml:"bootstrap_password"`
|
||||
} `yaml:"admin"`
|
||||
WeChat struct {
|
||||
AppID string `yaml:"app_id"`
|
||||
Secret string `yaml:"secret"`
|
||||
} `yaml:"wechat"`
|
||||
Java struct {
|
||||
BaseURL string `yaml:"base_url"`
|
||||
InternalKey string `yaml:"internal_key"`
|
||||
} `yaml:"java"`
|
||||
Pay struct {
|
||||
AppID string `yaml:"app_id"`
|
||||
MchID string `yaml:"mch_id"`
|
||||
APIKey string `yaml:"api_key"`
|
||||
NotifyURL string `yaml:"notify_url"`
|
||||
} `yaml:"pay"`
|
||||
}
|
||||
|
||||
// Load reads config.local.yaml (or CONFIG_PATH), then applies env overrides.
|
||||
@@ -140,6 +177,30 @@ func mergeFile(cfg *Config, path string) error {
|
||||
if f.Admin.BootstrapPassword != "" {
|
||||
cfg.Admin.BootstrapPassword = f.Admin.BootstrapPassword
|
||||
}
|
||||
if f.WeChat.AppID != "" {
|
||||
cfg.WeChat.AppID = f.WeChat.AppID
|
||||
}
|
||||
if f.WeChat.Secret != "" {
|
||||
cfg.WeChat.Secret = f.WeChat.Secret
|
||||
}
|
||||
if f.Java.BaseURL != "" {
|
||||
cfg.Java.BaseURL = strings.TrimRight(f.Java.BaseURL, "/")
|
||||
}
|
||||
if f.Java.InternalKey != "" {
|
||||
cfg.Java.InternalKey = f.Java.InternalKey
|
||||
}
|
||||
if f.Pay.AppID != "" {
|
||||
cfg.Pay.AppID = f.Pay.AppID
|
||||
}
|
||||
if f.Pay.MchID != "" {
|
||||
cfg.Pay.MchID = f.Pay.MchID
|
||||
}
|
||||
if f.Pay.APIKey != "" {
|
||||
cfg.Pay.APIKey = f.Pay.APIKey
|
||||
}
|
||||
if f.Pay.NotifyURL != "" {
|
||||
cfg.Pay.NotifyURL = f.Pay.NotifyURL
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -207,6 +268,30 @@ func applyEnv(cfg *Config) {
|
||||
if v := os.Getenv("ADMIN_BOOTSTRAP_PASSWORD"); v != "" {
|
||||
cfg.Admin.BootstrapPassword = v
|
||||
}
|
||||
if v := os.Getenv("WECHAT_MINI_APP_ID"); v != "" {
|
||||
cfg.WeChat.AppID = v
|
||||
}
|
||||
if v := os.Getenv("WECHAT_MINI_APP_SECRET"); v != "" {
|
||||
cfg.WeChat.Secret = v
|
||||
}
|
||||
if v := os.Getenv("JAVA_CONSULT_BASE_URL"); v != "" {
|
||||
cfg.Java.BaseURL = strings.TrimRight(v, "/")
|
||||
}
|
||||
if v := os.Getenv("JAVA_INTERNAL_KEY"); v != "" {
|
||||
cfg.Java.InternalKey = v
|
||||
}
|
||||
if v := os.Getenv("PAY_APP_ID"); v != "" {
|
||||
cfg.Pay.AppID = v
|
||||
}
|
||||
if v := os.Getenv("PAY_MCH_ID"); v != "" {
|
||||
cfg.Pay.MchID = v
|
||||
}
|
||||
if v := os.Getenv("PAY_API_KEY"); v != "" {
|
||||
cfg.Pay.APIKey = v
|
||||
}
|
||||
if v := os.Getenv("PAY_NOTIFY_URL"); v != "" {
|
||||
cfg.Pay.NotifyURL = v
|
||||
}
|
||||
}
|
||||
|
||||
// Enabled reports whether DeepSeek can be called.
|
||||
|
||||
Reference in New Issue
Block a user