|
@@ -4,6 +4,7 @@ import (
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
"app.yhyue.com/moapp/jybase/date"
|
|
"app.yhyue.com/moapp/jybase/date"
|
|
"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
"fmt"
|
|
"fmt"
|
|
"jy/src/jfw/modules/publicapply/src/activityday/consts"
|
|
"jy/src/jfw/modules/publicapply/src/activityday/consts"
|
|
"jy/src/jfw/modules/publicapply/src/activityday/util"
|
|
"jy/src/jfw/modules/publicapply/src/activityday/util"
|
|
@@ -29,12 +30,12 @@ type LotteryActiveInfoRes struct {
|
|
|
|
|
|
// GetLotteryActiveInfo 获取活动信息
|
|
// GetLotteryActiveInfo 获取活动信息
|
|
func GetLotteryActiveInfo(activeId int64, sess map[string]interface{}, session *httpsession.Session, req *http.Request) (activeInfo LotteryActiveInfoRes) {
|
|
func GetLotteryActiveInfo(activeId int64, sess map[string]interface{}, session *httpsession.Session, req *http.Request) (activeInfo LotteryActiveInfoRes) {
|
|
- r := NewRaffleInfo(sess, activeId, util.UserLabel(session), req)
|
|
|
|
var (
|
|
var (
|
|
err error
|
|
err error
|
|
prizeRs []map[string]interface{}
|
|
prizeRs []map[string]interface{}
|
|
now = time.Now()
|
|
now = time.Now()
|
|
)
|
|
)
|
|
|
|
+ r := NewRaffleInfo(sess, activeId, util.UserLabel(session), req)
|
|
activeInfo = LotteryActiveInfoRes{
|
|
activeInfo = LotteryActiveInfoRes{
|
|
Lai: &Lai{},
|
|
Lai: &Lai{},
|
|
NowUnix: now.Unix(),
|
|
NowUnix: now.Unix(),
|
|
@@ -43,6 +44,19 @@ func GetLotteryActiveInfo(activeId int64, sess map[string]interface{}, session *
|
|
if r.DLai == nil {
|
|
if r.DLai == nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ //活动期间
|
|
|
|
+ if r.DLai.ActiveStartTime <= now.Unix() && r.DLai.ActiveEndTime >= now.Unix() {
|
|
|
|
+ //首次访问活动页面 赠送剑鱼币100
|
|
|
|
+ onceKey := fmt.Sprintf("activity_day_once_%s", r.UserInfo.UserId)
|
|
|
|
+ if ok, err := redis.Exists(consts.RedisNewCode, onceKey); err == nil && !ok {
|
|
|
|
+ err = r.PointHarvest(r.DLai.Cost)
|
|
|
|
+ if err == nil {
|
|
|
|
+ redis.Put(consts.RedisNewCode, onceKey, now.Day(), 30*24*60*60)
|
|
|
|
+ } else {
|
|
|
|
+ log.Println("--首次 赠送--err -:", err.Error())
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
activeInfo.ActiveStartTime = r.DLai.ActiveStartTime //活动开始时间
|
|
activeInfo.ActiveStartTime = r.DLai.ActiveStartTime //活动开始时间
|
|
activeInfo.ActiveEndTime = r.DLai.ActiveEndTime //活动结束时间
|
|
activeInfo.ActiveEndTime = r.DLai.ActiveEndTime //活动结束时间
|
|
activeInfo.LotteryStartUnix = r.DLai.LotteryStartTime //抽奖开始时间
|
|
activeInfo.LotteryStartUnix = r.DLai.LotteryStartTime //抽奖开始时间
|