package controller import ( "github.com/gin-gonic/gin" vasproto "service/api/proto/vas/proto" "service/app/mix/service" "service/bizcommon/util" "service/library/logger" "service/library/payclients/alipaycli" ) func AlipayCallback(ctx *gin.Context) { //req, _ := ctx.GetRawData() //logger.Info("_AlipayCallback req: %v", string(req)) bm, err := alipaycli.GetDefaultAlipayClient().ParseNotify(ctx.Request) if err != nil { logger.Error("ParseNotify fail, req: %v, err: %v", util.ToJson(bm), err) return } if bm.GetString("trade_status") == "TRADE_SUCCESS" { _ = service.DefaultService.PayCallback(ctx, &vasproto.PayCallbackParamIn{ OrderId: bm.GetString("out_trade_no"), OutOrderId: bm.GetString("trade_no"), CallbackPayType: vasproto.CallBackPayTypeAlipay, }) } ctx.String(200, "success") }