Commit 277a4563 by mushishixian

temp

parent 9d4889cb
...@@ -4,6 +4,7 @@ go 1.13 ...@@ -4,6 +4,7 @@ go 1.13
require ( require (
github.com/360EntSecGroup-Skylar/excelize v1.4.1 github.com/360EntSecGroup-Skylar/excelize v1.4.1
github.com/garyburd/redigo v1.6.0
github.com/gin-gonic/gin v1.6.3 github.com/gin-gonic/gin v1.6.3
github.com/go-ini/ini v1.56.0 github.com/go-ini/ini v1.56.0
github.com/go-kratos/kratos v0.5.0 github.com/go-kratos/kratos v0.5.0
......
...@@ -68,6 +68,7 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8 ...@@ -68,6 +68,7 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/garyburd/redigo v1.6.0 h1:0VruCpn7yAIIu7pWVClQC8wxCJEcG3nyzpMSHKi1PQc=
github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
......
package logic
import (
"bom_server/internal/mapping"
"bom_server/internal/pkg/gredis"
"github.com/garyburd/redigo/redis"
"regexp"
)
//转换封装
func TransformEncap(encap string) (attrValue string) {
numberR, _ := regexp.Compile(mapping.PureNumberRegular)
pureNumber := numberR.FindString(encap)
//判断是多少位数字,如果是3位,则代表可能需要往前面补零
if len(pureNumber) == 3 {
encapCheck := "0" + pureNumber
//补全完以后,去sku_map2尝试获取值,如果存在的话,就代表是正确的封装
attrName, _ := redis.String(gredis.HGet("sku_map2", encapCheck))
if attrName != "" {
pureNumber = encapCheck
}
}
//再去找对应属性
attrValue = "封装" + "€" + pureNumber
return attrValue
}
...@@ -82,6 +82,7 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor ...@@ -82,6 +82,7 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor
func getSearchParams(index string, bomItem model.BomItem, sort int, flag bool) (searchRequest *es.SearchRequest) { func getSearchParams(index string, bomItem model.BomItem, sort int, flag bool) (searchRequest *es.SearchRequest) {
fmt.Println("商品名称 : ",bomItem.GoodsName) fmt.Println("商品名称 : ",bomItem.GoodsName)
fmt.Println("参数列表 : ",bomItem.AttrList) fmt.Println("参数列表 : ",bomItem.AttrList)
bomItem.Encap = TransformEncap(bomItem.Encap)
fmt.Println("封装 : ",bomItem.Encap) fmt.Println("封装 : ",bomItem.Encap)
query := getTermQuery(bomItem, sort, flag) query := getTermQuery(bomItem, sort, flag)
source := es.NewSearchSource().Query(query) source := es.NewSearchSource().Query(query)
......
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