|
@@ -166,7 +166,7 @@ func (service *ActivityServiceNew) UserAllLottery(in *activity.AllLotteryReq) ma
|
|
|
return result
|
|
|
}
|
|
|
|
|
|
-//商品下的活动查询
|
|
|
+// 商品下的活动查询
|
|
|
func getAllActivity(productCode, userId, appId, userName, userPhone string, receivingLocation int64, orm *xorm.Engine, userGroupMap map[string]bool) []entity.Activity {
|
|
|
//1、查找活动信息
|
|
|
activityArr := []entity.Activity{}
|
|
@@ -277,7 +277,7 @@ func getAllActivity(productCode, userId, appId, userName, userPhone string, rece
|
|
|
return activityArr
|
|
|
}
|
|
|
|
|
|
-//判断奖券是否领取过
|
|
|
+// 判断奖券是否领取过
|
|
|
func isDraw(userId, appId string, lotteryId int64, orm *xorm.Engine) (bool, entity.UserPrize) {
|
|
|
userLottery := entity.UserPrize{}
|
|
|
//判断手里的奖券是否使用了
|
|
@@ -286,7 +286,14 @@ func isDraw(userId, appId string, lotteryId int64, orm *xorm.Engine) (bool, enti
|
|
|
return false, userLottery
|
|
|
}
|
|
|
if fool, _ := util.Exists(util.CODE, "lottery_"+fmt.Sprint(lotteryId)); !fool {
|
|
|
- return false, userLottery
|
|
|
+ lotteryList := []entity.Lottery{}
|
|
|
+ key := "lottery_" + fmt.Sprint(lotteryId)
|
|
|
+ orm.Table("lottery").Where("id=?", lotteryId).Get(&lotteryList)
|
|
|
+ if len(lotteryList) > 0 {
|
|
|
+ util.PutCKV("other", key, lotteryList[0].StockNumber)
|
|
|
+ } else {
|
|
|
+ return false, userLottery
|
|
|
+ }
|
|
|
}
|
|
|
logx.Info(fmt.Sprint(lotteryId) + "Id奖券领取")
|
|
|
//每种劵处理
|
|
@@ -369,7 +376,7 @@ func isDraw(userId, appId string, lotteryId int64, orm *xorm.Engine) (bool, enti
|
|
|
return true, userLottery
|
|
|
}
|
|
|
|
|
|
-//领取操作
|
|
|
+// 领取操作
|
|
|
func drawHandle(userId, appId, userName, userPhone string, lotteryId int64, userLottery entity.UserPrize) {
|
|
|
if lotteryId == 0 {
|
|
|
return
|
|
@@ -409,7 +416,7 @@ func drawHandle(userId, appId, userName, userPhone string, lotteryId int64, user
|
|
|
orm.Commit()
|
|
|
}
|
|
|
|
|
|
-//用户下可以使用的奖券
|
|
|
+// 用户下可以使用的奖券
|
|
|
func availableLottery(orm *xorm.Engine, activityId int64, lotteryIdArr, userId, appId string) []entity.LotteryJson {
|
|
|
//查询奖券信息
|
|
|
var userLotteryList []entity.LotteryJson
|
|
@@ -427,7 +434,7 @@ func availableLottery(orm *xorm.Engine, activityId int64, lotteryIdArr, userId,
|
|
|
return userLotteryList
|
|
|
}
|
|
|
|
|
|
-//满折满减预热活动奖券查询
|
|
|
+// 满折满减预热活动奖券查询
|
|
|
func lotteryWaitHandle(orm *xorm.Engine, lotteryIdArr, userId, appId string, activityId int64, userPrice *[]entity.LotteryJson) []entity.LotteryJson {
|
|
|
//var err error
|
|
|
//没有商品标识时处理
|
|
@@ -447,7 +454,7 @@ func lotteryWaitHandle(orm *xorm.Engine, lotteryIdArr, userId, appId string, act
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//商品下所有奖券查询
|
|
|
+// 商品下所有奖券查询
|
|
|
func (service *ActivityServiceNew) GetAllLottery(in *activity.Request) (int64, string, []entity.Activity) {
|
|
|
//1、查找活动信息
|
|
|
orm := entity.Engine
|