Browse Source

fix:bug

master
黄梓健 5 years ago
parent
commit
988b358365
  1. 8
      controllers/client/live.go
  2. 35
      controllers/client/sign.go

8
controllers/client/live.go

@ -81,19 +81,11 @@ type LiveCtl struct {
func (t *LiveCtl) Detail() {
activityId := t.MustGetInt64("activity_id")
areaId := t.MustGetInt64("area_id")
userId := t.MustGetUID()
live := new(models.LiveConfig)
exist, err := live.GetByActivityId(activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_LIVE_CONFIG_NOT_EXIST, "直播活动不存在")
if live.WatchNum+1 >= live.Limit {
t.ERROR("直播人数已满", code.MSG_LIVE_LIMIT_ENOUGH)
return
}
err = new(models.LiveViewer).Record(userId, activityId, live.Id)
t.CheckErr(err)
fs := make(map[string]int, 0)
fs["is_shake"] = 0

35
controllers/client/sign.go

@ -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, "主活动不存在")

Loading…
Cancel
Save