42 lines
794 B
Go
42 lines
794 B
Go
package service
|
|
|
|
import (
|
|
"time"
|
|
"yuleduiPay/repo"
|
|
"yuleduiPay/service/vo"
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
)
|
|
|
|
type YsePay struct {
|
|
payOrderRepo repo.PayOrder
|
|
shopRepo repo.Shop
|
|
}
|
|
|
|
// 银盛 异步通知余乐兑
|
|
func (t *YsePay) NotifyWxPay(r *ghttp.Request) {
|
|
//r.Request
|
|
req := vo.NotifyPayReq{}
|
|
err := r.Parse(&req)
|
|
if err != nil {
|
|
r.SetError(err)
|
|
return
|
|
}
|
|
/*
|
|
payOrder,err := t.payOrderRepo.GetPayOrderByOrderId(req.OutTradeNo) //获取订单
|
|
if err != nil {
|
|
r.SetError(err)
|
|
return
|
|
}
|
|
*/
|
|
updates := g.Map{"ysePayStatus": req.TradeStatus, "updated": time.Now()}
|
|
err = t.payOrderRepo.UpdatePayOrderByOrderId(updates, req.OutTradeNo)
|
|
if err != nil {
|
|
r.SetError(err)
|
|
return
|
|
}
|
|
//将支付结果写入MQTT中
|
|
return
|
|
}
|