Browse Source

add area

master
黄梓健 5 years ago
parent
commit
8cf6d6f4ec
  1. 8
      controllers/client/live.go
  2. 30
      models/live_config_area.go

8
controllers/client/live.go

@ -14,6 +14,7 @@ type LiveCtl struct {
// 详情
func (t *LiveCtl) Detail() {
activityId := t.MustGetInt64("activity_id")
areaId := t.MustGetInt64("area_id")
//var userId int64 = 0
userId := t.MustGetUID()
@ -25,6 +26,13 @@ func (t *LiveCtl) Detail() {
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "直播活动不存在")
config := new(models.LiveConfigArea)
exist, err = config.GetByActivityIdAndAreaId(activityId, areaId)
t.CheckErr(err)
if exist {
live.SharePosterImg = config.MergeSharePoster
}
live.AdminLiveUrl = ""
t.JSON(live)
}

30
models/live_config_area.go

@ -0,0 +1,30 @@
package models
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time"
)
const LiveConfigAreaTN = TableNamePrefix + "live_config_area"
type LiveConfigArea struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"`
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
AreaId int64 `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"`
LiveH5Url string `json:"live_h5_url" xorm:"not null default '' comment('h5直播地址') VARCHAR(255)"`
LiveH5Qrcode string `json:"live_h5_qrcode" xorm:"not null default '' comment('h5直播地址二维码') VARCHAR(255)"`
AdminLiveUrl string `json:"admin_live_url" xorm:"not null default '' comment('管理员直播地址,即直播页面中管理员登录页面') VARCHAR(255)"`
LiveH5AdminQrcode string `json:"live_h5_admin_qrcode" xorm:"not null default '' comment('管理员直播地址二维码') VARCHAR(255)"`
MergeSharePoster string `json:"merge_share_poster" xorm:"not null default '' comment('合成有二维码的海报') VARCHAR(255)"`
}
func (t *LiveConfigArea) TableName() string {
return LiveConfigTN
}
func (t *LiveConfigArea) GetByActivityIdAndAreaId(activityId, areaId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and area_id=?", activityId, areaId).Get(t)
}
Loading…
Cancel
Save