This commit is contained in:
jiangyong27 2025-04-09 14:30:46 +08:00
parent 49abc2e6c9
commit 9b27891ab2
2 changed files with 10 additions and 1 deletions

View File

@ -18,6 +18,7 @@ type CorpConfig struct {
PayCertPem string `json:"pay_cert_pem"`
PayKeyPem string `json:"pay_key_pem"`
PayChannel string `json:"pay_channel"`
PayLimit string `json:"pay_limit"`
TplIdCheckin string `json:"tplid_checkin"`
TplIdRefund string `json:"tplid_refund"`
@ -46,5 +47,8 @@ func (c *Corp) GetConfig() *CorpConfig {
if cfg.WorkerHour == "" {
cfg.WorkerHour = "8"
}
if cfg.PayLimit == "" {
cfg.PayLimit = "1000"
}
return &cfg
}

View File

@ -211,7 +211,12 @@ func (s *StaffUser) Pay(sess *session.AdminSession, req *api.StaffPayReq) {
if req.Title == "" {
req.Title = "测试"
}
if err = CommonService.NewPay().Pay(corp, user, req.Title, req.PayType, int64(cast.ToFloat64(req.Amount)*100), ""); err != nil {
amount := int64(cast.ToFloat64(req.Amount) * 100)
if amount >= int64(cast.ToFloat64(corp.GetConfig().PayLimit)*100) {
panic("超出转账金额限制")
}
if err = CommonService.NewPay().Pay(corp, user, req.Title, req.PayType, amount, ""); err != nil {
panic(config.ErrInternal.New().Append(err))
}
}