Commit 326ae7ed by mushishixian

user_id获取

parent 9b0a7ad1
Showing with 13 additions and 2 deletions
......@@ -8,17 +8,28 @@ import (
"github.com/uniplaces/carbon"
"gopkg.in/olivere/elastic.v5"
"regexp"
"search_server/middleware"
"search_server/model"
"search_server/pkg/config"
"search_server/pkg/es"
"search_server/pkg/gredis"
"search_server/requests"
"search_server/service/transformer"
"strconv"
"strings"
)
//获取商品信息,需要传入userId用于判断是否登陆
func GetGoodsInfo(goodsIds []string, userId int) (goodsListMap map[string]model.ApiGoods, err error) {
func GetGoodsInfo(goodsIds []string) (goodsListMap map[string]model.ApiGoods, err error) {
var userIdStr string
userIdStr, err = middleware.Context.Cookie("Yo4teW_uid")
if err != nil {
return
}
userId, err := strconv.Atoi(userIdStr)
if err != nil {
return
}
isNewCustomer, isMember := CheckIsNewCustomer(userId)
goodsIdsStr := strings.Join(goodsIds, ",")
params := req.Param{
......@@ -219,7 +230,7 @@ func GetGoodsBySupplier(r requests.QuoteIndexRequest) (result map[string]interfa
if err != nil {
return
}
goodsList, err := GetGoodsInfo(goodsIds, 0)
goodsList, err := GetGoodsInfo(goodsIds)
dullData, err := transformer.DullDataInfo(r.Keyword, goodsList)
result = make(map[string]interface{})
result["data"] = dullData
......
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