29 lines
783 B
Go
29 lines
783 B
Go
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.AlipayCallback(ctx, &vasproto.AlipayCallbackParamIn{
|
|
OrderId: bm.GetString("out_trade_no"),
|
|
AlipayOrderId: bm.GetString("trade_no"),
|
|
})
|
|
}
|
|
ctx.String(200, "success")
|
|
}
|