Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
bom_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
ae492025
authored
Jun 29, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix bug
parent
ed0c545a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
cmd/queue/bom.go
internal/logic/attr.go
cmd/queue/bom.go
View file @
ae492025
...
@@ -22,7 +22,7 @@ func init() {
...
@@ -22,7 +22,7 @@ func init() {
// "amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
// "amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
//}
//}
//
//
//str := `{"bom_id":6
16
,"delivery_type":1,"sort":1}`
//str := `{"bom_id":6
42
,"delivery_type":1,"sort":1}`
//rabbitmq.Send(queueExchange, str)
//rabbitmq.Send(queueExchange, str)
}
}
...
...
internal/logic/attr.go
View file @
ae492025
...
@@ -56,7 +56,7 @@ func MatchGoodsNameByAttrs(bomItems []model.BomItem) (result []model.BomItem, er
...
@@ -56,7 +56,7 @@ func MatchGoodsNameByAttrs(bomItems []model.BomItem) (result []model.BomItem, er
if
responses
.
Hits
!=
nil
{
if
responses
.
Hits
!=
nil
{
for
_
,
hit
:=
range
responses
.
Hits
.
Hits
{
for
_
,
hit
:=
range
responses
.
Hits
.
Hits
{
res
,
_
:=
hit
.
Source
.
MarshalJSON
()
res
,
_
:=
hit
.
Source
.
MarshalJSON
()
if
bomItems
[
key
]
.
GoodsName
==
""
{
if
bomItems
[
key
]
.
GoodsName
==
""
||
(
bomItems
[
key
]
.
Attrs
==
""
&&
bomItems
[
key
]
.
GoodsName
!=
""
)
{
bomItems
[
key
]
.
GoodsName
=
gjson
.
Get
(
string
(
res
),
"goods_name"
)
.
String
()
bomItems
[
key
]
.
GoodsName
=
gjson
.
Get
(
string
(
res
),
"goods_name"
)
.
String
()
}
}
}
}
...
@@ -68,7 +68,12 @@ func MatchGoodsNameByAttrs(bomItems []model.BomItem) (result []model.BomItem, er
...
@@ -68,7 +68,12 @@ func MatchGoodsNameByAttrs(bomItems []model.BomItem) (result []model.BomItem, er
func
searchAttr
(
bomItem
model
.
BomItem
,
search
*
es
.
MultiSearchService
)
(
result
*
es
.
MultiSearchService
)
{
func
searchAttr
(
bomItem
model
.
BomItem
,
search
*
es
.
MultiSearchService
)
(
result
*
es
.
MultiSearchService
)
{
//先去切割参数得到参数列表
//先去切割参数得到参数列表
attrs
:=
splitAttrs
(
bomItem
.
Attrs
)
var
attrs
[]
string
if
bomItem
.
GoodsName
!=
""
&&
bomItem
.
Attrs
==
""
{
attrs
=
splitAttrs
(
bomItem
.
GoodsName
)
}
else
{
attrs
=
splitAttrs
(
bomItem
.
Attrs
)
}
//当切割出来的参数大于1个的时候,就要去针对每个参数进行里面再一次提纯
//当切割出来的参数大于1个的时候,就要去针对每个参数进行里面再一次提纯
if
len
(
attrs
)
>
1
{
if
len
(
attrs
)
>
1
{
for
key
,
attr
:=
range
attrs
{
for
key
,
attr
:=
range
attrs
{
...
...
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