pay
This commit is contained in:
parent
7c4fb5e207
commit
66d4338b40
|
@ -10,6 +10,13 @@ type CorpConfig struct {
|
|||
ApproveSecret string `json:"approve_secret"`
|
||||
PaySecret string `json:"pay_secret"`
|
||||
PayAgent string `json:"pay_agent"`
|
||||
PayMchid string `json:"pay_mchid"`
|
||||
PaySerialNumber string `json:"pay_serial_number"`
|
||||
PayApiKeyV3 string `json:"pay_api_key_v3"`
|
||||
PayApiKeyV2 string `json:"pay_api_key_v2"`
|
||||
PayCertPem string `json:"pay_cert_pem"`
|
||||
PayKeyPem string `json:"pay_key_pem"`
|
||||
|
||||
TplIdCheckin string `json:"tplid_checkin"`
|
||||
TplIdRefund string `json:"tplid_refund"`
|
||||
TplIdVacation string `json:"tplid_vacation"`
|
||||
|
|
|
@ -71,7 +71,11 @@ func (q *QyWeixin) HandleRefund(ctx *gin.Context) {
|
|||
}
|
||||
|
||||
func (q *QyWeixin) Pay(ctx *gin.Context) {
|
||||
cid := cast.ToInt64(ctx.Param("cid"))
|
||||
sess := ctx.Keys[session.ContextSession].(*session.AdminSession)
|
||||
corp, err := dao.NewCorpDao().GetByHost(sess.GetHeader().Host)
|
||||
session.CheckDBError(err)
|
||||
session.CheckNilError(corp, "域名未绑定")
|
||||
|
||||
userid := ctx.Query("userid")
|
||||
amount := cast.ToInt64(ctx.Query("amount"))
|
||||
title := ctx.Query("title")
|
||||
|
@ -80,13 +84,6 @@ func (q *QyWeixin) Pay(ctx *gin.Context) {
|
|||
panic("password error")
|
||||
}
|
||||
|
||||
corp, err := dao.NewCorpDao().Get(cid)
|
||||
if err != nil {
|
||||
panic(config.ErrDb.New().Append(err))
|
||||
}
|
||||
if corp == nil {
|
||||
panic(config.ErrInternal.New())
|
||||
}
|
||||
cfg := corp.GetConfig()
|
||||
|
||||
// 获取openid
|
||||
|
@ -110,11 +107,11 @@ func (q *QyWeixin) Pay(ctx *gin.Context) {
|
|||
Corpid: cfg.CorpId,
|
||||
Secret: cfg.PaySecret,
|
||||
Agent: cfg.PayAgent,
|
||||
SerialNumber: config.GetConfig().WxPay.PaySerialNumber,
|
||||
ApiKey: config.GetConfig().WxPay.PayApiKeyV2,
|
||||
MchId: config.GetConfig().WxPay.PayMchId,
|
||||
CertPem: config.GetConfig().WxPay.PayCertPem,
|
||||
KeyPem: config.GetConfig().WxPay.PayKeyPem,
|
||||
SerialNumber: cfg.PaySerialNumber,
|
||||
ApiKey: cfg.PayApiKeyV2,
|
||||
MchId: cfg.PayMchid,
|
||||
CertPem: cfg.PayCertPem,
|
||||
KeyPem: cfg.PayKeyPem,
|
||||
})
|
||||
|
||||
if err = qyPay.PayMoney(&req); err != nil {
|
||||
|
|
Loading…
Reference in New Issue