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
326ae7ed
authored
Jul 09, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
user_id获取
parent
9b0a7ad1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
service/goods_service.go
service/goods_service.go
View file @
326ae7ed
...
...
@@ -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
...
...
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