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
2e834757
authored
Oct 22, 2020
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.0
parent
d70ef0d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletions
conf/dev/config.ini
service/query/optimum_query.go
conf/dev/config.ini
View file @
2e834757
[web]
port
=
9000
mode
=
debug
cors_domain
=
http://bom.liexin.com
cors_domain
=
http://bom.liexin.com
,http://liexin.com,http://www.liexin.com
[message]
api_domain
=
http://api.ichunt.com/msg/sendMessageByAuto
...
...
service/query/optimum_query.go
View file @
2e834757
...
...
@@ -28,6 +28,12 @@ func GetOptimumAttrQuery(ctx *gin.Context,REQUEST_ATTR *map[string][]string,type
}
else
{
query1
.
Must
(
elastic
.
NewTermQuery
(
"class_id2"
,
class_id2
))
}
if
ctx
.
Request
.
FormValue
(
"avail_rank"
)
==
"1"
{
//只显示有货
query
.
Must
(
elastic
.
NewRangeQuery
(
"stock"
)
.
Gt
(
0
))
}
if
ctx
.
Request
.
FormValue
(
"goods_name/condition"
)
!=
""
{
//型号搜索
query1
.
Must
(
elastic
.
NewTermQuery
(
"goods_name"
,
ctx
.
Request
.
FormValue
(
"goods_name/condition"
)))
}
//存在属性查询
isClassAttr
:=
0
//存在其他属性搜索
...
...
@@ -79,6 +85,19 @@ func GetOptimumAttrQuery(ctx *gin.Context,REQUEST_ATTR *map[string][]string,type
source
.
FetchSourceContext
(
elastic
.
NewFetchSourceContext
(
true
)
.
Include
(
"goods_id"
))
//显示字段
source
.
Size
(
common
.
MyInt
(
page_size
))
source
.
From
(
page_from
)
//排序
if
ctx
.
Request
.
FormValue
(
"stock_rank"
)
==
"2"
{
source
.
Sort
(
"stock"
,
true
)
//true asc
}
else
{
source
.
Sort
(
"stock"
,
false
)
//true asc
}
if
ctx
.
Request
.
FormValue
(
"single_rank"
)
==
"2"
{
source
.
Sort
(
"lower_price"
,
true
)
//true asc
}
else
{
source
.
Sort
(
"lower_price"
,
false
)
//true asc
}
}
query
.
Must
(
query1
)
...
...
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