|
@ -17,7 +17,8 @@ func (t *LotteryCtl) UserLotteries() { |
|
|
uid := t.MustGetUID() |
|
|
uid := t.MustGetUID() |
|
|
|
|
|
|
|
|
userPrizes := make([]*models.UserPrize, 0) |
|
|
userPrizes := make([]*models.UserPrize, 0) |
|
|
err := core.GetXormAuto().Where("is_delete=0 and user_id=? ", uid).Desc("created_at").Find(&userPrizes) |
|
|
|
|
|
|
|
|
err := core.GetXormAuto().Where("is_delete=0 and user_id=? ", uid). |
|
|
|
|
|
Desc("created_at").Find(&userPrizes) |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|
|
|
|
|
|
|
t.JSON(map[string]interface{}{ |
|
|
t.JSON(map[string]interface{}{ |
|
@ -27,12 +28,19 @@ func (t *LotteryCtl) UserLotteries() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (t *LotteryCtl) CashLottery() { |
|
|
func (t *LotteryCtl) CashLottery() { |
|
|
|
|
|
uid := t.MustGetUID() |
|
|
prizeId := t.MustGetInt64("prize_id") |
|
|
prizeId := t.MustGetInt64("prize_id") |
|
|
name := t.MustGet("name") |
|
|
name := t.MustGet("name") |
|
|
phone := t.MustGet("phone") |
|
|
phone := t.MustGet("phone") |
|
|
wxNo := t.MustGet("wx_no") |
|
|
wxNo := t.MustGet("wx_no") |
|
|
address := t.MustGet("address") |
|
|
address := t.MustGet("address") |
|
|
|
|
|
|
|
|
|
|
|
prize := new(models.UserPrize) |
|
|
|
|
|
prize.Id = prizeId |
|
|
|
|
|
prize.UserId = uid |
|
|
|
|
|
prize.Status = 1 |
|
|
|
|
|
err := prize.Update("status") |
|
|
|
|
|
t.CheckErr(err) |
|
|
record := new(models.LotteryDrawRecord) |
|
|
record := new(models.LotteryDrawRecord) |
|
|
exist, err := record.GetByUserPrizeId(prizeId) |
|
|
exist, err := record.GetByUserPrizeId(prizeId) |
|
|
t.CheckErr(err) |
|
|
t.CheckErr(err) |
|
|