/** * @Author: ZhaoYadong * @Date: 2021-12-13 14:28:49 * @LastEditors: ZhaoYadong * @LastEditTime: 2022-01-18 17:57:50 * @FilePath: /src/git.buka.tv/cloud-disk/internal/models/file.go */ package models import ( "git.apinb.com/bsm-sdk/core/database" "git.apinb.com/bsm-sdk/core/types" "gorm.io/gorm" ) type ContentType int32 const ( CONTENT_TYPE_TEXT ContentType = iota + 1 // 1.文本 CONTENT_TYPE_IMAGE // 2.图片 CONTENT_TYPE_VIDEO // 3.视频 CONTENT_TYPE_AUDIO // 4.音频 CONTENT_TYPE_LINK // 5.连接 CONTENT_TYPE_ATTACHMENT // 6.附件 ) type AdsItem struct { gorm.Model Title string `gorm:"column:title;type:varchar(255);not null;" json:"title"` // 广告名称 PosKey string `gorm:"column:pos_key;type:varchar(255);not null;" json:"pos_key"` // 广告位key Content string `gorm:"column:content;type:varchar(255);default:'';" json:"content"` // 广告内容 Type ContentType `gorm:"column:type;default:0;" json:"type"` // 广告类型 ToUrl string `gorm:"column:to_url;type:varchar(255);default:'';" json:"to_url"` types.Std_Status } func init() { database.AppendMigrate(&AdsItem{}) } // TableName . func (table *AdsItem) TableName() string { return "ads_item" //对应数据库表名 }