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 skuId int64 `json:"skuId"` // 平台sku
SupplierSkuId int64 `json:"supplierSkuId"` // 供货商sku SupplierSkuId int64 `json:"supplierSkuId"` // 供货商sku
SupplierId int64 `json:"supplierId"` // 供货商id SupplierId int64 `json:"supplierId"` // 供货商id
Account string `json:"thirdSkuId"` // 充值账号 Account string `json:"account"` // 充值账号
ExtendParams string `json:"extendParams"` // 额外参数 ExtendParams string `json:"extendParams"` // 额外参数
Count int64 `json:"count"` //数量(此字段只目前支持是金豆,积分等虚拟资产,其他商品不支持) Count int64 `json:"count"` //数量(此字段只目前支持是金豆,积分等虚拟资产,其他商品不支持)
Sign string `json:"sign"` Sign string `json:"sign"`

View File

@ -7,7 +7,6 @@ import (
"rs/cmd/api/internal/logic/vo" "rs/cmd/api/internal/logic/vo"
"rs/rpc/transfer" "rs/rpc/transfer"
"rs/untils/httpclient" "rs/untils/httpclient"
"strconv"
"strings" "strings"
"time" "time"
@ -49,7 +48,7 @@ func (l *YlAsyncLogic) YlAsync(req *types.AsyncReq) (resp *types.AsyncResp, err
ReqSerialNo: req.DeliverOrderNo, ReqSerialNo: req.DeliverOrderNo,
Timestamp: time.Unix(req.CreateTime, 0).Format("20060102150405"), Timestamp: time.Unix(req.CreateTime, 0).Format("20060102150405"),
PosId: extendParam.PosId, PosId: extendParam.PosId,
VoucherId: strconv.Itoa(int(req.SupplierSkuId)), VoucherId: extendParam.VoucherId,
VoucherNum: extendParam.Num, VoucherNum: extendParam.Num,
MobileNo: extendParam.MobileNo, MobileNo: extendParam.MobileNo,
SendMsg: extendParam.SendMsg, SendMsg: extendParam.SendMsg,
@ -71,19 +70,21 @@ func (l *YlAsyncLogic) YlAsync(req *types.AsyncReq) (resp *types.AsyncResp, err
if result.Data == nil { if result.Data == nil {
return nil, fmt.Errorf("请求失败:%v", result.Msg) return nil, fmt.Errorf("请求失败:%v", result.Msg)
} }
return &types.AsyncResp{ return &types.AsyncResp{
Msg: "", Msg: "",
Status: status, Status: status,
SupplierOrderNo: result.Data.VoucherCode, SupplierOrderNo: l.getExchangeCode(result.Data.VoucherCode),
}, nil }, nil
} }
func (l *YlAsyncLogic) getExchangeUrl(voucherCode string) string { func (l *YlAsyncLogic) getExchangeCode(voucherCode string) string {
if strings.Contains(voucherCode, "http") { if !strings.Contains(voucherCode, "http") {
return voucherCode return voucherCode
} }
return fmt.Sprintf("%s%s", l.svcCtx.Config.Sys.Url, voucherCode) temp := strings.Split(voucherCode, "/")
return temp[len(temp)-1]
} }
// 往营销系统下单,返回数据,通知下游系统 // 往营销系统下单,返回数据,通知下游系统

View File

@ -30,9 +30,10 @@ type NotifyTypes struct {
} }
type KeySendExtendParam struct { type KeySendExtendParam struct {
AppId string `json:"appId"` AppId string `json:"appId"`
PosId string `json:"posId"` PosId string `json:"posId"`
Num int64 `json:"num"` Num int64 `json:"num"`
MobileNo string `json:"mobileNo"` MobileNo string `json:"mobileNo"`
SendMsg string `json:"sendMsg"` SendMsg string `json:"sendMsg"`
VoucherId string `json:"voucherId"`
} }

View File

@ -11,7 +11,7 @@ type AsyncReq struct {
SkuId int64 `json:"skuId"` // 平台sku SkuId int64 `json:"skuId"` // 平台sku
SupplierSkuId int64 `json:"supplierSkuId"` // 供货商sku SupplierSkuId int64 `json:"supplierSkuId"` // 供货商sku
SupplierId int64 `json:"supplierId"` // 供货商id SupplierId int64 `json:"supplierId"` // 供货商id
Account string `json:"thirdSkuId"` // 充值账号 Account string `json:"account"` // 充值账号
ExtendParams string `json:"extendParams"` // 额外参数 ExtendParams string `json:"extendParams"` // 额外参数
Count int64 `json:"count"` //数量(此字段只目前支持是金豆,积分等虚拟资产,其他商品不支持) Count int64 `json:"count"` //数量(此字段只目前支持是金豆,积分等虚拟资产,其他商品不支持)
Sign string `json:"sign"` Sign string `json:"sign"`