|
- package svc
-
- import (
- "applet/app/db"
- "applet/app/e"
- "applet/app/pay/md"
- "applet/app/utils/logx"
- "github.com/gin-gonic/gin"
- )
-
- // 微信支付回调处理
- func wxPayCallback(c *gin.Context) (string, error) {
- data, ok := c.Get("callback")
- if data == nil || !ok {
- return "", e.NewErrCode(e.ERR_INVALID_ARGS)
- }
- args := data.(*md.WxPayCallback)
- _, ok = db.DBs[args.MasterID]
- if !ok {
- return "", logx.Warn("wxpay Failed : master_id not found")
- }
- c.Set("mid", args.MasterID)
- //回调交易状态失败
- if args.ResultCode != "SUCCESS" || args.ReturnCode != "SUCCESS" {
- return "", logx.Warn("wxpay Failed : trade status failed")
- }
- return args.OutTradeNo, nil
- }
|