package video

import "github.com/beego/beego/v2/client/orm"

type VideoTagsItems struct {
	TagsId   int    `description:"标签id"`
	TagsName string `description:"标签名称"`
}

type VideoTagsListResp struct {
	List []*VideoTagsItems
}

func GetVideoTagsList() (items []*VideoTagsItems, err error) {
	o := orm.NewOrmUsingDB("rddp")
	sql := `SELECT * FROM tags WHERE tags_type=1 ORDER BY sort ASC `
	_, err = o.Raw(sql).QueryRows(&items)
	return
}

type VideoTags struct {
	VideoTagsId int `orm:"column(video_tags_id);pk" description:"视频标签id"`
	VideoId     int `description:"视频id"`
	TagsId      int `description:"标签id"`
}

//新增视频标签
func AddVideoTags(item *VideoTags) (err error) {
	o := orm.NewOrmUsingDB("rddp")
	_, err = o.Insert(item)
	return
}
