面包店
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.

преди 9 месеца
12345678910111213141516171819202122232425262728
  1. package svc
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/pay/md"
  6. "applet/app/utils/logx"
  7. "github.com/gin-gonic/gin"
  8. )
  9. // 微信支付回调处理
  10. func wxPayCallback(c *gin.Context) (string, error) {
  11. data, ok := c.Get("callback")
  12. if data == nil || !ok {
  13. return "", e.NewErrCode(e.ERR_INVALID_ARGS)
  14. }
  15. args := data.(*md.WxPayCallback)
  16. _, ok = db.DBs[args.MasterID]
  17. if !ok {
  18. return "", logx.Warn("wxpay Failed : master_id not found")
  19. }
  20. c.Set("mid", args.MasterID)
  21. //回调交易状态失败
  22. if args.ResultCode != "SUCCESS" || args.ReturnCode != "SUCCESS" {
  23. return "", logx.Warn("wxpay Failed : trade status failed")
  24. }
  25. return args.OutTradeNo, nil
  26. }