Commit 855a55c6 by mushishixian

fix bug

parent e0a19d6a
[web] [web]
port = 9000 port = 9000
mode = release mode = release
cors_domain = http://bom.ichunt.com
[message] [message]
api_domain = http://api.ichunt.com/msg/sendMessageByAuto api_domain = http://api.ichunt.com/msg/sendMessageByAuto
api_md5_str = fh6y5t4rr351d2c3bryi api_md5_str = fh6y5t4rr351d2c3bryi
[goods] [goods]
api_url = http://192.168.2.232:60004 api_url = http://47.106.60.211:60004
[es] [es]
url = http://172.18.137.29:9211 url = http://172.18.137.29:9211
...@@ -17,14 +18,6 @@ search_supplier = future,rochester,tme,verical,element14,digikey,chip1stop,aipco ...@@ -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 hk_delivery_type_supplier = future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin
attr_index = goods_map2 attr_index = goods_map2
[database]
user_name = root
password = root
host = 192.168.2.239
database = test
table_prefix =
type = mysql
[redis] [redis]
write_host = 172.18.137.38:6379 write_host = 172.18.137.38:6379
read_host = 172.18.137.39:6379 read_host = 172.18.137.39:6379
...@@ -33,7 +26,3 @@ read_password = icDb29mLy2s ...@@ -33,7 +26,3 @@ read_password = icDb29mLy2s
max_idle = 10 max_idle = 10
max_active = 10 max_active = 10
idle_timeout = 20 idle_timeout = 20
[mongo]
host = 127.0.0.1:27017
database = liexin_config
\ No newline at end of file
...@@ -37,7 +37,7 @@ func AutoSpuRequest() gin_.EncodeRequestFunc { ...@@ -37,7 +37,7 @@ func AutoSpuRequest() gin_.EncodeRequestFunc {
return func(context *gin.Context) (i interface{}, e error) { return func(context *gin.Context) (i interface{}, e error) {
bReq := &bom.AutoSpuRequest{} bReq := &bom.AutoSpuRequest{}
err := context.BindQuery(bReq) //使用的是query 参数 err := context.BindQuery(bReq) //使用的是query 参数
bReq.GoodsName = context.Query("goods_name") bReq.GoodsName, _ = context.GetPostForm("goods_name")
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
#!/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
...@@ -17,6 +17,9 @@ type BomServiceImpl struct{} ...@@ -17,6 +17,9 @@ type BomServiceImpl struct{}
func (bs *BomServiceImpl) AutoSpu(ctx context.Context, req *bom.AutoSpuRequest, rsp *bom.AutoSpuResponse) error { func (bs *BomServiceImpl) AutoSpu(ctx context.Context, req *bom.AutoSpuRequest, rsp *bom.AutoSpuResponse) error {
goodsNameSlice := AutoSpu(req.GoodsName) goodsNameSlice := AutoSpu(req.GoodsName)
if len(goodsNameSlice) == 0 {
rsp.ErrorCode = 1
}
rsp.Data = goodsNameSlice rsp.Data = goodsNameSlice
return nil return nil
} }
...@@ -36,8 +39,7 @@ func NewBomServiceImpl() *BomServiceImpl { ...@@ -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]+") replace, _ := regexp.Compile("[^A-Za-z0-9]+")
goodsName = replace.ReplaceAllString(goodsName, "") goodsName = replace.ReplaceAllString(goodsName, "")
goodsName = strings.ToUpper(goodsName) goodsName = strings.ToUpper(goodsName)
...@@ -51,6 +53,7 @@ func AutoSpu(goodsName string) (goodsNameList []string) { ...@@ -51,6 +53,7 @@ func AutoSpu(goodsName string) (goodsNameList []string) {
if err != nil { if err != nil {
log.Error(err) log.Error(err)
} }
goodsNameList := make([]string, 0)
goodsList := gjson.Get(result, "hits.hits.#._source").Array() goodsList := gjson.Get(result, "hits.hits.#._source").Array()
for _, goods := range goodsList { for _, goods := range goodsList {
goodsName := gjson.Get(goods.String(), "auto_goods_name").String() goodsName := gjson.Get(goods.String(), "auto_goods_name").String()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment