|
@@ -5,12 +5,13 @@ import (
|
|
|
"net/http"
|
|
|
"pay/bus"
|
|
|
"pay/conf"
|
|
|
- "pay/db/model"
|
|
|
"pay/utils"
|
|
|
"strings"
|
|
|
|
|
|
"github.com/go-pay/gopay/wechat/v3"
|
|
|
+ "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
"infish.cn/comm"
|
|
|
+ "infish.cn/comm/pay"
|
|
|
)
|
|
|
|
|
|
type SingleWechatPayCallback struct {
|
|
@@ -42,11 +43,12 @@ func (a *SingleWechatPayCallback) CallBack(c *http.Request) (interface{}, error)
|
|
|
// 注意:重试过多会导致微信支付端积压过多通知而堵塞,影响其他正常通知。
|
|
|
|
|
|
orderSlice := strings.Split(result.OutTradeNo, "_")
|
|
|
- payMode := 1
|
|
|
- // orderSlice[0] 代表来源 mall cloud sku3d...
|
|
|
+ orderId, _ := primitive.ObjectIDFromHex(orderSlice[1])
|
|
|
+ var payMode int32 = 1
|
|
|
+ // orderSlice[0] 代表来源 QS
|
|
|
+ res := &pay.OrderMsg{Id: orderId, PayMod: &payMode, Project: orderSlice[0]}
|
|
|
if result.TradeState == "SUCCESS" {
|
|
|
fmt.Println("----------------success----------------------")
|
|
|
- res := &model.OrderMsg{Id: orderSlice[1], PayMode: &payMode, ModName: orderSlice[0]}
|
|
|
// err = bus.NatsCenter.PushMessage(comm.NewAppPaySuccSubject(orderSlice[0]), res)
|
|
|
err = bus.NatsCenter.PushMessage(comm.NewAppPaySuccSubject(orderSlice[0]), res)
|
|
|
if err != nil {
|
|
@@ -56,7 +58,6 @@ func (a *SingleWechatPayCallback) CallBack(c *http.Request) (interface{}, error)
|
|
|
|
|
|
} else {
|
|
|
fmt.Println("----------------fail----------------------")
|
|
|
- res := &model.OrderMsg{Id: orderSlice[1], PayMode: &payMode, ModName: orderSlice[0]}
|
|
|
err = bus.NatsCenter.PushMessage(comm.NewAppPayFailSubject(orderSlice[0]), res)
|
|
|
if err != nil {
|
|
|
fmt.Println("----------------fail-err----------------------")
|