|
|
@ -19,23 +19,36 @@ type SignCtl struct { |
|
|
|
func (t *SignCtl) CheckSign() { |
|
|
|
activityId := t.MustGetInt64("activity_id") |
|
|
|
uid := t.MustGetUID() |
|
|
|
_type := t.MustGetInt("type") |
|
|
|
|
|
|
|
live := new(models.LiveConfig) |
|
|
|
exist, err := live.GetByActivityId(activityId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "直播活动不存在") |
|
|
|
if live.AdaptationFunc != nil && len(live.AdaptationFunc) != 0 { |
|
|
|
exist, err = new(models.ModuleServiceHistory).ExistSignModule(live.AdaptationFunc) |
|
|
|
if _type == 1 { |
|
|
|
live := new(models.LiveConfig) |
|
|
|
exist, err := live.GetByActivityId(activityId) |
|
|
|
t.CheckErr(err) |
|
|
|
if !exist { |
|
|
|
t.JSON(!exist) |
|
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "直播活动不存在") |
|
|
|
if live.LiveMode == 2 { |
|
|
|
if live.WatchNum+1 >= live.Limit { |
|
|
|
t.ERROR("直播人数已满", code.MSG_LIVE_LIMIT_ENOUGH) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
t.JSON(true) |
|
|
|
|
|
|
|
err = new(models.LiveViewer).Record(uid, activityId, live.Id) |
|
|
|
t.CheckErr(err) |
|
|
|
if live.AdaptationFunc != nil && len(live.AdaptationFunc) != 0 { |
|
|
|
exist, err = new(models.ModuleServiceHistory).ExistSignModule(live.AdaptationFunc) |
|
|
|
t.CheckErr(err) |
|
|
|
if !exist { |
|
|
|
t.JSON(true) |
|
|
|
} |
|
|
|
} else { |
|
|
|
t.JSON(true) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
activity := models.Activity{} |
|
|
|
exist, err = models.Get(&activity, activityId) |
|
|
|
exist, err := models.Get(&activity, activityId) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "主活动不存在") |
|
|
|
|
|
|
|