Commit b22eb23a by 孙龙

up

parent 2951af8a
......@@ -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
......
......@@ -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 {
......
......@@ -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)
......
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