diff --git a/common/model/corp.go b/common/model/corp.go index f9fa22a..b4f3887 100644 --- a/common/model/corp.go +++ b/common/model/corp.go @@ -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 } diff --git a/server/service/staff_user.go b/server/service/staff_user.go index de2a189..ff073a7 100644 --- a/server/service/staff_user.go +++ b/server/service/staff_user.go @@ -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)) } }