Commit 14e3d0a3 by huangchengyi

1.0

parent 14b9872c
Showing with 22 additions and 3 deletions
...@@ -67,6 +67,11 @@ func (t *CommonLyService) GetSkuByGoodsSn(goodsList map[string]*model.LyClearGoo ...@@ -67,6 +67,11 @@ func (t *CommonLyService) GetSkuByGoodsSn(goodsList map[string]*model.LyClearGoo
common.PrintDebugHtml(goodsList) common.PrintDebugHtml(goodsList)
for goodsSn, info := range goodsList { for goodsSn, info := range goodsList {
if info.BrandName == "" || info.GoodsName == "" {
common.PrintDebugHtml("品牌名称或者商品名称不得为空")
continue;
}
snSku := php2go.Md5(strings.ToLower(goodsSn+"_"+supplierIdStr)) snSku := php2go.Md5(strings.ToLower(goodsSn+"_"+supplierIdStr))
skuId,_ := gredis.String(redisWrite.Do("HGET",config.Get("redis_all.SKU_UNIQUE_JUDGE").String(),snSku)) //查询唯一值,反查sku_id skuId,_ := gredis.String(redisWrite.Do("HGET",config.Get("redis_all.SKU_UNIQUE_JUDGE").String(),snSku)) //查询唯一值,反查sku_id
......
...@@ -21,6 +21,8 @@ var( ...@@ -21,6 +21,8 @@ var(
productList map[string]*model.LyClearGoodsList //格式化数据 productList map[string]*model.LyClearGoodsList //格式化数据
) )
//mouser请求外链 //mouser请求外链
func OutLinkDigikey(goodsName *string) map[string]*model.LyClearGoodsList { func OutLinkDigikey(goodsName *string) map[string]*model.LyClearGoodsList {
if *goodsName == "" { if *goodsName == "" {
...@@ -54,10 +56,13 @@ func OutLinkDigikey(goodsName *string) map[string]*model.LyClearGoodsList { ...@@ -54,10 +56,13 @@ func OutLinkDigikey(goodsName *string) map[string]*model.LyClearGoodsList {
} }
common.PrintDebugHtml("digikey原始数据:"+result) common.PrintDebugHtml("digikey原始数据:"+result)
productList = make(map[string]*model.LyClearGoodsList,0)
clearData(&result,"Products") clearData(&result,"Products")
clearData(&result,"ExactManufacturerProducts") clearData(&result,"ExactManufacturerProducts")
clearData(&result,"ExactDigiKeyProduct") clearData(&result,"ExactDigiKeyProduct",)
//额外处理
switch middleware.REQUEST["flag"] { switch middleware.REQUEST["flag"] {
case "2": //调试原始输出 case "2": //调试原始输出
common.PrintDebugHtml("格式化后原始数据:") common.PrintDebugHtml("格式化后原始数据:")
...@@ -172,11 +177,15 @@ func clearData(result *string,types string) { ...@@ -172,11 +177,15 @@ func clearData(result *string,types string) {
} }
apiGoodsList := gjson.Get(*result,types).Array() apiGoodsList := gjson.Get(*result,types).Array()
common.PrintDebugHtml("格式化数据开始——---"+types)
common.PrintDebugHtml(apiGoodsList)
if apiGoodsList == nil { if apiGoodsList == nil {
return return
} }
productList = make(map[string]*model.LyClearGoodsList,0)
RawList := make(map[string]*model.RawGoods,0) RawList := make(map[string]*model.RawGoods,0)
for _, goods := range apiGoodsList { for _, goods := range apiGoodsList {
...@@ -245,7 +254,7 @@ func clearData(result *string,types string) { ...@@ -245,7 +254,7 @@ func clearData(result *string,types string) {
ManufacturerLeadWeeks: goods.Get("ManufacturerLeadWeeks").String(), //交期 ManufacturerLeadWeeks: goods.Get("ManufacturerLeadWeeks").String(), //交期
//共有数据 //共有数据
GoodsName: goods.Get("ManufacturerPartNumber").String(), GoodsName: goods.Get("ManufacturerPartNumber").String(),
BrandName: goods.Get("Manufacturer").String(), BrandName: goods.Get("Manufacturer.Value").String(),
Desc: goods.Get("ProductDescription").String(), Desc: goods.Get("ProductDescription").String(),
GoodsSn: goodsSn, GoodsSn: goodsSn,
Docurl: goods.Get("PrimaryDatasheet").String(), Docurl: goods.Get("PrimaryDatasheet").String(),
...@@ -260,6 +269,11 @@ func clearData(result *string,types string) { ...@@ -260,6 +269,11 @@ func clearData(result *string,types string) {
} }
productList[goodsSn] = &LyClearGoodsList productList[goodsSn] = &LyClearGoodsList
} }
common.PrintDebugHtml("格式化结果:")
common.PrintDebugHtml(productList)
common.PrintDebugHtml("格式化数据结束—---"+types)
//赋值原始数据 //赋值原始数据
commly := CommonLyService{} commly := CommonLyService{}
commly.RawGoods = RawList commly.RawGoods = RawList
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment