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
9072e86e
authored
Nov 11, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新客
parent
20e8bb08
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
2 deletions
model/activity.go
service/request_params.go
service/service_activity.go
service/service_ly.go
model/activity.go
View file @
9072e86e
...
...
@@ -73,4 +73,5 @@ type ActivityCheckData struct {
ClassId
int
OrgId
int
Source
int
NewCustomer
int
}
service/request_params.go
View file @
9072e86e
...
...
@@ -16,6 +16,8 @@ type RequestParams struct {
ShowSpuExtra
string
// 用户权限相关参数
Power
PowerParams
//是否展示新客价格
ShowNewCustomerPrice
string
}
// PowerParams 用户权限参数
...
...
@@ -51,4 +53,3 @@ func ExtractRequestParams(ctx *gin.Context) RequestParams {
},
}
}
service/service_activity.go
View file @
9072e86e
...
...
@@ -55,9 +55,17 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a
var
hasActivity
bool
nowTimestamp
:=
int
(
time
.
Now
()
.
Unix
())
for
_
,
activity
:=
range
activities
{
//判断状态
if
activity
.
Status
!=
1
{
continue
}
//判断是否要新客判断,默认是不需要判断,所以要跳过新客活动
if
checkData
.
NewCustomer
!=
1
{
if
activity
.
UserScope
==
3
{
continue
}
}
//判断时间是否过期
if
activity
.
StartTime
>
nowTimestamp
||
activity
.
EndTime
<
nowTimestamp
{
continue
...
...
service/service_ly.go
View file @
9072e86e
...
...
@@ -67,6 +67,8 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go
showSkuDetail
:=
params
.
ShowSkuDetail
//是否展示spu额外信息
showSpuExtra
:=
params
.
ShowSpuExtra
//是否展示新客价格
showNewCustomerPrice
:=
params
.
ShowNewCustomerPrice
//批量获取商品详情
skuArr
:=
gredis
.
Hmget
(
"default_r"
,
"sku"
,
goodsIds
)
...
...
@@ -335,7 +337,7 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go
}
// 获取活动
func
(
ls
*
LyService
)
GetActivity
(
sku
model
.
LySku
)
model
.
LySku
{
func
(
ls
*
LyService
)
GetActivity
(
sku
model
.
LySku
,
showNewCustomerPrice
string
)
model
.
LySku
{
//去判断是否有活动(促销打折活动和满赠活动)
checkData
:=
model
.
ActivityCheckData
{
SupplierId
:
int
(
sku
.
SupplierId
),
...
...
@@ -347,6 +349,7 @@ func (ls *LyService) GetActivity(sku model.LySku) model.LySku {
ClassId
:
sku
.
ClassID2
,
OrgId
:
sku
.
OrgId
,
Source
:
sku
.
Source
,
NewCustomer
:
gconv
.
Int
(
showNewCustomerPrice
),
}
var
activityService
ActivityService
priceActivity
,
giftActivity
:=
activityService
.
GetActivityData
(
checkData
)
...
...
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