feat: finish payment page layout

This commit is contained in:
RockYang
2023-11-07 18:10:28 +08:00
parent 1807d5b5d4
commit 696306f066
8 changed files with 178 additions and 31 deletions

View File

@@ -33,9 +33,10 @@ func NewDefaultConfig() *types.AppConfig {
BasePath: "./static/upload",
},
},
MjConfig: types.MidJourneyConfig{Enabled: false},
SdConfig: types.StableDiffusionConfig{Enabled: false, Txt2ImgJsonPath: "res/text2img.json"},
WeChatBot: false,
MjConfig: types.MidJourneyConfig{Enabled: false},
SdConfig: types.StableDiffusionConfig{Enabled: false, Txt2ImgJsonPath: "res/text2img.json"},
WeChatBot: false,
AlipayConfig: types.AlipayConfig{SandBox: true},
}
}

View File

@@ -61,7 +61,8 @@ type AliYunSmsConfig struct {
}
type AlipayConfig struct {
Enabled bool // 是否启用支付宝服务
Enabled bool // 是否启用服务
SandBox bool // 是否沙箱环境
Company string // 公司名称
UserId string // 支付宝用户 ID
AppId string // 支付宝 AppID

BIN
api/res/img/alipay.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -20,27 +20,27 @@ var logger = logger2.GetLogger()
func NewAlipayService(appConfig *types.AppConfig) (*AlipayService, error) {
config := appConfig.AlipayConfig
if !config.Enabled {
logger.Info("Disabled alipay service")
logger.Info("Disabled Alipay service")
return nil, nil
}
priKey, err := readKey(config.PrivateKey)
if err != nil {
return nil, err
return nil, fmt.Errorf("error with read App Private key: %v", err)
}
xClient, err := alipay.New(config.AppId, priKey, true)
xClient, err := alipay.New(config.AppId, priKey, !config.SandBox)
if err != nil {
return nil, fmt.Errorf("error with initialize alipay service: %v", err)
}
if err = xClient.LoadAppCertPublicKeyFromFile(config.PublicKey); err != nil {
return nil, fmt.Errorf("error with loading alipay CertPublicKey: %v", err)
return nil, fmt.Errorf("error with loading App PublicKey: %v", err)
}
if err = xClient.LoadAliPayRootCertFromFile(config.RootCert); err != nil {
return nil, fmt.Errorf("error with loading alipay RootCert: %v", err)
}
if err = xClient.LoadAlipayCertPublicKeyFromFile(config.AlipayPublicKey); err != nil {
return nil, fmt.Errorf("error with loading alipay AlipayCertPublicKey: %v", err)
return nil, fmt.Errorf("error with loading Alipay PublicKey: %v", err)
}
return &AlipayService{config: &config, client: xClient}, nil

View File

@@ -81,7 +81,7 @@ func (s *Service) Run() {
// PushTask 推送任务到队列
func (s *Service) PushTask(task types.SdTask) {
logger.Infof("add a new MidJourney Task: %+v", task)
logger.Infof("add a new Stable Diffusion Task: %+v", task)
s.taskQueue.RPush(task)
}