|
|
|
@ -213,49 +213,47 @@ func SubmitOrder(c *gin.Context) {
|
|
|
|
|
IsSplit: orderInfo.IsSplit,
|
|
|
|
|
}
|
|
|
|
|
kind := 0
|
|
|
|
|
if vendor == 1800 || vendor == 2000 || vendor == 3000 {
|
|
|
|
|
switch vendor {
|
|
|
|
|
case 1800, 2000:
|
|
|
|
|
channelOrderID := strconv.Itoa(int(orderCopy.ID))
|
|
|
|
|
resp, err := JdOrderSubmit(tx, c.ClientIP(), data, vendor, previewOrderAddr, fData, channelOrderID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Println("订单生成失败:", err.Error())
|
|
|
|
|
back.Err(c, err.Error())
|
|
|
|
|
tx.Rollback()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if vendor == 1800 {
|
|
|
|
|
kind = 1
|
|
|
|
|
} else {
|
|
|
|
|
kind = 2
|
|
|
|
|
}
|
|
|
|
|
orderCopy.Kind = kind
|
|
|
|
|
fmt.Println("订单号为", resp.OrderID)
|
|
|
|
|
orderCopy.JCookOrderID = resp.OrderID
|
|
|
|
|
case 3000:
|
|
|
|
|
channelOrderID := strconv.Itoa(int(orderCopy.ID))
|
|
|
|
|
resp, err := ShaMaOrderSubmit(tx, c.ClientIP(), data, vendor, previewOrderAddr, fData, channelOrderID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Println("订单生成失败:", err.Error())
|
|
|
|
|
back.Err(c, err.Error())
|
|
|
|
|
tx.Rollback()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
orderCopy.Kind = 3
|
|
|
|
|
orderCopy.ShaMaOrderID = resp.OrderID
|
|
|
|
|
case 4000:
|
|
|
|
|
channelOrderID := strconv.Itoa(int(orderCopy.ID))
|
|
|
|
|
thirdPartyOrderSn, err := SupplyOrderSubmit(tx, c.ClientIP(), data, vendor, previewOrderAddr, fData, channelOrderID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Println("订单生成失败:", err.Error())
|
|
|
|
|
back.Err(c, err.Error())
|
|
|
|
|
tx.Rollback()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
orderCopy.Kind = 4
|
|
|
|
|
orderCopy.ThirdPartyType = goods2.RecookGoodsInfoThirdPartyTypeSupply
|
|
|
|
|
orderCopy.ThirdPartyOrderSn = thirdPartyOrderSn
|
|
|
|
|
switch vendor {
|
|
|
|
|
case 1800, 2000:
|
|
|
|
|
channelOrderID := strconv.Itoa(int(orderCopy.ID))
|
|
|
|
|
resp, err := JdOrderSubmit(tx, c.ClientIP(), data, vendor, previewOrderAddr, fData, channelOrderID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Println("订单生成失败:", err.Error())
|
|
|
|
|
back.Err(c, err.Error())
|
|
|
|
|
tx.Rollback()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if vendor == 1800 {
|
|
|
|
|
kind = 1
|
|
|
|
|
} else {
|
|
|
|
|
kind = 2
|
|
|
|
|
}
|
|
|
|
|
orderCopy.Kind = kind
|
|
|
|
|
fmt.Println("订单号为", resp.OrderID)
|
|
|
|
|
orderCopy.JCookOrderID = resp.OrderID
|
|
|
|
|
case 3000:
|
|
|
|
|
channelOrderID := strconv.Itoa(int(orderCopy.ID))
|
|
|
|
|
resp, err := ShaMaOrderSubmit(tx, c.ClientIP(), data, vendor, previewOrderAddr, fData, channelOrderID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Println("订单生成失败:", err.Error())
|
|
|
|
|
back.Err(c, err.Error())
|
|
|
|
|
tx.Rollback()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
orderCopy.Kind = 3
|
|
|
|
|
orderCopy.ShaMaOrderID = resp.OrderID
|
|
|
|
|
case 4000:
|
|
|
|
|
channelOrderID := strconv.Itoa(int(orderCopy.ID))
|
|
|
|
|
thirdPartyOrderSn, err := SupplyOrderSubmit(tx, c.ClientIP(), data, vendor, previewOrderAddr, fData, channelOrderID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Println("订单生成失败:", err.Error())
|
|
|
|
|
back.Err(c, err.Error())
|
|
|
|
|
tx.Rollback()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
orderCopy.Kind = 4
|
|
|
|
|
orderCopy.ThirdPartyType = goods2.RecookGoodsInfoThirdPartyTypeSupply
|
|
|
|
|
orderCopy.ThirdPartyOrderSn = thirdPartyOrderSn
|
|
|
|
|
}
|
|
|
|
|
if condition {
|
|
|
|
|
orderInfo.ID = orderCopy.ID
|
|
|
|
|