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
6aa298b8
authored
Jun 10, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Plain Diff
conflict
parents
893cdefc
fed36481
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
cmd/queue/bom.go
internal/logic/match.go
cmd/queue/bom.go
View file @
6aa298b8
...
...
@@ -22,7 +22,7 @@ func init() {
// "amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
//}
//
//str := `{"bom_id":
237
,"delivery_type":1,"sort":2}`
//str := `{"bom_id":
369
,"delivery_type":1,"sort":2}`
//rabbitmq.Send(queueExchange, str)
}
...
...
internal/logic/match.go
View file @
6aa298b8
...
...
@@ -209,6 +209,7 @@ func removeZiyingMatchBomItem(ziyingGoodsMapList []GoodsMap, bomItems []model.Bo
func
search
(
index
string
,
bomId
int
,
bomItems
[]
model
.
BomItem
,
deliveryType
,
sort
int
,
client
*
es
.
Client
,
rawSearch
bool
)
(
goodsMapList
[]
GoodsMap
,
err
error
)
{
//先去自营查一遍
search
:=
client
.
MultiSearch
()
.
Index
(
index
)
searchFlag
:=
false
//多重搜索,第一次先去精确匹配
for
_
,
bom
:=
range
bomItems
{
//如果是模糊查询,还要去截取字符串
...
...
@@ -220,8 +221,13 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor
}
//构建一个goods_name对应的bomItems列表
searchRequest
:=
getSearchParams
(
index
,
bom
.
GoodsName
,
bom
.
BrandName
,
sort
,
bom
.
Number
,
rawSearch
)
searchFlag
=
true
search
.
Add
(
searchRequest
)
}
//没有搜索条件的话,直接返回空值即可
if
!
searchFlag
{
return
nil
,
err
}
res
,
err
:=
search
.
Do
(
context
.
Background
())
if
err
!=
nil
{
return
...
...
@@ -307,6 +313,8 @@ func getTermQuery(goodsName, brandName string, number int, flag bool) (query *es
field
:=
"auto_goods_name"
query
=
query
.
Must
(
es
.
NewTermQuery
(
field
,
goodsName
))
}
//query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//query = query.Filter(es.NewRangeQuery("stock").Gt(0))
query
=
query
.
Filter
(
es
.
NewTermQuery
(
"status"
,
1
))
//query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//src, err := query.Source()
...
...
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