Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
search_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
14b9872c
authored
Aug 03, 2020
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.0
parent
657403bc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
26 deletions
model/ly.go
service/ly/common.go
service/ly/digikey.go
service/ly/mouser.go
model/ly.go
View file @
14b9872c
...
@@ -2,38 +2,48 @@ package model
...
@@ -2,38 +2,48 @@ package model
//联营请求外链后格式化数据
//联营请求外链后格式化数据
type
LyClearGoodsList
struct
{
type
LyClearGoodsList
struct
{
SkuId
string
`json:"sku_id"`
//平台型号id (非必填)
SkuId
string
`json:"sku_id"`
//平台型号id (非必填)
SpuId
string
`json:"spu_id"`
//平台spuId (非必填)
SpuId
string
`json:"spu_id"`
//平台spuId (非必填)
BrandId
string
`json:"brand_id"`
//平台品牌id (非必填)
BrandId
string
`json:"brand_id"`
//平台品牌id (非必填)
GoodsName
string
`json:"goods_name"`
//型号名称
GoodsName
string
`json:"goods_name"`
//型号名称
BrandName
string
`json:"brand_name"`
//品牌名称
BrandName
string
`json:"brand_name"`
//品牌名称
Desc
string
`json:"desc"`
//描述
Desc
string
`json:"desc"`
//描述
BatchSn
string
`json:"batch_sn"`
//批次号
BatchSn
string
`json:"batch_sn"`
//批次号
GoodsSn
string
`json:"goods_sn"`
//api唯一编码
GoodsSn
string
`json:"goods_sn"`
//api唯一编码
Docurl
string
`json:"docurl"`
//sku对应供应商的文档路径
Docurl
string
`json:"docurl"`
//sku对应供应商的文档路径
Url
string
`json:"url"`
//sku对应供应商的商品详情
Url
string
`json:"url"`
//sku对应供应商的商品详情
GoodsImg
string
`json:"goods_img"`
//sku图片
GoodsImg
string
`json:"goods_img"`
//sku图片
Cat
string
`json:"cat"`
//分类
Cat
string
`json:"cat"`
//分类
Encap
string
`json:"encap"`
//包装
Encap
string
`json:"encap"`
//包装
Canal
string
`json:"canal"`
//渠道标签
Canal
string
`json:"canal"`
//渠道标签
Encoded
string
`json:"encoded"`
//内部编码
Encoded
string
`json:"encoded"`
//内部编码
RestrictionMessage
string
`json:"RestrictionMessage"`
//额外购买限制内容,如 ‘当前商品不在本地区销售’
RestrictionMessage
string
`json:"RestrictionMessage"`
//额外购买限制内容,如 ‘当前商品不在本地区销售’
Increment
int64
`json:"increment"`
//最小包装量、倍数 =Mpq
Increment
int64
`json:"increment"`
//最小包装量、倍数 =Mpq
SinglePrice
float64
`json:"single_price"`
//最小单价
SinglePrice
float64
`json:"single_price"`
//最小单价
Stock
int64
`json:"stock"`
//库存
Stock
int64
`json:"stock"`
//库存
Moq
int64
`json:"moq"`
//最小起订量、起订量
Moq
int64
`json:"moq"`
//最小起订量、起订量
RawGoodsId
string
`json:"raw_goods_id"`
//外链原始goods_sn,如digikey:{'raw_goods_id': 'AT28C64X-25PC-ND', 'raw_brand_name': 'Microchip Technology'}
Packaging
string
`json:"Packaging"`
//包装
RawBrandName
string
`json:"raw_brand_name"`
//外链原始品牌名称,如digikey:{'raw_goods_id': 'AT28C64X-25PC-ND', 'raw_brand_name': 'Microchip Technology'}
RawGoodsId
string
`json:"raw_goods_id"`
//外链原始goods_sn,如digikey:{'raw_goods_id': 'AT28C64X-25PC-ND', 'raw_brand_name': 'Microchip Technology'}
Tiered
[]
*
TierItem
`json:"tiered"`
//价格梯度数量
RawBrandName
string
`json:"raw_brand_name"`
//外链原始品牌名称,如digikey:{'raw_goods_id': 'AT28C64X-25PC-ND', 'raw_brand_name': 'Microchip Technology'}
PriceTemp
[]
interface
{}
`json:"price_temp"`
//拼接梯度,目前只有联营推送队列用
Tiered
[]
*
TierItem
`json:"tiered"`
//价格梯度数量
PriceTemp
[]
interface
{}
`json:"price_temp"`
//拼接梯度,目前只有联营推送队列用
DigiKeyPartNumber
string
`json:"DigiKeyPartNumber"`
//digkey 唯一编码 (额外字段)
ManufacturerLeadWeeks
string
`json:"ManufacturerLeadWeeks"`
//digikey交期(额外字段)
}
}
type
TierItem
struct
{
type
TierItem
struct
{
Purchases
u
int64
`json:"purchases"`
//购买数量
Purchases
int64
`json:"purchases"`
//购买数量
PriceUs
float64
`json:"price_us"`
//数量对应的英文价格
PriceUs
float64
`json:"price_us"`
//数量对应的英文价格
PriceCn
float64
`json:"price_cn"`
//数量对应的中文价格
PriceCn
float64
`json:"price_cn"`
//数量对应的中文价格
PriceAc
float64
`json:"price_ac"`
PriceAc
float64
`json:"price_ac"`
}
}
//原始品牌(目前只有digikey使用)
type
RawGoods
struct
{
RawGoodsId
string
`json:"raw_goods_id"`
//原始goods_sn
RawBrandName
string
`json:"raw_brand_name"`
//原始品牌名称
Pack
string
`json:"pack"`
//包装
}
/*
/*
供应商详情
供应商详情
Array
Array
...
...
service/ly/common.go
View file @
14b9872c
...
@@ -26,6 +26,7 @@ type CommonLyService struct {
...
@@ -26,6 +26,7 @@ type CommonLyService struct {
supplierId
int64
//调用当前方法的供应商ID
supplierId
int64
//调用当前方法的供应商ID
supplierName
string
//调用当前方法的供应商名称
supplierName
string
//调用当前方法的供应商名称
skuEsUpdataList
[]
string
//组装批量更新es数据
skuEsUpdataList
[]
string
//组装批量更新es数据
RawGoods
map
[
string
]
*
model
.
RawGoods
//原始数据
}
}
//初始化类
//初始化类
...
...
service/ly/digikey.go
View file @
14b9872c
This diff is collapsed.
Click to expand it.
service/ly/mouser.go
View file @
14b9872c
...
@@ -53,7 +53,7 @@ func OutLinkMouser(goodsName *string) map[string]*model.LyClearGoodsList {
...
@@ -53,7 +53,7 @@ func OutLinkMouser(goodsName *string) map[string]*model.LyClearGoodsList {
onePrice
=
strings
.
ReplaceAll
(
strings
.
Trim
(
onePrice
,
"$"
),
","
,
""
)
onePrice
=
strings
.
ReplaceAll
(
strings
.
Trim
(
onePrice
,
"$"
),
","
,
""
)
skuPrice
,
_
:=
strconv
.
ParseFloat
(
onePrice
,
64
)
//转成float64
skuPrice
,
_
:=
strconv
.
ParseFloat
(
onePrice
,
64
)
//转成float64
//数量转换
//数量转换
quantity
:=
gjson
.
Get
(
priceItemStr
,
"Quantity"
)
.
Ui
nt
()
quantity
:=
gjson
.
Get
(
priceItemStr
,
"Quantity"
)
.
I
nt
()
if
apiLowerPrice
==
0
{
if
apiLowerPrice
==
0
{
apiLowerPrice
=
skuPrice
apiLowerPrice
=
skuPrice
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment