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
36f58f51
authored
Jun 02, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix bug
parent
22793d17
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
cmd/queue/bom.go
internal/logic/goods.go
internal/logic/match.go
cmd/queue/bom.go
View file @
36f58f51
...
...
@@ -22,7 +22,7 @@ func init() {
// "amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
//}
//
//str := `{"bom_id":23
6,"delivery_type":1,"sort":3
}`
//str := `{"bom_id":23
7,"delivery_type":1,"sort":2
}`
//rabbitmq.Send(queueExchange, str)
}
...
...
internal/logic/goods.go
View file @
36f58f51
...
...
@@ -133,7 +133,6 @@ func GetGoodsInfo(goodsIdsStr string) (goodsList []model.ApiGoods, err error) {
func
MatchGoodsInfo
(
goods
model
.
ApiGoods
,
goodsMap
GoodsMap
)
(
bomMatching
model
.
BomItemMatching
,
err
error
)
{
//组装需要去更新的商品信息
var
delivery
string
if
goodsMap
.
DeliveryType
==
1
{
delivery
=
goods
.
CnDeliveryTime
}
else
{
...
...
internal/logic/match.go
View file @
36f58f51
...
...
@@ -211,6 +211,7 @@ func getUpdateGoodsData(bomId int, bomItems []model.BomItem, deliveryType, sort
goodsMap
.
BomItemId
=
bomItems
[
key
]
.
BomItemID
goodsMap
.
BomId
=
bomId
goodsMap
.
DeliveryType
=
deliveryType
goodsMapList
=
append
(
goodsMapList
,
goodsMap
)
break
}
...
...
@@ -223,7 +224,6 @@ func getUpdateGoodsData(bomId int, bomItems []model.BomItem, deliveryType, sort
func
getSearchParams
(
goodsName
,
brandName
string
,
sort
,
number
int
,
flag
bool
)
(
searchRequest
*
es
.
SearchRequest
)
{
query
:=
getTermQuery
(
goodsName
,
brandName
,
number
,
flag
)
source
:=
es
.
NewSearchSource
()
.
IndexBoost
(
"liexin_ziying"
,
2
)
.
Query
(
query
)
source
.
Sort
(
"_score"
,
false
)
if
sort
==
1
{
source
.
Sort
(
"sort"
,
false
)
source
.
Sort
(
"stock"
,
false
)
...
...
@@ -238,6 +238,7 @@ func getSearchParams(goodsName, brandName string, sort, number int, flag bool) (
source
.
Sort
(
"stock_sort"
,
false
)
source
.
Sort
(
"stock"
,
false
)
}
source
.
Sort
(
"_score"
,
false
)
source
=
source
.
From
(
0
)
.
Size
(
1
)
searchRequest
=
es
.
NewSearchRequest
()
.
Source
(
source
)
return
searchRequest
...
...
@@ -265,7 +266,7 @@ func getTermQuery(goodsName, brandName string, number int, flag bool) (query *es
query
=
query
.
Must
(
es
.
NewTermQuery
(
field
,
goodsName
))
}
query
=
query
.
Filter
(
es
.
NewTermQuery
(
"status"
,
1
))
query
=
query
.
Filter
(
es
.
NewRangeQuery
(
"single_price"
)
.
Gt
(
0
))
//
query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//src, err := query.Source()
//if err != nil {
// panic(err)
...
...
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