From c5d4c7b9893b7a849f944e217b428f25c3186979 Mon Sep 17 00:00:00 2001 From: wolter Date: Tue, 5 Nov 2024 16:05:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8B=E5=8D=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/api/doc/vo/base.api | 2 +- cmd/api/internal/logic/yl/ylAsyncLogic.go | 13 +++++++------ cmd/api/internal/types/extraTypes.go | 11 ++++++----- cmd/api/internal/types/types.go | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cmd/api/doc/vo/base.api b/cmd/api/doc/vo/base.api index f1398c3..176c2f7 100644 --- a/cmd/api/doc/vo/base.api +++ b/cmd/api/doc/vo/base.api @@ -36,7 +36,7 @@ type AsyncReq { skuId int64 `json:"skuId"` // 平台sku SupplierSkuId int64 `json:"supplierSkuId"` // 供货商sku SupplierId int64 `json:"supplierId"` // 供货商id - Account string `json:"thirdSkuId"` // 充值账号 + Account string `json:"account"` // 充值账号 ExtendParams string `json:"extendParams"` // 额外参数 Count int64 `json:"count"` //数量(此字段只目前支持是金豆,积分等虚拟资产,其他商品不支持) Sign string `json:"sign"` diff --git a/cmd/api/internal/logic/yl/ylAsyncLogic.go b/cmd/api/internal/logic/yl/ylAsyncLogic.go index 0532591..53c2e1d 100644 --- a/cmd/api/internal/logic/yl/ylAsyncLogic.go +++ b/cmd/api/internal/logic/yl/ylAsyncLogic.go @@ -7,7 +7,6 @@ import ( "rs/cmd/api/internal/logic/vo" "rs/rpc/transfer" "rs/untils/httpclient" - "strconv" "strings" "time" @@ -49,7 +48,7 @@ func (l *YlAsyncLogic) YlAsync(req *types.AsyncReq) (resp *types.AsyncResp, err ReqSerialNo: req.DeliverOrderNo, Timestamp: time.Unix(req.CreateTime, 0).Format("20060102150405"), PosId: extendParam.PosId, - VoucherId: strconv.Itoa(int(req.SupplierSkuId)), + VoucherId: extendParam.VoucherId, VoucherNum: extendParam.Num, MobileNo: extendParam.MobileNo, SendMsg: extendParam.SendMsg, @@ -71,19 +70,21 @@ func (l *YlAsyncLogic) YlAsync(req *types.AsyncReq) (resp *types.AsyncResp, err if result.Data == nil { return nil, fmt.Errorf("请求失败:%v", result.Msg) } + return &types.AsyncResp{ Msg: "", Status: status, - SupplierOrderNo: result.Data.VoucherCode, + SupplierOrderNo: l.getExchangeCode(result.Data.VoucherCode), }, nil } -func (l *YlAsyncLogic) getExchangeUrl(voucherCode string) string { - if strings.Contains(voucherCode, "http") { +func (l *YlAsyncLogic) getExchangeCode(voucherCode string) string { + if !strings.Contains(voucherCode, "http") { return voucherCode } - return fmt.Sprintf("%s%s", l.svcCtx.Config.Sys.Url, voucherCode) + temp := strings.Split(voucherCode, "/") + return temp[len(temp)-1] } // 往营销系统下单,返回数据,通知下游系统 diff --git a/cmd/api/internal/types/extraTypes.go b/cmd/api/internal/types/extraTypes.go index 44d921c..2cc7102 100644 --- a/cmd/api/internal/types/extraTypes.go +++ b/cmd/api/internal/types/extraTypes.go @@ -30,9 +30,10 @@ type NotifyTypes struct { } type KeySendExtendParam struct { - AppId string `json:"appId"` - PosId string `json:"posId"` - Num int64 `json:"num"` - MobileNo string `json:"mobileNo"` - SendMsg string `json:"sendMsg"` + AppId string `json:"appId"` + PosId string `json:"posId"` + Num int64 `json:"num"` + MobileNo string `json:"mobileNo"` + SendMsg string `json:"sendMsg"` + VoucherId string `json:"voucherId"` } diff --git a/cmd/api/internal/types/types.go b/cmd/api/internal/types/types.go index e29d4f5..b686059 100644 --- a/cmd/api/internal/types/types.go +++ b/cmd/api/internal/types/types.go @@ -11,7 +11,7 @@ type AsyncReq struct { SkuId int64 `json:"skuId"` // 平台sku SupplierSkuId int64 `json:"supplierSkuId"` // 供货商sku SupplierId int64 `json:"supplierId"` // 供货商id - Account string `json:"thirdSkuId"` // 充值账号 + Account string `json:"account"` // 充值账号 ExtendParams string `json:"extendParams"` // 额外参数 Count int64 `json:"count"` //数量(此字段只目前支持是金豆,积分等虚拟资产,其他商品不支持) Sign string `json:"sign"`