Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
LC_soapi
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
af89d701
authored
Jan 09, 2020
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复冲突
parent
9080f2f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
map/data.go → enum/data.go
logic/self.go
server/http/self.go
map
/data.go
→
enum
/data.go
View file @
af89d701
package
_map
package
enum
//品牌简写替换
var
SelfBrandReplace
=
map
[
string
]
string
{
...
...
logic/self.go
View file @
af89d701
package
logic
import
(
"LC_soapi/enum"
"LC_soapi/pkg/es"
"LC_soapi/pkg/setting"
"fmt"
...
...
@@ -69,19 +70,19 @@ func getESParams(params SearchParams) (esParams ESParams) {
goodsNameUpper
:=
strings
.
ToUpper
(
params
.
GoodsName
)
//精确匹配的型号列表
if
php2go
.
InArray
(
goodsNameUpper
,
setting
.
MathExactGoodsName
)
{
if
php2go
.
InArray
(
goodsNameUpper
,
enum
.
MathExactGoodsName
)
{
termQuery
:=
elastic
.
NewTermQuery
(
"auto_goods_name.raw"
,
goodsNameUpper
)
esQuery
=
elastic
.
NewBoolQuery
()
.
Must
(
termQuery
)
}
}
fmt
.
Println
(
upperField
,
intField
,
goodsTempStatus
,
esQuery
)
fmt
.
Println
(
upperField
,
intField
,
goodsTempStatus
,
esQuery
)
return
esParams
}
//转换商品名称
func
transformGoodsName
(
goodsName
string
)
string
{
//正则处理
for
key
,
value
:=
range
setting
.
SearchKeywordMapping
{
for
key
,
value
:=
range
enum
.
SearchKeywordMapping
{
reg
,
_
:=
regexp
.
Compile
(
key
)
goodsName
=
reg
.
ReplaceAllString
(
goodsName
,
value
)
}
...
...
@@ -92,7 +93,7 @@ func transformGoodsName(goodsName string) string {
func
getGoodsNameSlice
(
goodsName
string
)
(
goodsNameSlice
[]
string
)
{
//判断是否存在于品牌中,如果存在,则转换成品牌数据
if
goodsName
!=
""
{
brandName
:=
setting
.
SelfBrandReplace
[
strings
.
ToUpper
(
goodsName
)]
brandName
:=
enum
.
SelfBrandReplace
[
strings
.
ToUpper
(
goodsName
)]
if
brandName
!=
""
{
goodsNameSlice
=
append
(
goodsNameSlice
,
brandName
)
return
goodsNameSlice
...
...
server/http/self.go
View file @
af89d701
package
http
import
(
"LC_soapi/logic"
"LC_soapi/pkg/app"
"LC_soapi/service"
"github.com/gin-gonic/gin"
)
...
...
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