fix: 下单接口fix

This commit is contained in:
wolter 2024-11-05 16:21:50 +08:00
parent c5d4c7b989
commit bdf42ccf99
3 changed files with 17 additions and 8 deletions

View File

@ -15,6 +15,7 @@ type Config struct {
Key string Key string
} }
YouleHost string YouleHost string
SupplierSkuId map[string]string
} }
type Rpc struct { type Rpc struct {

View File

@ -7,6 +7,7 @@ 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"
@ -41,6 +42,13 @@ func (l *YlAsyncLogic) YlAsync(req *types.AsyncReq) (resp *types.AsyncResp, err
return nil, fmt.Errorf("extendParam 格式错误") return nil, fmt.Errorf("extendParam 格式错误")
} }
var VoucherId = ""
if v, ok := l.svcCtx.Config.SupplierSkuId[strconv.Itoa(int(req.SupplierSkuId))]; ok {
VoucherId = v
} else {
return nil, fmt.Errorf("供货商sku 未配置")
}
reqData = transfer.MarketKeySendReq{ reqData = transfer.MarketKeySendReq{
AppId: extendParam.AppId, AppId: extendParam.AppId,
ReqCode: "voucher.create", ReqCode: "voucher.create",
@ -48,7 +56,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: extendParam.VoucherId, VoucherId: VoucherId,
VoucherNum: extendParam.Num, VoucherNum: extendParam.Num,
MobileNo: extendParam.MobileNo, MobileNo: extendParam.MobileNo,
SendMsg: extendParam.SendMsg, SendMsg: extendParam.SendMsg,
@ -56,6 +64,7 @@ func (l *YlAsyncLogic) YlAsync(req *types.AsyncReq) (resp *types.AsyncResp, err
if reqData.SendMsg == "" { if reqData.SendMsg == "" {
reqData.SendMsg = "2" reqData.SendMsg = "2"
} }
reqData.Sign = l.svcCtx.Config.Sys.PrimaryKey reqData.Sign = l.svcCtx.Config.Sys.PrimaryKey
result, err := l.svcCtx.TransferRpc.MarketKeySend(l.ctx, &reqData) result, err := l.svcCtx.TransferRpc.MarketKeySend(l.ctx, &reqData)
if err != nil { if err != nil {

View File

@ -35,5 +35,4 @@ type KeySendExtendParam struct {
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"`
} }