|
|
@ -81,9 +81,15 @@ type LotteryLadderResult struct { |
|
|
|
//获取所有抽奖活动列表
|
|
|
|
func (t *LotteryDrawCtl) List() { |
|
|
|
activityId := t.MustGetInt64("activity_id") |
|
|
|
customerId := t.MustGetUID() |
|
|
|
|
|
|
|
customer := new(models.Customer) |
|
|
|
exist, err := models.GetById(customer, customerId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在") |
|
|
|
|
|
|
|
activity := new(models.Activity) |
|
|
|
exist, err := models.GetById(activity, activityId) |
|
|
|
exist, err = models.GetById(activity, activityId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") |
|
|
|
|
|
|
@ -97,7 +103,7 @@ func (t *LotteryDrawCtl) List() { |
|
|
|
|
|
|
|
// 多地区的一个坑:分配给主会场的area_id不是主账号的area_id
|
|
|
|
area := new(models.AreaStore) |
|
|
|
if t.MustGetCustomerPid() == 0 { |
|
|
|
if customer.Pid == 0 { |
|
|
|
exist, err = area.GetMainAreaById(activityId) |
|
|
|
} else { |
|
|
|
exist, err = area.GetAreaStoreById(t.MustGetAreaId()) |
|
|
@ -178,14 +184,20 @@ type LotteryUsersResult struct { |
|
|
|
func (t *LotteryDrawCtl) Users() { |
|
|
|
activityId := t.MustGetInt64("activity_id") |
|
|
|
ruleId := t.MustGetInt64("lottery_draw_rule_id") |
|
|
|
customerId := t.MustGetUID() |
|
|
|
|
|
|
|
customer := new(models.Customer) |
|
|
|
exist, err := models.GetById(customer, customerId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在") |
|
|
|
|
|
|
|
activity := new(models.Activity) |
|
|
|
exist, err := models.GetById(activity, activityId) |
|
|
|
exist, err = models.GetById(activity, activityId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") |
|
|
|
|
|
|
|
area := new(models.AreaStore) |
|
|
|
if t.MustGetCustomerPid() == 0 { |
|
|
|
if customer.Pid == 0 { |
|
|
|
exist, err = area.GetMainAreaById(activityId) |
|
|
|
} else { |
|
|
|
exist, err = area.GetAreaStoreById(t.MustGetAreaId()) |
|
|
@ -227,16 +239,22 @@ func (t *LotteryDrawCtl) Lottery() { |
|
|
|
ruleId := t.MustGetInt64("lottery_draw_rule_id") |
|
|
|
ladderId := t.MustGetInt64("lottery_draw_ladder_id") |
|
|
|
number := t.MustGetInt("number") // 奖品数量
|
|
|
|
customerId := t.MustGetUID() |
|
|
|
|
|
|
|
customer := new(models.Customer) |
|
|
|
exist, err := models.GetById(customer, customerId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在") |
|
|
|
|
|
|
|
activity := new(models.Activity) |
|
|
|
exist, err := models.GetById(activity, activityId) |
|
|
|
exist, err = models.GetById(activity, activityId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") |
|
|
|
t.CheckRunning(activity.Status) |
|
|
|
|
|
|
|
// 多地区设置
|
|
|
|
area := new(models.AreaStore) |
|
|
|
if t.MustGetCustomerPid() == 0 { |
|
|
|
if customer.Pid == 0 { |
|
|
|
exist, err = area.GetMainAreaById(activity.Id) |
|
|
|
} else { |
|
|
|
exist, err = area.GetAreaStoreById(t.MustGetAreaId()) |
|
|
|