|
@@ -6,7 +6,6 @@ import (
|
|
"app.yhyue.com/moapp/jyMarketing/util"
|
|
"app.yhyue.com/moapp/jyMarketing/util"
|
|
"fmt"
|
|
"fmt"
|
|
_ "github.com/garyburd/redigo/redis"
|
|
_ "github.com/garyburd/redigo/redis"
|
|
- "golang.org/x/text/date"
|
|
|
|
"log"
|
|
"log"
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
@@ -66,15 +65,14 @@ func (service *ActivityService) LotteryReceive(data *activity.LotteryOperation,
|
|
userLettry.AppId = data.AppId
|
|
userLettry.AppId = data.AppId
|
|
userLettry.UserId = data.UserId
|
|
userLettry.UserId = data.UserId
|
|
userLettry.PrizeType = 0
|
|
userLettry.PrizeType = 0
|
|
- tn, _ := time.Parse("2006-01-02 15:04:05", t)
|
|
|
|
- userLettry.CreateTime =tn.
|
|
|
|
|
|
+ /* userLettry.CreateTime =tn.*/
|
|
userLettry.LotteryId = lotteryId
|
|
userLettry.LotteryId = lotteryId
|
|
userLettry.PrizeId = prizeData.PrizeId
|
|
userLettry.PrizeId = prizeData.PrizeId
|
|
userLettry.ValidityDates = prizeData.ValidityDates
|
|
userLettry.ValidityDates = prizeData.ValidityDates
|
|
userLettry.Name = prizeData.Name
|
|
userLettry.Name = prizeData.Name
|
|
userLettry.Full = int64(prizeData.Full)
|
|
userLettry.Full = int64(prizeData.Full)
|
|
userLettry.Reduce = int64(prizeData.Reduce)
|
|
userLettry.Reduce = int64(prizeData.Reduce)
|
|
- //userLettry.UserName=data.
|
|
|
|
|
|
+ userLettry.UserName=data.UserName
|
|
//0、有起止时间1、当天起几天可用2、次日起几天可用
|
|
//0、有起止时间1、当天起几天可用2、次日起几天可用
|
|
switch prizeData.ValidityTimeType {
|
|
switch prizeData.ValidityTimeType {
|
|
case 0:
|
|
case 0:
|
|
@@ -141,7 +139,9 @@ func (service *ActivityService) ActivityUse(data *activity.LotteryOperation) (in
|
|
orm.Rollback()
|
|
orm.Rollback()
|
|
return entity.ErrorCode, "该用户没有此此奖券"
|
|
return entity.ErrorCode, "该用户没有此此奖券"
|
|
}
|
|
}
|
|
- //2、奖券状态改为已使用
|
|
|
|
|
|
+ //2、奖券是否过期
|
|
|
|
+
|
|
|
|
+ //3、奖券状态改为已使用
|
|
userLotteryList[0].UseDate = time.Now()
|
|
userLotteryList[0].UseDate = time.Now()
|
|
userLotteryList[0].PrizeType = 1
|
|
userLotteryList[0].PrizeType = 1
|
|
numb, err := orm.Table("user_prize").ID(userLotteryList[0].Id).Cols("prizeType", "useDate").Update(userLotteryList[0])
|
|
numb, err := orm.Table("user_prize").ID(userLotteryList[0].Id).Cols("prizeType", "useDate").Update(userLotteryList[0])
|
|
@@ -150,7 +150,7 @@ func (service *ActivityService) ActivityUse(data *activity.LotteryOperation) (in
|
|
orm.Rollback()
|
|
orm.Rollback()
|
|
return entity.ErrorCode, "修改用户奖券失败"
|
|
return entity.ErrorCode, "修改用户奖券失败"
|
|
}
|
|
}
|
|
- //3、修改卷的使用量
|
|
|
|
|
|
+ //4、修改卷的使用量
|
|
lottery := entity.Lottery{}
|
|
lottery := entity.Lottery{}
|
|
lottery.Id = lotteryId
|
|
lottery.Id = lotteryId
|
|
_, err = orm.Exec("UPDATE lottery SET `useNumber` = useNumber+1 WHERE `id` = ?", lotteryId)
|
|
_, err = orm.Exec("UPDATE lottery SET `useNumber` = useNumber+1 WHERE `id` = ?", lotteryId)
|