You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
package pc
|
|
|
|
import (
|
|
"hudongzhuanjia/controllers"
|
|
"hudongzhuanjia/models"
|
|
"hudongzhuanjia/utils/code"
|
|
)
|
|
|
|
//弹幕
|
|
type BarrageCtl struct {
|
|
controllers.AuthorCtl
|
|
}
|
|
|
|
//获取活动的详情
|
|
func (t *BarrageCtl) Details() {
|
|
activityId := t.MustGetInt64("activity_id")
|
|
server := new(models.DanMuServer)
|
|
exist, err := server.GetByActivityId(activityId)
|
|
t.CheckErr(err)
|
|
t.Assert(exist, code.MSG_BARRAGE_SERVER_NOT_EXIST, "弹幕不存在")
|
|
|
|
t.JSON(map[string]interface{}{
|
|
"server": server,
|
|
})
|
|
}
|
|
|
|
func (t *BarrageCtl) SaveSetting() {
|
|
activityId := t.MustGetInt64("activity_id")
|
|
|
|
activity := new(models.Activity)
|
|
exist, err := models.Get(activity, activityId)
|
|
t.CheckErr(err)
|
|
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
|
|
|
|
danmuId := t.MustGetInt64("danmu_server_id")
|
|
server := new(models.DanMuServer)
|
|
server.DanmuFontSize = t.MustGet("font_size")
|
|
server.DanmuOpacity = t.MustGetInt("opacity")
|
|
server.DanmuPosition = t.MustGet("position")
|
|
server.DanmuSpeed = t.MustGetInt("speed")
|
|
server.ServerDisplay = t.MustGet("display")
|
|
_, err = models.Update(danmuId, server, "danmu_font_size",
|
|
"danmu_opacity", "danmu_position", "danmu_speed", "server_display")
|
|
t.CheckErr(err)
|
|
t.SUCCESS("success")
|
|
}
|