diff --git a/cmd/api/internal/logic/yl/getOrderLogic.go b/cmd/api/internal/logic/yl/getOrderLogic.go index dc94b70..6d1b7e5 100644 --- a/cmd/api/internal/logic/yl/getOrderLogic.go +++ b/cmd/api/internal/logic/yl/getOrderLogic.go @@ -9,6 +9,7 @@ import ( "rs/cmd/api/internal/svc" "rs/cmd/api/internal/types" "rs/rpc/transfer" + "strings" "time" ) @@ -76,7 +77,7 @@ func (l *GetOrderLogic) GetOrder(req *types.GetOrderReq) (resp *types.GetOrderRs Msg: "", SupplierId: asyncReq.SupplierId, CardNo: "", - CardKey: "", + CardKey: l.getCode(data.Data.VoucherCode), CardExpireTime: endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second).Format(time.DateTime), CardExchangeUrl: data.Data.ShortUrl, } @@ -124,3 +125,11 @@ func (l *GetOrderLogic) GetOrder2(req *types.GetOrderReq) (resp *types.GetOrderR return } + +func (l *GetOrderLogic) getCode(voucherCode string) string { + if strings.Contains(voucherCode, "http") { + temp := strings.Split(strings.TrimSpace(voucherCode), "/") + return temp[len(temp)-1] + } + return voucherCode +} diff --git a/cmd/api/internal/logic/yl/ylAsyncLogic.go b/cmd/api/internal/logic/yl/ylAsyncLogic.go index 7bfc7a4..82fdf1c 100644 --- a/cmd/api/internal/logic/yl/ylAsyncLogic.go +++ b/cmd/api/internal/logic/yl/ylAsyncLogic.go @@ -146,7 +146,7 @@ func (l *YlAsyncLogic) asyncSendMarket(supplierOrderNo string, asyncReq *types.A Price: asyncReq.Price, SupplierId: asyncReq.SupplierId, CardNo: "", - CardKey: "", + CardKey: l.getCode(data.VoucherCode), CardExpireTime: endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second).Format(time.DateTime), CardExchangeUrl: data.ShortUrl, Sign: "", @@ -268,3 +268,11 @@ func (l *YlAsyncLogic) updateOrder(req *types.AsyncReq, rsp *transfer.MarketKeyS l.Logger.Errorf("order = %s 插入订单失败:%v", order, err.Error()) } } + +func (l *YlAsyncLogic) getCode(voucherCode string) string { + if strings.Contains(voucherCode, "http") { + temp := strings.Split(strings.TrimSpace(voucherCode), "/") + return temp[len(temp)-1] + } + return voucherCode +}