|
|
|
@ -3,6 +3,8 @@ package order_preview
|
|
|
|
|
import (
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
"git.oa00.com/go/mysql"
|
|
|
|
|
"log"
|
|
|
|
|
"math"
|
|
|
|
|
"recook/configs"
|
|
|
|
|
"recook/internal/back"
|
|
|
|
@ -16,6 +18,7 @@ import (
|
|
|
|
|
"recook/internal/v2/lib/jcook"
|
|
|
|
|
"recook/internal/v2/lib/shama"
|
|
|
|
|
"recook/internal/v2/model/flashsale"
|
|
|
|
|
goods2 "recook/internal/v2/model/recook/goods"
|
|
|
|
|
"recook/tools"
|
|
|
|
|
"strconv"
|
|
|
|
|
"time"
|
|
|
|
@ -219,6 +222,29 @@ func CreatePreviewNormalOrder(c *gin.Context) {
|
|
|
|
|
}
|
|
|
|
|
var resp2 jcook.LogisticsFeeResp
|
|
|
|
|
if err := client.Exec(req1, &resp2); err != nil {
|
|
|
|
|
if err.Error() == "商品价格不匹配" {
|
|
|
|
|
go func() {
|
|
|
|
|
rq := jcook.SkuPriceReq{
|
|
|
|
|
SkuIDSet: []uint{uint(id)},
|
|
|
|
|
}
|
|
|
|
|
var res []jcook.SkuPriceResp
|
|
|
|
|
if err := client.Exec(rq, &res); err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if len(res) == 0 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
t := res[0]
|
|
|
|
|
|
|
|
|
|
var sku goods2.RecookGoodsSkuModel
|
|
|
|
|
if err := mysql.Db.Table(sku.TableName()).Where("third_party_sku_id = ? and third_party_type=3", t.SkuID).Updates(map[string]interface{}{
|
|
|
|
|
"purchase_price": t.SupplyPrice,
|
|
|
|
|
}).Error; err != nil {
|
|
|
|
|
log.Println(err.Error())
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
}
|
|
|
|
|
back.Err(c, err.Error())
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|