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
855a55c6
authored
Jun 18, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix bug
parent
e0a19d6a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
17 deletions
conf/config_production.ini
controller/bom_controller.go
search_server.bash
service/bom_service.go
conf/config_production.ini
View file @
855a55c6
[web]
port
=
9000
mode
=
release
cors_domain
=
http://bom.ichunt.com
[message]
api_domain
=
http://api.ichunt.com/msg/sendMessageByAuto
api_md5_str
=
fh6y5t4rr351d2c3bryi
[goods]
api_url
=
http://
192.168.2.232
:60004
api_url
=
http://
47.106.60.211
:60004
[es]
url
=
http://172.18.137.29:9211
...
...
@@ -17,14 +18,6 @@ search_supplier = future,rochester,tme,verical,element14,digikey,chip1stop,aipco
hk_delivery_type_supplier
=
future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin
attr_index
=
goods_map2
[database]
user_name
=
root
password
=
root
host
=
192.168.2.239
database
=
test
table_prefix
=
type
=
mysql
[redis]
write_host
=
172.18.137.38:6379
read_host
=
172.18.137.39:6379
...
...
@@ -33,7 +26,3 @@ read_password = icDb29mLy2s
max_idle
=
10
max_active
=
10
idle_timeout
=
20
[mongo]
host
=
127.0.0.1:27017
database
=
liexin_config
\ No newline at end of file
controller/bom_controller.go
View file @
855a55c6
...
...
@@ -37,7 +37,7 @@ func AutoSpuRequest() gin_.EncodeRequestFunc {
return
func
(
context
*
gin
.
Context
)
(
i
interface
{},
e
error
)
{
bReq
:=
&
bom
.
AutoSpuRequest
{}
err
:=
context
.
BindQuery
(
bReq
)
//使用的是query 参数
bReq
.
GoodsName
=
context
.
Query
(
"goods_name"
)
bReq
.
GoodsName
,
_
=
context
.
GetPostForm
(
"goods_name"
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
search_server.bash
0 → 100644
View file @
855a55c6
#!/bin/bash
cd
/data2/gocode/search_server
git pull origin master
go build
-o
./cmd/search_http_server ./cmd/search_http_server.go
supervisorctl restart search_server
service/bom_service.go
View file @
855a55c6
...
...
@@ -17,6 +17,9 @@ type BomServiceImpl struct{}
func
(
bs
*
BomServiceImpl
)
AutoSpu
(
ctx
context
.
Context
,
req
*
bom
.
AutoSpuRequest
,
rsp
*
bom
.
AutoSpuResponse
)
error
{
goodsNameSlice
:=
AutoSpu
(
req
.
GoodsName
)
if
len
(
goodsNameSlice
)
==
0
{
rsp
.
ErrorCode
=
1
}
rsp
.
Data
=
goodsNameSlice
return
nil
}
...
...
@@ -36,8 +39,7 @@ func NewBomServiceImpl() *BomServiceImpl {
}
//构建请求参数
func
AutoSpu
(
goodsName
string
)
(
goodsNameList
[]
string
)
{
func
AutoSpu
(
goodsName
string
)
[]
string
{
replace
,
_
:=
regexp
.
Compile
(
"[^A-Za-z0-9]+"
)
goodsName
=
replace
.
ReplaceAllString
(
goodsName
,
""
)
goodsName
=
strings
.
ToUpper
(
goodsName
)
...
...
@@ -51,6 +53,7 @@ func AutoSpu(goodsName string) (goodsNameList []string) {
if
err
!=
nil
{
log
.
Error
(
err
)
}
goodsNameList
:=
make
([]
string
,
0
)
goodsList
:=
gjson
.
Get
(
result
,
"hits.hits.#._source"
)
.
Array
()
for
_
,
goods
:=
range
goodsList
{
goodsName
:=
gjson
.
Get
(
goods
.
String
(),
"auto_goods_name"
)
.
String
()
...
...
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