animeic 1 жил өмнө
parent
commit
d788bc3156

BIN
pay/__debug_bin


+ 5 - 3
pay/api/singleAliPayCallback.go

@@ -4,11 +4,12 @@ import (
 	"fmt"
 	"net/http"
 	"pay/bus"
-	"pay/db/model"
 	"strings"
 
 	"github.com/go-pay/gopay/alipay"
+	"go.mongodb.org/mongo-driver/bson/primitive"
 	"infish.cn/comm"
+	"infish.cn/comm/pay"
 )
 
 type SingleAliPayCallback struct {
@@ -50,8 +51,9 @@ func (a *SingleAliPayCallback) CallBack(c *http.Request) (interface{}, error) {
 	// 	return "faild", nil
 	// }
 	orderSlice := strings.Split(notifyReq["out_trade_no"].(string), "_")
-	payMode := 0
-	res := &model.OrderMsg{Id: orderSlice[1], PayMode: &payMode, ModName: orderSlice[0]}
+	orderId, _ := primitive.ObjectIDFromHex(orderSlice[1])
+	var payMode int32 = 0
+	res := &pay.OrderMsg{Id: orderId, PayMod: &payMode, Project: orderSlice[0]}
 	if notifyReq["trade_status"] == "TRADE_SUCCESS" {
 
 		fmt.Println("----------------success-----------------------")

+ 6 - 5
pay/api/singleWechatPayCallback.go

@@ -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----------------------")

+ 2 - 0
pay/assettest.log

@@ -37,3 +37,5 @@
 {"level":"info","timestamp":"2023-07-06 17:18:02","message":"[初始化支付客户端]","service_name":"assettest"}
 {"level":"error","timestamp":"2023-07-06 17:21:19","message":"{\"code\":\"ACQ.MERCHANT_STATUS_NOT_NORMAL\",\"msg\":\"Business Failed\",\"sub_code\":\"ACQ.MERCHANT_STATUS_NOT_NORMAL\",\"sub_msg\":\"商户协议状态非正常状态\"}","service_name":"assettest"}
 {"level":"info","timestamp":"2023-07-06 17:30:09","message":"[初始化支付客户端]","service_name":"assettest"}
+{"level":"error","timestamp":"2023-07-06 17:35:37","message":"{\"code\":\"ACQ.MERCHANT_STATUS_NOT_NORMAL\",\"msg\":\"Business Failed\",\"sub_code\":\"ACQ.MERCHANT_STATUS_NOT_NORMAL\",\"sub_msg\":\"商户协议状态非正常状态\"}","service_name":"assettest"}
+{"level":"info","timestamp":"2023-07-06 17:48:22","message":"[初始化支付客户端]","service_name":"assettest"}