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
c248f4ac
authored
Jul 06, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
整合redis
parent
26d8bc65
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
service/attr_service.go
service/attr_service.go
View file @
c248f4ac
...
...
@@ -2,6 +2,7 @@ package service
import
(
"fmt"
"github.com/gomodule/redigo/redis"
_
"github.com/gomodule/redigo/redis"
"github.com/tidwall/gjson"
"gopkg.in/olivere/elastic.v5"
...
...
@@ -9,6 +10,7 @@ import (
"search_server/pkg/common"
"search_server/pkg/config"
"search_server/pkg/es"
"search_server/pkg/gredis"
_
"search_server/pkg/gredis"
"strconv"
"strings"
...
...
@@ -46,8 +48,9 @@ func SearchAttr(attrOrigin, encap string) (goodsName string, err error) {
numberR
,
_
:=
regexp
.
Compile
(
common
.
PureNumberRegular
)
pureNumber
:=
numberR
.
FindString
(
encap
)
//再去找对应属性
//attrName, _ := redis.String(gredis.HGet("sku_map2", pureNumber))
attrName
:=
""
redisConn
:=
gredis
.
Conn
(
"default_redis_read"
)
defer
redisConn
.
Close
()
attrName
,
_
:=
redis
.
String
(
redisConn
.
Do
(
"HGET"
,
"sku_map2"
,
pureNumber
))
if
attrName
!=
""
{
attrValue
:=
attrName
+
"€"
+
pureNumber
attrsSlice
=
append
(
attrsSlice
,
attrValue
)
...
...
@@ -200,8 +203,9 @@ func getAttrValueByAttr(attr string) (attrValue string) {
}
}
else
{
//再去找没有单位的对应属性
//attrName, _ = redis.String(gredis.HGet("sku_map2", attr))
attrName
:=
""
redisConn
:=
gredis
.
Conn
(
"default_redis_read"
)
defer
redisConn
.
Close
()
attrName
,
_
:=
redis
.
String
(
redisConn
.
Do
(
"HGET"
,
"sku_map2"
,
pureNumber
))
if
attrName
!=
""
{
attrValue
=
attrName
+
"€"
+
attr
}
else
{
...
...
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