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