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
14e3d0a3
authored
Aug 03, 2020
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.0
parent
14b9872c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
service/ly/common.go
service/ly/digikey.go
service/ly/common.go
View file @
14e3d0a3
...
...
@@ -67,6 +67,11 @@ func (t *CommonLyService) GetSkuByGoodsSn(goodsList map[string]*model.LyClearGoo
common
.
PrintDebugHtml
(
goodsList
)
for
goodsSn
,
info
:=
range
goodsList
{
if
info
.
BrandName
==
""
||
info
.
GoodsName
==
""
{
common
.
PrintDebugHtml
(
"品牌名称或者商品名称不得为空"
)
continue
;
}
snSku
:=
php2go
.
Md5
(
strings
.
ToLower
(
goodsSn
+
"_"
+
supplierIdStr
))
skuId
,
_
:=
gredis
.
String
(
redisWrite
.
Do
(
"HGET"
,
config
.
Get
(
"redis_all.SKU_UNIQUE_JUDGE"
)
.
String
(),
snSku
))
//查询唯一值,反查sku_id
...
...
service/ly/digikey.go
View file @
14e3d0a3
...
...
@@ -21,6 +21,8 @@ var(
productList
map
[
string
]
*
model
.
LyClearGoodsList
//格式化数据
)
//mouser请求外链
func
OutLinkDigikey
(
goodsName
*
string
)
map
[
string
]
*
model
.
LyClearGoodsList
{
if
*
goodsName
==
""
{
...
...
@@ -54,10 +56,13 @@ func OutLinkDigikey(goodsName *string) map[string]*model.LyClearGoodsList {
}
common
.
PrintDebugHtml
(
"digikey原始数据:"
+
result
)
productList
=
make
(
map
[
string
]
*
model
.
LyClearGoodsList
,
0
)
clearData
(
&
result
,
"Products"
)
clearData
(
&
result
,
"ExactManufacturerProducts"
)
clearData
(
&
result
,
"ExactDigiKeyProduct"
)
clearData
(
&
result
,
"ExactDigiKeyProduct"
,
)
//额外处理
switch
middleware
.
REQUEST
[
"flag"
]
{
case
"2"
:
//调试原始输出
common
.
PrintDebugHtml
(
"格式化后原始数据:"
)
...
...
@@ -172,11 +177,15 @@ func clearData(result *string,types string) {
}
apiGoodsList
:=
gjson
.
Get
(
*
result
,
types
)
.
Array
()
common
.
PrintDebugHtml
(
"格式化数据开始——---"
+
types
)
common
.
PrintDebugHtml
(
apiGoodsList
)
if
apiGoodsList
==
nil
{
return
}
productList
=
make
(
map
[
string
]
*
model
.
LyClearGoodsList
,
0
)
RawList
:=
make
(
map
[
string
]
*
model
.
RawGoods
,
0
)
for
_
,
goods
:=
range
apiGoodsList
{
...
...
@@ -245,7 +254,7 @@ func clearData(result *string,types string) {
ManufacturerLeadWeeks
:
goods
.
Get
(
"ManufacturerLeadWeeks"
)
.
String
(),
//交期
//共有数据
GoodsName
:
goods
.
Get
(
"ManufacturerPartNumber"
)
.
String
(),
BrandName
:
goods
.
Get
(
"Manufacturer"
)
.
String
(),
BrandName
:
goods
.
Get
(
"Manufacturer
.Value
"
)
.
String
(),
Desc
:
goods
.
Get
(
"ProductDescription"
)
.
String
(),
GoodsSn
:
goodsSn
,
Docurl
:
goods
.
Get
(
"PrimaryDatasheet"
)
.
String
(),
...
...
@@ -260,6 +269,11 @@ func clearData(result *string,types string) {
}
productList
[
goodsSn
]
=
&
LyClearGoodsList
}
common
.
PrintDebugHtml
(
"格式化结果:"
)
common
.
PrintDebugHtml
(
productList
)
common
.
PrintDebugHtml
(
"格式化数据结束—---"
+
types
)
//赋值原始数据
commly
:=
CommonLyService
{}
commly
.
RawGoods
=
RawList
...
...
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