feat: 订单查询和通知,填写卡密

This commit is contained in:
wolter 2024-11-29 10:25:51 +08:00
parent 667651240a
commit c8b7989838
2 changed files with 19 additions and 2 deletions

View File

@ -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
}

View File

@ -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
}