Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_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
560140ec
authored
Dec 09, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
836a8ec3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletions
model/ly_sku.go
service/service_price.go
model/ly_sku.go
View file @
560140ec
...
...
@@ -63,6 +63,7 @@ type LySku struct {
//活动信息
ActivityEndTime
int64
`json:"activity_end_time,omitempty"`
ActivityInfo
map
[
string
]
interface
{}
`json:"activity_info,omitempty"`
Content
interface
{}
`json:"content"`
}
//为什么不直接映射到结构,而要用gjson,因为redis存的数据结构不一定正常,可能类型不一致
...
...
service/service_price.go
View file @
560140ec
...
...
@@ -14,6 +14,7 @@ import (
//获取联营活动价
func
(
ls
*
LyService
)
GetActivityPrice
(
sku
model
.
LySku
,
suffix
string
,
power
Power
)
model
.
LySku
{
//没价格,直接返回
var
contentSlice
[]
interface
{}
if
len
(
sku
.
LadderPrice
)
==
0
{
return
sku
}
...
...
@@ -22,13 +23,15 @@ func (ls *LyService) GetActivityPrice(sku model.LySku, suffix string, power Powe
if
suffix
==
""
&&
sku
.
SupplierId
==
14
{
return
getMouserActivityPrice
(
sku
)
}
contentSlice
=
append
(
contentSlice
,
sku
)
//先获取活动信息,针对不同供应商不同活动类型做活动吗,每个活动只能针对一个供应商
//比如有 Self_ActivityPrice_2_Discount,Self_ActivityPrice_1_NewCustomer
redisCon
:=
gredis
.
Conn
(
"default_r"
)
defer
redisCon
.
Close
()
supplierIdStr
:=
strconv
.
Itoa
(
int
(
sku
.
SupplierId
))
activityInfo
,
_
:=
redis
.
String
(
redisCon
.
Do
(
"GET"
,
"Self_ActivityPrice_"
+
supplierIdStr
+
suffix
))
contentSlice
=
append
(
contentSlice
,
activityInfo
)
//找不到对应的活动价格信息,就直接返回空
if
activityInfo
==
""
{
return
sku
...
...
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