pay
This commit is contained in:
parent
ef70b56c8d
commit
8270d1e196
|
@ -5,4 +5,5 @@ type PayReq struct {
|
||||||
Password string `json:"password"` //密码
|
Password string `json:"password"` //密码
|
||||||
Amount int64 `json:"amount"` //单位分
|
Amount int64 `json:"amount"` //单位分
|
||||||
Title string `json:"title"` //转账标题
|
Title string `json:"title"` //转账标题
|
||||||
|
PayType string `json:"pay_type"` //支付类型 weixin/alipay
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,16 +30,21 @@ func (p *Pay) Pay(corp *model.Corp, req *api.PayReq) {
|
||||||
user, err := dao.NewStaffUserDao().GetByUsername(corp.Id, req.Username)
|
user, err := dao.NewStaffUserDao().GetByUsername(corp.Id, req.Username)
|
||||||
session.CheckDBError(err)
|
session.CheckDBError(err)
|
||||||
session.CheckNilError(user, fmt.Sprintf("用户[%s]不存在", req.Username))
|
session.CheckNilError(user, fmt.Sprintf("用户[%s]不存在", req.Username))
|
||||||
|
|
||||||
|
payType := ""
|
||||||
payee := user.GetPayee()
|
payee := user.GetPayee()
|
||||||
if payee.AlipayUid != "" {
|
if payee.AlipayUid != "" {
|
||||||
err = p.payAlipay(corp, user, req)
|
err = p.payAlipay(corp, user, req)
|
||||||
|
payType = "alipay"
|
||||||
} else {
|
} else {
|
||||||
err = p.payWeixin(corp, user, req)
|
err = p.payWeixin(corp, user, req)
|
||||||
|
payType = "weixin"
|
||||||
}
|
}
|
||||||
|
|
||||||
message := make([]string, 0)
|
message := make([]string, 0)
|
||||||
message = append(message, fmt.Sprintf("【企业转账】[%s]", req.Username))
|
message = append(message, fmt.Sprintf("【企业转账】[%s]", req.Username))
|
||||||
message = append(message, fmt.Sprintf("发放金额:%s", goutil.FormatMoney(req.Amount)))
|
message = append(message, fmt.Sprintf("发放金额:%s", goutil.FormatMoney(req.Amount)))
|
||||||
|
message = append(message, fmt.Sprintf("支付类型:%s", payType))
|
||||||
message = append(message, fmt.Sprintf("员工名称:%s", req.Username))
|
message = append(message, fmt.Sprintf("员工名称:%s", req.Username))
|
||||||
message = append(message, fmt.Sprintf("费用说明:%s", req.Title))
|
message = append(message, fmt.Sprintf("费用说明:%s", req.Title))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue