面包店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

41 rivejä
1.0 KiB

  1. package hdl
  2. import (
  3. "applet/app/e"
  4. "applet/app/pay/svc"
  5. "applet/app/utils"
  6. "applet/app/utils/logx"
  7. "errors"
  8. "fmt"
  9. "github.com/gin-gonic/gin"
  10. )
  11. // PayCallback 整合所有支付回调
  12. func PayCallback(c *gin.Context) {
  13. fmt.Println("pay call back start >>>>>>>>>>")
  14. // 统一处理回调参数
  15. data, orderType, payMethod := svc.CheckAllCallbackParams(c)
  16. if data == nil {
  17. fmt.Println("pay call back data is nil >>>>>>>>>>")
  18. e.OutErr(c, e.ERR_INVALID_ARGS)
  19. return
  20. }
  21. fmt.Println("pay call back data >>>>>>>>>>", utils.SerializeStr(data))
  22. c.Set("callback", data)
  23. payCallbackFunc, ok := svc.PayCallbackFuncList[orderType][payMethod]
  24. if !ok || payCallbackFunc == nil {
  25. _ = logx.Warn(errors.New("回调不存在"))
  26. return
  27. }
  28. fmt.Println("pay call back start1 >>>>>>>>>>")
  29. payCallbackFunc(c)
  30. //e.OutSuc(c, "success", nil)
  31. //return
  32. fmt.Println("pay call back end >>>>>>>>>>")
  33. //TODO::此处需要直接输出 success,避免支付宝重复回调
  34. //c.Header("Content-Type", "text/html; charset=utf-8")
  35. c.String(200, "success")
  36. }