Commit 9072e86e by 杨树贤

新客

parent 20e8bb08
...@@ -73,4 +73,5 @@ type ActivityCheckData struct { ...@@ -73,4 +73,5 @@ type ActivityCheckData struct {
ClassId int ClassId int
OrgId int OrgId int
Source int Source int
NewCustomer int
} }
...@@ -16,6 +16,8 @@ type RequestParams struct { ...@@ -16,6 +16,8 @@ type RequestParams struct {
ShowSpuExtra string ShowSpuExtra string
// 用户权限相关参数 // 用户权限相关参数
Power PowerParams Power PowerParams
//是否展示新客价格
ShowNewCustomerPrice string
} }
// PowerParams 用户权限参数 // PowerParams 用户权限参数
...@@ -51,4 +53,3 @@ func ExtractRequestParams(ctx *gin.Context) RequestParams { ...@@ -51,4 +53,3 @@ func ExtractRequestParams(ctx *gin.Context) RequestParams {
}, },
} }
} }
...@@ -55,9 +55,17 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a ...@@ -55,9 +55,17 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a
var hasActivity bool var hasActivity bool
nowTimestamp := int(time.Now().Unix()) nowTimestamp := int(time.Now().Unix())
for _, activity := range activities { for _, activity := range activities {
//判断状态
if activity.Status != 1 { if activity.Status != 1 {
continue continue
} }
//判断是否要新客判断,默认是不需要判断,所以要跳过新客活动
if checkData.NewCustomer != 1 {
if activity.UserScope == 3 {
continue
}
}
//判断时间是否过期 //判断时间是否过期
if activity.StartTime > nowTimestamp || activity.EndTime < nowTimestamp { if activity.StartTime > nowTimestamp || activity.EndTime < nowTimestamp {
continue continue
......
...@@ -67,6 +67,8 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go ...@@ -67,6 +67,8 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go
showSkuDetail := params.ShowSkuDetail showSkuDetail := params.ShowSkuDetail
//是否展示spu额外信息 //是否展示spu额外信息
showSpuExtra := params.ShowSpuExtra showSpuExtra := params.ShowSpuExtra
//是否展示新客价格
showNewCustomerPrice := params.ShowNewCustomerPrice
//批量获取商品详情 //批量获取商品详情
skuArr := gredis.Hmget("default_r", "sku", goodsIds) skuArr := gredis.Hmget("default_r", "sku", goodsIds)
...@@ -335,7 +337,7 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go ...@@ -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{ checkData := model.ActivityCheckData{
SupplierId: int(sku.SupplierId), SupplierId: int(sku.SupplierId),
...@@ -347,6 +349,7 @@ func (ls *LyService) GetActivity(sku model.LySku) model.LySku { ...@@ -347,6 +349,7 @@ func (ls *LyService) GetActivity(sku model.LySku) model.LySku {
ClassId: sku.ClassID2, ClassId: sku.ClassID2,
OrgId: sku.OrgId, OrgId: sku.OrgId,
Source: sku.Source, Source: sku.Source,
NewCustomer: gconv.Int(showNewCustomerPrice),
} }
var activityService ActivityService var activityService ActivityService
priceActivity, giftActivity := activityService.GetActivityData(checkData) priceActivity, giftActivity := activityService.GetActivityData(checkData)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment