package hdl import ( "applet/app/e" "applet/app/pay/svc" "applet/app/utils" "applet/app/utils/logx" "errors" "fmt" "github.com/gin-gonic/gin" ) // PayCallback 整合所有支付回调 func PayCallback(c *gin.Context) { fmt.Println("pay call back start >>>>>>>>>>") // 统一处理回调参数 data, orderType, payMethod := svc.CheckAllCallbackParams(c) if data == nil { fmt.Println("pay call back data is nil >>>>>>>>>>") e.OutErr(c, e.ERR_INVALID_ARGS) return } fmt.Println("pay call back data >>>>>>>>>>", utils.SerializeStr(data)) c.Set("callback", data) payCallbackFunc, ok := svc.PayCallbackFuncList[orderType][payMethod] if !ok || payCallbackFunc == nil { _ = logx.Warn(errors.New("回调不存在")) return } fmt.Println("pay call back start1 >>>>>>>>>>") payCallbackFunc(c) //e.OutSuc(c, "success", nil) //return fmt.Println("pay call back end >>>>>>>>>>") //TODO::此处需要直接输出 success,避免支付宝重复回调 //c.Header("Content-Type", "text/html; charset=utf-8") c.String(200, "success") }