8 changed files with 131 additions and 67 deletions
-
7controllers/author.go
-
2controllers/base.go
-
24controllers/client/live.go
-
17controllers/client/login.go
-
8libs/jwt/jwt_go.go
-
1main.go
-
43models/live_config.go
-
12utils/code/code.go
@ -0,0 +1,24 @@ |
|||
package client |
|||
|
|||
import ( |
|||
"hudongzhuanjia/controllers" |
|||
"hudongzhuanjia/models" |
|||
"hudongzhuanjia/utils/code" |
|||
) |
|||
|
|||
type LiveCtl struct { |
|||
controllers.BaseCtl |
|||
} |
|||
|
|||
// 详情
|
|||
func (t *LiveCtl) Detail() { |
|||
activityId := t.MustGetInt64("activity_id") |
|||
|
|||
live := new(models.LiveConfig) |
|||
exist, err := live.GetByActivityId(activityId) |
|||
t.CheckErr(err) |
|||
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "直播活动不存在") |
|||
|
|||
live.AdminLiveUrl = "" |
|||
t.JSON(live) |
|||
} |
@ -0,0 +1,43 @@ |
|||
package models |
|||
|
|||
import ( |
|||
"github.com/ouxuanserver/osmanthuswine/src/core" |
|||
"time" |
|||
) |
|||
|
|||
const LiveConfigTN = TableNamePrefix + "live_config" |
|||
|
|||
type LiveConfig struct { |
|||
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` |
|||
IsDelete bool `json:"-" xorm:"not null default '' comment('是否删除')"` |
|||
CreatedAt time.Time `json:"created_at" xorm:"not null comment('创建时间') DATETIME"` |
|||
UpdatedAt time.Time `json:"updated_at" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"` |
|||
LiveSwitch int `json:"live_switch" xorm:"not null default 0 comment('直播开关0关1开') INT(11)"` |
|||
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"` |
|||
LiveRoomId string `json:"live_room_id" xorm:"not null default '' comment('直播间id') VARCHAR(128)"` |
|||
AdaptationFunc string `json:"adaptation_func" xorm:"not null default '' comment('选中的适配功能及互动已买的服务id,json格式') VARCHAR(255)"` |
|||
StartTime time.Time `json:"start_time" xorm:"not null default '1970-01-01 08:00:00' comment('开播时间') DATETIME"` |
|||
EndTime time.Time `json:"end_time" xorm:"not null default '1970-01-01 08:00:00' comment('直播结束时间') DATETIME"` |
|||
LiveH5Url string `json:"live_h5_url" xorm:"not null default '' comment('h5直播地址') VARCHAR(255)"` |
|||
AdminLiveUrl string `json:"admin_live_url" xorm:"not null default '' comment('管理员直播地址,即直播页面中管理员登录页面') VARCHAR(255)"` |
|||
LiveH5Qrcode string `json:"live_h5_qrcode" xorm:"not null default '' comment('h5直播地址二维码') VARCHAR(255)"` |
|||
UnpayOrderTime string `json:"unpay_order_time" xorm:"not null default '' comment('待支付订单直播结束延长的时间戳') VARCHAR(128)"` |
|||
LiveType int `json:"live_type" xorm:"not null default 1 comment('直播方式1推流方式2app直播') INT(1)"` |
|||
VideoPushUrl string `json:"video_push_url" xorm:"not null default '' comment('视频推流地址') VARCHAR(255)"` |
|||
VideoPullUrlRtmp string `json:"video_pull_url_rtmp" xorm:"not null default '' comment('视频拉流地址即播放地址') VARCHAR(255)"` |
|||
VideoPullUrlFlv string `json:"video_pull_url_flv" xorm:"not null default '' comment('视频拉流地址即播放地址') VARCHAR(255)"` |
|||
VideoPullUrlM3u8 string `json:"video_pull_url_m3u8" xorm:"not null default '' comment('视频拉流地址即播放地址') VARCHAR(255)"` |
|||
LiveStartPage string `json:"live_start_page" xorm:"not null default '' comment('直播启动页图片') VARCHAR(255)"` |
|||
BeforeStartPage string `json:"before_start_page" xorm:"not null default '' comment('开播前图片') VARCHAR(255)"` |
|||
ActivityDesc string `json:"activity_desc" xorm:"not null default '' comment('活动介绍页图片') VARCHAR(255)"` |
|||
SharePosterImg string `json:"share_poster_img" xorm:"not null default '' comment('分享的海报图片') VARCHAR(255)"` |
|||
Status int `json:"status" xorm:"not null default 1 comment('直播的状态1未开始2进行中3已结束') VARCHAR(255)"` |
|||
} |
|||
|
|||
func (t *LiveConfig) TableName() string { |
|||
return LiveConfigTN |
|||
} |
|||
|
|||
func (t *LiveConfig) GetByActivityId(id interface{}) (bool, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", id).Get(t) |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue