paylimit
This commit is contained in:
parent
49abc2e6c9
commit
9b27891ab2
|
@ -18,6 +18,7 @@ type CorpConfig struct {
|
||||||
PayCertPem string `json:"pay_cert_pem"`
|
PayCertPem string `json:"pay_cert_pem"`
|
||||||
PayKeyPem string `json:"pay_key_pem"`
|
PayKeyPem string `json:"pay_key_pem"`
|
||||||
PayChannel string `json:"pay_channel"`
|
PayChannel string `json:"pay_channel"`
|
||||||
|
PayLimit string `json:"pay_limit"`
|
||||||
|
|
||||||
TplIdCheckin string `json:"tplid_checkin"`
|
TplIdCheckin string `json:"tplid_checkin"`
|
||||||
TplIdRefund string `json:"tplid_refund"`
|
TplIdRefund string `json:"tplid_refund"`
|
||||||
|
@ -46,5 +47,8 @@ func (c *Corp) GetConfig() *CorpConfig {
|
||||||
if cfg.WorkerHour == "" {
|
if cfg.WorkerHour == "" {
|
||||||
cfg.WorkerHour = "8"
|
cfg.WorkerHour = "8"
|
||||||
}
|
}
|
||||||
|
if cfg.PayLimit == "" {
|
||||||
|
cfg.PayLimit = "1000"
|
||||||
|
}
|
||||||
return &cfg
|
return &cfg
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,12 @@ func (s *StaffUser) Pay(sess *session.AdminSession, req *api.StaffPayReq) {
|
||||||
if req.Title == "" {
|
if req.Title == "" {
|
||||||
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))
|
panic(config.ErrInternal.New().Append(err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue