|
@@ -9,7 +9,6 @@ import ( |
|
|
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" |
|
|
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" |
|
|
"encoding/json" |
|
|
"encoding/json" |
|
|
"errors" |
|
|
"errors" |
|
|
"github.com/jinzhu/copier" |
|
|
|
|
|
"github.com/syyongx/php2go" |
|
|
"github.com/syyongx/php2go" |
|
|
"github.com/tidwall/gjson" |
|
|
"github.com/tidwall/gjson" |
|
|
"strings" |
|
|
"strings" |
|
@@ -51,9 +50,9 @@ func JdDetailGoods(eg *xorm.Engine, dbName string, postData map[string]interface |
|
|
return nil, err |
|
|
return nil, err |
|
|
} |
|
|
} |
|
|
if len(data.Data) == 0 { |
|
|
if len(data.Data) == 0 { |
|
|
return nil, errors.New("商品下架") |
|
|
|
|
|
|
|
|
return nil, errors.New("商品已下架") |
|
|
} |
|
|
} |
|
|
var tmpData md.JDZhimengItem |
|
|
|
|
|
|
|
|
var tmpData md.MoreDetailResponse |
|
|
for _, v := range data.Data { |
|
|
for _, v := range data.Data { |
|
|
imgList := make([]string, 0) |
|
|
imgList := make([]string, 0) |
|
|
img := "" |
|
|
img := "" |
|
@@ -63,44 +62,36 @@ func JdDetailGoods(eg *xorm.Engine, dbName string, postData map[string]interface |
|
|
img = v1.Url |
|
|
img = v1.Url |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
var tmp = md.JDZhimengItem{ |
|
|
|
|
|
SkuId: zhios_third_party_utils.Int64ToStr(v.SkuId), |
|
|
|
|
|
Cid1: v.CategoryInfo.Cid1, |
|
|
|
|
|
Cid1Name: v.CategoryInfo.Cid1Name, |
|
|
|
|
|
Cid2: v.CategoryInfo.Cid2, |
|
|
|
|
|
Cid2Name: v.CategoryInfo.Cid2Name, |
|
|
|
|
|
Cid3: v.CategoryInfo.Cid3, |
|
|
|
|
|
Cid3Name: v.CategoryInfo.Cid3Name, |
|
|
|
|
|
CommissionRate: v.CommissionInfo.CommissionShare, |
|
|
|
|
|
|
|
|
var tmp = md.MoreDetailResponse{ |
|
|
|
|
|
CommissionRate: zhios_third_party_utils.Float64ToStr(v.CommissionInfo.CommissionShare), |
|
|
CouponURL: "", |
|
|
CouponURL: "", |
|
|
EndTime: int(time.Now().Unix()) + 86400*365, |
|
|
|
|
|
Gid: v.ItemId, |
|
|
|
|
|
|
|
|
CouponPrice: "", |
|
|
|
|
|
EndTime: zhios_third_party_utils.IntToStr(int(time.Now().Unix()) + 86400*365), |
|
|
|
|
|
GID: v.ItemId, |
|
|
GoodsImg: img, |
|
|
GoodsImg: img, |
|
|
GoodsTitle: strings.ReplaceAll(v.SkuName, "\t", ""), |
|
|
GoodsTitle: strings.ReplaceAll(v.SkuName, "\t", ""), |
|
|
ImgList: imgList, |
|
|
|
|
|
InOrderCount: v.InOrderCount30Days, |
|
|
|
|
|
IsFreeFreightRisk: 1, |
|
|
|
|
|
IsFreeShipping: 1, |
|
|
|
|
|
IsJdSale: v.IsJdSale, |
|
|
|
|
|
LowerPrice: v.PriceInfo.LowestPrice, |
|
|
|
|
|
LowerPriceType: v.PriceInfo.LowestPriceType, |
|
|
|
|
|
LowestCouponPrice: v.PriceInfo.LowestCouponPrice, |
|
|
|
|
|
PcGoodsPrice: v.PriceInfo.Price, |
|
|
|
|
|
ShopID: v.ShopInfo.ShopId, |
|
|
|
|
|
|
|
|
InOrderCount: zhios_third_party_utils.IntToStr(v.InOrderCount30Days), |
|
|
|
|
|
LowerPrice: zhios_third_party_utils.Float64ToStr(v.PriceInfo.LowestPrice), |
|
|
|
|
|
LowerPriceType: zhios_third_party_utils.IntToStr(v.PriceInfo.LowestPriceType), |
|
|
|
|
|
LowestCouponPrice: zhios_third_party_utils.Float64ToStr(v.PriceInfo.LowestCouponPrice), |
|
|
|
|
|
ShopID: zhios_third_party_utils.IntToStr(v.ShopInfo.ShopId), |
|
|
ShopName: v.ShopInfo.ShopName, |
|
|
ShopName: v.ShopInfo.ShopName, |
|
|
StartTime: int(time.Now().Unix()), |
|
|
|
|
|
|
|
|
StartTime: zhios_third_party_utils.Int64ToStr(time.Now().Unix()), |
|
|
StoreID: "0", |
|
|
StoreID: "0", |
|
|
WlGoodsPrice: v.PriceInfo.Price, |
|
|
|
|
|
|
|
|
WlGoodsPrice: zhios_third_party_utils.Float64ToStr(v.PriceInfo.Price), |
|
|
|
|
|
|
|
|
|
|
|
GoodsImgList: imgList, |
|
|
|
|
|
ImageList: imgList, |
|
|
|
|
|
DetailImgList: imgList, |
|
|
} |
|
|
} |
|
|
if tmp.LowerPrice > 0 { |
|
|
|
|
|
tmp.PcGoodsPrice = tmp.LowerPrice |
|
|
|
|
|
|
|
|
if zhios_third_party_utils.StrToFloat64(tmp.LowerPrice) > 0 { |
|
|
tmp.WlGoodsPrice = tmp.LowerPrice |
|
|
tmp.WlGoodsPrice = tmp.LowerPrice |
|
|
} |
|
|
} |
|
|
if len(v.CouponInfo.CouponList) > 0 { |
|
|
if len(v.CouponInfo.CouponList) > 0 { |
|
|
var max float64 = 0 |
|
|
var max float64 = 0 |
|
|
for _, v1 := range v.CouponInfo.CouponList { |
|
|
for _, v1 := range v.CouponInfo.CouponList { |
|
|
if v1.Discount > max && v1.IsBest == 1 { |
|
|
if v1.Discount > max && v1.IsBest == 1 { |
|
|
tmp.CouponPrice = int(v1.Discount) |
|
|
|
|
|
|
|
|
tmp.CouponPrice = zhios_third_party_utils.Float64ToStr(v1.Discount) |
|
|
tmp.CouponURL = v1.Link |
|
|
tmp.CouponURL = v1.Link |
|
|
max = v1.Discount |
|
|
max = v1.Discount |
|
|
} |
|
|
} |
|
@@ -108,7 +99,7 @@ func JdDetailGoods(eg *xorm.Engine, dbName string, postData map[string]interface |
|
|
} |
|
|
} |
|
|
tmpData = tmp |
|
|
tmpData = tmp |
|
|
} |
|
|
} |
|
|
copier.Copy(&r, &tmpData) |
|
|
|
|
|
|
|
|
r = tmpData |
|
|
} else { |
|
|
} else { |
|
|
jdData, err := jd.NewZhiMengJingDongSDK(). |
|
|
jdData, err := jd.NewZhiMengJingDongSDK(). |
|
|
SelectFunction("getgoodsinfo"). |
|
|
SelectFunction("getgoodsinfo"). |
|
|