Commit ae234186 by mushishixian

修复状态判断

parent c8992f7f
Showing with 12 additions and 8 deletions
...@@ -69,10 +69,10 @@ type LySku struct { ...@@ -69,10 +69,10 @@ type LySku struct {
type PriceActivity struct { type PriceActivity struct {
ActivityCommon ActivityCommon
Ratio float64 `json:"ratio"` Ratio float64 `json:"ratio,omitempty"`
SignText string `json:"sign_text"` SignText string `json:"sign_text,omitempty"`
Sign string `json:"sign"` Sign string `json:"sign,omitempty"`
ShowName string `json:"show_name"` ShowName string `json:"show_name,omitempty"`
} }
type GiftActivity struct { type GiftActivity struct {
......
...@@ -52,7 +52,9 @@ func (as *ActivityService) GetGiftActivity(checkData model.ActivityCheckData, ac ...@@ -52,7 +52,9 @@ func (as *ActivityService) GetGiftActivity(checkData model.ActivityCheckData, ac
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 {
return
}
//判断时间是否过期 //判断时间是否过期
if activity.StartTime > nowTimestamp || activity.EndTime < nowTimestamp { if activity.StartTime > nowTimestamp || activity.EndTime < nowTimestamp {
return return
...@@ -103,7 +105,7 @@ func (as *ActivityService) GetGiftActivity(checkData model.ActivityCheckData, ac ...@@ -103,7 +105,7 @@ func (as *ActivityService) GetGiftActivity(checkData model.ActivityCheckData, ac
ActivityId: activity.ActivityId, ActivityId: activity.ActivityId,
ActivityName: activity.ActivityName, ActivityName: activity.ActivityName,
AllowCoupon: activity.AllowCoupon, AllowCoupon: activity.AllowCoupon,
UserScope: activity.UserScope, UserScope: activity.UserScope,
}, },
} }
} }
...@@ -116,7 +118,9 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a ...@@ -116,7 +118,9 @@ 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 {
return
}
//判断时间是否过期 //判断时间是否过期
if activity.StartTime > nowTimestamp || activity.EndTime < nowTimestamp { if activity.StartTime > nowTimestamp || activity.EndTime < nowTimestamp {
return return
...@@ -183,7 +187,7 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a ...@@ -183,7 +187,7 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a
ActivityId: activity.ActivityId, ActivityId: activity.ActivityId,
ActivityName: activity.ActivityName, ActivityName: activity.ActivityName,
AllowCoupon: activity.AllowCoupon, AllowCoupon: activity.AllowCoupon,
UserScope: activity.UserScope, UserScope: activity.UserScope,
}, },
} }
} }
......
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