123456789101112131415161718192021222324252627282930313233343536373839 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type Resource struct {
- Id int `orm:"column(id);" description:"资源id"`
- ResourceUrl string `description:"资源地址"`
- CreateTime time.Time `description:"创建时间"`
- ResourceType int `description:"资源类型,1:图片,2:音频,3:视频 "`
- }
- type ResourceResp struct {
- Id int64 `orm:"column(id);" description:"用户id"`
- ResourceUrl string `description:"资源地址"`
- PlaySeconds uint32 `description:"播放时长,单位秒"`
- }
- func AddResource(item *Resource) (newId int64, err error) {
- o := orm.NewOrmUsingDB("rddp")
- newId, err = o.Insert(item)
- return
- }
- func GetResourceById(id string) (item *Resource, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := "SELECT * FROM resource WHERE id=? "
- err = o.Raw(sql, id).QueryRow(&item)
- return
- }
- type FileResourceResp struct {
- Id int64 `orm:"column(id);" description:"用户id"`
- ResourceUrl string `description:"资源地址"`
- ResourceName string `description:"资源名称"`
- PlaySeconds uint32 `description:"播放时长,单位秒"`
- }
|