智慧食堂
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
857 B

  1. package hdl
  2. import (
  3. "applet/app/customer/md"
  4. "applet/app/customer/svc"
  5. "applet/app/e"
  6. "fmt"
  7. "github.com/gin-gonic/gin"
  8. )
  9. func AlipayJsApiCallBack(c *gin.Context) {
  10. data := svc.CheckAllCallbackParams(c)
  11. if data == nil {
  12. e.OutErr(c, e.ERR_INVALID_ARGS)
  13. return
  14. }
  15. c.Set("callback", data)
  16. args, ok := data.(*md.AliPayCallback)
  17. if !ok {
  18. fmt.Println("反射ok失败")
  19. e.OutErr(c, e.ERR_INVALID_ARGS, "反射失败")
  20. return
  21. }
  22. if args.GmtRefund != "" {
  23. //TODO::退款通知不需要处理
  24. c.String(200, "success")
  25. return
  26. }
  27. _, err := svc.DealCentralKitchenForSchoolOrderCallBack(args.OutTradeNo, args.TradeStatus)
  28. if err != nil {
  29. e.OutErr(c, e.ERR, err.Error())
  30. return
  31. }
  32. //TODO::此处需要直接输出 success,避免支付宝重复回调
  33. //c.Header("Content-Type", "text/html; charset=utf-8")
  34. c.String(200, "success")
  35. }