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
9b0a7ad1
authored
Jul 09, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复
parent
6220f235
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
service/goods_service.go
service/transformer/goods_transformer.go
service/goods_service.go
View file @
9b0a7ad1
...
@@ -220,7 +220,7 @@ func GetGoodsBySupplier(r requests.QuoteIndexRequest) (result map[string]interfa
...
@@ -220,7 +220,7 @@ func GetGoodsBySupplier(r requests.QuoteIndexRequest) (result map[string]interfa
return
return
}
}
goodsList
,
err
:=
GetGoodsInfo
(
goodsIds
,
0
)
goodsList
,
err
:=
GetGoodsInfo
(
goodsIds
,
0
)
dullData
,
err
:=
transformer
.
DullDataInfo
(
r
,
goodsList
)
dullData
,
err
:=
transformer
.
DullDataInfo
(
r
.
Keyword
,
goodsList
)
result
=
make
(
map
[
string
]
interface
{})
result
=
make
(
map
[
string
]
interface
{})
result
[
"data"
]
=
dullData
result
[
"data"
]
=
dullData
result
[
"total"
]
=
gjson
.
Get
(
res
,
"hits.total"
)
.
Int
()
result
[
"total"
]
=
gjson
.
Get
(
res
,
"hits.total"
)
.
Int
()
...
...
service/transformer/goods_transformer.go
View file @
9b0a7ad1
...
@@ -9,12 +9,11 @@ import (
...
@@ -9,12 +9,11 @@ import (
"search_server/pkg/common"
"search_server/pkg/common"
"search_server/pkg/config"
"search_server/pkg/config"
"search_server/pkg/gredis"
"search_server/pkg/gredis"
"search_server/requests"
"strings"
"strings"
)
)
//处理商品信息数据
//处理商品信息数据
func
DullDataInfo
(
r
requests
.
QuoteIndexRequest
,
goodsListMap
map
[
string
]
model
.
ApiGoods
)
(
result
[]
model
.
DullGoodsData
,
err
error
)
{
func
DullDataInfo
(
keyword
string
,
goodsListMap
map
[
string
]
model
.
ApiGoods
)
(
result
[]
model
.
DullGoodsData
,
err
error
)
{
//获取redis链接
//获取redis链接
redisCon
:=
gredis
.
Conn
(
"search_r"
)
redisCon
:=
gredis
.
Conn
(
"search_r"
)
defer
redisCon
.
Close
()
defer
redisCon
.
Close
()
...
@@ -25,7 +24,7 @@ func DullDataInfo(r requests.QuoteIndexRequest, goodsListMap map[string]model.Ap
...
@@ -25,7 +24,7 @@ func DullDataInfo(r requests.QuoteIndexRequest, goodsListMap map[string]model.Ap
goods
.
GoodsName
=
goods
.
SpuName
goods
.
GoodsName
=
goods
.
SpuName
}
}
//获取goods_temp_name字段
//获取goods_temp_name字段
goods
=
getGoodsTempName
(
r
.
K
eyword
,
goods
)
goods
=
getGoodsTempName
(
k
eyword
,
goods
)
//获取tes广告
//获取tes广告
goods
=
getTesAd
(
goods
)
goods
=
getTesAd
(
goods
)
//供应商信息,读取redis,来源于基石配置
//供应商信息,读取redis,来源于基石配置
...
@@ -50,14 +49,14 @@ func DullDataInfo(r requests.QuoteIndexRequest, goodsListMap map[string]model.Ap
...
@@ -50,14 +49,14 @@ func DullDataInfo(r requests.QuoteIndexRequest, goodsListMap map[string]model.Ap
//todo : showsku方法
//todo : showsku方法
//价格等信息混淆
//价格等信息混淆
if
r
.
K
eyword
!=
"---"
{
if
k
eyword
!=
"---"
{
goods
,
err
=
MetGoodsInfo
(
goods
)
goods
,
err
=
MetGoodsInfo
(
goods
)
if
err
!=
nil
{
if
err
!=
nil
{
return
result
,
err
return
result
,
err
}
}
}
}
//增加类似物料字段
//增加类似物料字段
goods
=
getGoodsAlike
(
r
.
K
eyword
,
goods
)
goods
=
getGoodsAlike
(
k
eyword
,
goods
)
result
=
append
(
result
,
goods
)
result
=
append
(
result
,
goods
)
}
}
return
return
...
...
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