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
b22eb23a
authored
Jul 06, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
2951af8a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
go.mod
service/attr_service.go
service/common_ly_service.go
go.mod
View file @
b22eb23a
...
...
@@ -7,7 +7,8 @@ require (
github.com/gin-contrib/cors v1.3.1
github.com/gin-gonic/gin v1.6.3
github.com/go-ini/ini v1.57.0
github.com/go-xorm/xorm v0.7.9 // indirect
github.com/go-sql-driver/mysql v1.5.0
github.com/go-xorm/xorm v0.7.9
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/protobuf v1.4.2
github.com/gomodule/redigo v2.0.1-0.20180401191855-9352ab68be13+incompatible
...
...
service/attr_service.go
View file @
b22eb23a
...
...
@@ -2,14 +2,14 @@ package service
import
(
"fmt"
"github.com/gomodule/redigo/redis"
_
"github.com/gomodule/redigo/redis"
"github.com/tidwall/gjson"
"gopkg.in/olivere/elastic.v5"
"regexp"
"search_server/pkg/common"
"search_server/pkg/config"
"search_server/pkg/es"
"search_server/pkg/gredis"
_
"search_server/pkg/gredis"
"strconv"
"strings"
)
...
...
@@ -46,7 +46,8 @@ 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, _ := redis.String(gredis.HGet("sku_map2", pureNumber))
attrName
:=
""
if
attrName
!=
""
{
attrValue
:=
attrName
+
"€"
+
pureNumber
attrsSlice
=
append
(
attrsSlice
,
attrValue
)
...
...
@@ -199,7 +200,8 @@ func getAttrValueByAttr(attr string) (attrValue string) {
}
}
else
{
//再去找没有单位的对应属性
attrName
,
_
=
redis
.
String
(
gredis
.
HGet
(
"sku_map2"
,
attr
))
//attrName, _ = redis.String(gredis.HGet("sku_map2", attr))
attrName
:=
""
if
attrName
!=
""
{
attrValue
=
attrName
+
"€"
+
attr
}
else
{
...
...
service/common_ly_service.go
View file @
b22eb23a
...
...
@@ -6,7 +6,7 @@ import (
_
"github.com/tidwall/gjson"
"search_server/model"
"search_server/pkg/config"
"search_server/pkg/gredis"
_
"search_server/pkg/gredis"
"strings"
)
...
...
@@ -47,7 +47,9 @@ func getSkuByGoodsSn(goods_list map[string]*model.LyClearGoodsList, supplier_inf
for
goods_sn
,
info
:=
range
goods_list
{
sn_sku
:=
php2go
.
Md5
(
strings
.
ToLower
(
goods_sn
))
sku_id
,
_
:=
gredis
.
HGet
(
sku_uique_judge
,
sn_sku
)
//查询唯一值,反查sku_id
//sku_id, _ := gredis.HGet(sku_uique_judge, sn_sku) //查询唯一值,反查sku_id
fmt
.
Println
(
sku_uique_judge
,
sn_sku
)
sku_id
:=
""
if
sku_id
==
""
{
//为空,先创建sku
//lock_key := "searchapi_"+sn_sku;
//flag := gredis.Setnx(lock_key,php2go.Time()+2)
...
...
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