fix: 下单接口

This commit is contained in:
wolter 2024-11-05 16:05:45 +08:00
parent 87314541c5
commit c5d4c7b989
4 changed files with 15 additions and 13 deletions

View File

@ -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"`

View File

@ -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]
}
// 往营销系统下单,返回数据,通知下游系统

View File

@ -35,4 +35,5 @@ type KeySendExtendParam struct {
Num int64 `json:"num"`
MobileNo string `json:"mobileNo"`
SendMsg string `json:"sendMsg"`
VoucherId string `json:"voucherId"`
}

View File

@ -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"`