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
6220f235
authored
Jul 09, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
组装url
parent
13efa80f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
7 deletions
model/goods.go
service/sku_service.go
service/transformer/goods_transformer.go
model/goods.go
View file @
6220f235
...
...
@@ -90,6 +90,8 @@ type DullGoodsData struct {
LastSearchTime
int
`json:"last_search_time"`
CustomsTax
string
`json:"customs_tax"`
Alike
string
`json:"alike"`
BrandUrl
string
`json:"brand_url"`
GoodsUrl
string
`json:"goods_url"`
}
type
Attr
struct
{
...
...
service/sku_service.go
0 → 100644
View file @
6220f235
package
service
//推送搜索关键词
func
ShowSku
()
{
}
\ No newline at end of file
service/transformer/goods_transformer.go
View file @
6220f235
...
...
@@ -4,6 +4,7 @@ import (
"github.com/gomodule/redigo/redis"
"github.com/tidwall/gjson"
"search_server/dao"
"search_server/middleware"
"search_server/model"
"search_server/pkg/common"
"search_server/pkg/config"
...
...
@@ -32,8 +33,8 @@ func DullDataInfo(r requests.QuoteIndexRequest, goodsListMap map[string]model.Ap
if
err
!=
nil
{
return
result
,
err
}
//
todo:
在不同的环境组装不同的url
//在不同的环境组装不同的url
goods
=
spliceUrlByEnvironment
(
goods
)
//获取汇率相关
goods
=
getRatio
(
goods
)
//todo:提供给客服报价系统专用(因为只是给快手用的,所以抽离出这个方法)
...
...
@@ -50,7 +51,10 @@ func DullDataInfo(r requests.QuoteIndexRequest, goodsListMap map[string]model.Ap
//价格等信息混淆
if
r
.
Keyword
!=
"---"
{
goods
=
MetGoodsInfo
(
goods
,
r
.
CheckButton
,
r
.
K1
,
r
.
K2
)
goods
,
err
=
MetGoodsInfo
(
goods
)
if
err
!=
nil
{
return
result
,
err
}
}
//增加类似物料字段
goods
=
getGoodsAlike
(
r
.
Keyword
,
goods
)
...
...
@@ -61,6 +65,12 @@ func DullDataInfo(r requests.QuoteIndexRequest, goodsListMap map[string]model.Ap
//在不同的环境组装不同的url
func
spliceUrlByEnvironment
(
goods
model
.
DullGoodsData
)
model
.
DullGoodsData
{
referer
:=
middleware
.
Context
.
Request
.
Header
.
Get
(
"referer"
)
refererTemp
:=
strings
.
Split
(
referer
,
".com"
)
if
len
(
refererTemp
)
>
0
{
goods
.
BrandUrl
=
refererTemp
[
0
]
+
".com/v3/brand/list/"
+
common
.
ToString
(
goods
.
BrandId
)
+
".html"
goods
.
GoodsUrl
=
refererTemp
[
0
]
+
".com/goods_"
+
common
.
ToString
(
goods
.
GoodsId
)
+
".html"
}
return
goods
}
...
...
@@ -238,8 +248,15 @@ func arrangeData(goods model.DullGoodsData) model.DullGoodsData {
}
//价格等信息混淆
func
MetGoodsInfo
(
data
model
.
DullGoodsData
,
checkButton
,
k1
,
k2
int
)
(
result
model
.
DullGoodsData
)
{
if
checkButton
==
2
||
k1
!=
0
||
k2
!=
0
{
func
MetGoodsInfo
(
data
model
.
DullGoodsData
)
(
result
model
.
DullGoodsData
,
err
error
)
{
type
CheckParams
struct
{
CheckButton
int
`form:"check_button"`
K1
int
`form:"k1"`
K2
int
`form:"k2"`
}
var
checkParams
CheckParams
err
=
middleware
.
Context
.
Bind
(
&
checkParams
)
if
checkParams
.
CheckButton
==
2
||
checkParams
.
K1
!=
0
||
checkParams
.
K2
!=
0
{
data
.
StockStr
=
data
.
Stock
data
.
MoqStr
=
data
.
Moq
data
.
MpqStr
=
data
.
Mpq
...
...
@@ -250,7 +267,7 @@ func MetGoodsInfo(data model.DullGoodsData, checkButton, k1, k2 int) (result mod
data
.
LadderPrice
[
key
]
.
PurchasesStr
=
price
.
Purchases
}
}
return
return
data
,
err
}
else
{
if
len
(
data
.
LadderPrice
)
>
0
{
for
key
,
price
:=
range
data
.
LadderPrice
{
...
...
@@ -262,6 +279,6 @@ func MetGoodsInfo(data model.DullGoodsData, checkButton, k1, k2 int) (result mod
data
.
MpqStr
=
common
.
NumberToHtml
(
data
.
Mpq
)
data
.
MplStr
=
common
.
NumberToHtml
(
data
.
Mpl
)
data
.
MultipleStr
=
common
.
NumberToHtml
(
data
.
Multiple
)
return
data
return
data
,
err
}
}
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