|
|
@@ -1,36 +1,42 @@
|
|
|
package dao
|
|
|
|
|
|
import (
|
|
|
+ "fmt"
|
|
|
+ "iot_manager_service/util/common"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
type PublishLibraries struct {
|
|
|
- Id uint `gorm:"column:id;type:int(10) unsigned;primary_key;AUTO_INCREMENT;" json:"id"` // 编号
|
|
|
- Name string `gorm:"column:name;type:varchar(64)" json:"name"` // 名称
|
|
|
- Resolution int `gorm:"column:resolution;type:int(11)" json:"resolution"` // 分辨率
|
|
|
- Duration int64 `gorm:"column:duration;type:bigint(20);default:0" json:"duration"` // 统计文件时长
|
|
|
- FileSize int64 `gorm:"column:file_size;type:bigint(20);default:0" json:"file_size"` // 统计文件大小
|
|
|
- InfoId string `gorm:"column:info_id;type:varchar(4000)" json:"info_id"` // 信息屏ID 组合
|
|
|
- ImgDuration int `gorm:"column:img_duration;type:int(11);default:0" json:"img_duration"` // 图片播放时长(毫秒)
|
|
|
- StartTime time.Time `gorm:"column:start_time;type:date" json:"start_time"` // 播放开始时间
|
|
|
- EndTime time.Time `gorm:"column:end_time;type:date" json:"end_time"` // 播放结束时间
|
|
|
- NotificationType string `gorm:"column:notification_type;type:varchar(60)" json:"notification_type"` // 通知类型 组合1短信2邮件3电话4微信
|
|
|
- CreateTime time.Time `gorm:"column:create_time;type:datetime" json:"create_time"` // 新增时间
|
|
|
- CreateUser string `gorm:"column:create_user;type:varchar(60)" json:"create_user"` // 新增记录操作用户ID
|
|
|
- CreateName string `gorm:"column:create_name;type:varchar(64)" json:"create_name"` // 新增用户姓名
|
|
|
- UpdateTime time.Time `gorm:"column:update_time;type:datetime" json:"update_time"` // 修改时间
|
|
|
- UpdateUser string `gorm:"column:update_user;type:varchar(60)" json:"update_user"` // 修改用户
|
|
|
- IsDeleted int `gorm:"column:is_deleted;type:int(11);default:0" json:"is_deleted"` // 是否删除 0=未删除,1=删除
|
|
|
- Status int `gorm:"column:status;type:int(11)" json:"status"` // 状态 0审核1播放2暂停3取消4过期5审核不通过
|
|
|
- TenantId int `gorm:"column:tenant_id;type:int(11)" json:"tenant_id"` // 租户ID
|
|
|
- Remarks string `gorm:"column:remarks;type:varchar(4000)" json:"remarks"` // 备注
|
|
|
- SysType int `gorm:"column:sys_type;type:int(11);default:0" json:"sys_type"` // 系统类型:0-多媒体系统,1-广播系统
|
|
|
- KsTime time.Time `gorm:"column:ks_time;type:bigint(20)" json:"ks_time"` // 播放开始时间
|
|
|
- JsTime time.Time `gorm:"column:js_time;type:bigint(20)" json:"js_time"` // 播放结束时间
|
|
|
- FileId int `gorm:"column:file_id;type:int(11)" json:"file_id"` // 文件ID,系统类型为广播系统时使用
|
|
|
- TaskId int `gorm:"column:task_id;type:int(11)" json:"task_id"` // 任务ID,发布后才有用于控制启动与停止
|
|
|
- PlayTime int `gorm:"column:play_time;type:int(11);default:1" json:"play_time"` // 播放次数(1-100)
|
|
|
- PlayInterval int `gorm:"column:play_interval;type:int(11);default:0" json:"play_interval"` // 播放间隔(0-360秒)
|
|
|
+ ID int64 `gorm:"column:id;type:int(10) unsigned;primary_key;AUTO_INCREMENT;comment:编号" json:"id" :"ID"` // 编号
|
|
|
+ Name string `gorm:"column:name;type:varchar(64);comment:名称" json:"name" :"Name"` // 名称
|
|
|
+ Resolution int `gorm:"column:resolution;type:int(11);comment:分辨率" json:"resolution" :"Resolution"` // 分辨率
|
|
|
+ Duration int64 `gorm:"column:duration;type:bigint(20);default:0;comment:统计文件时长" json:"duration" :"Duration"` // 统计文件时长
|
|
|
+ FileSize int64 `gorm:"column:file_size;type:bigint(20);default:0;comment:统计文件大小" json:"fileSize" :"FileSize"` // 统计文件大小
|
|
|
+ InfoId string `gorm:"column:info_id;type:varchar(4000);comment:信息屏ID 组合" json:"infoId" :"InfoId"` // 信息屏ID 组合
|
|
|
+ ImgDuration int `gorm:"column:img_duration;type:int(11);default:0;comment:图片播放时长(毫秒)" json:"imgDuration" :"ImgDuration"` // 图片播放时长(毫秒)
|
|
|
+ StartTime common.Time `gorm:"column:start_time;type:date;comment:播放开始时间" json:"startTime" :"StartTime"` // 播放开始时间
|
|
|
+ EndTime common.Time `gorm:"column:end_time;type:date;comment:播放结束时间" json:"endTime" :"EndTime"` // 播放结束时间
|
|
|
+ NotificationType string `gorm:"column:notification_type;type:varchar(60);comment:通知类型 组合1短信2邮件3电话4微信" json:"notificationType" :"NotificationType"` // 通知类型 组合1短信2邮件3电话4微信
|
|
|
+ CreateTime time.Time `gorm:"column:create_time;type:datetime;comment:新增时间" json:"createTime" :"CreateTime"` // 新增时间
|
|
|
+ CreateUser int64 `gorm:"column:create_user;type:varchar(60);comment:增记录操作用户ID" json:"createUser" :"CreateUser"` // 新增记录操作用户ID
|
|
|
+ CreateName string `gorm:"column:create_name;type:varchar(64);comment:新增用户姓名" json:"createName" :"CreateName"` // 新增用户姓名
|
|
|
+ UpdateTime time.Time `gorm:"column:update_time;type:datetime;comment:修改时间" json:"updateTime" :"UpdateTime"` // 修改时间
|
|
|
+ UpdateUser string `gorm:"column:update_user;type:varchar(60);comment:修改用户" json:"updateUser" :"UpdateUser"` // 修改用户
|
|
|
+ IsDeleted int `gorm:"column:is_deleted;type:int(11);default:0;comment:是否删除 0=未删除,1=删除" json:"isDeleted" :"IsDeleted"` // 是否删除 0=未删除,1=删除
|
|
|
+ Status int `gorm:"column:status;type:int(11);comment:状态 0审核1播放2暂停3取消4过期5审核不通过" json:"status" :"Status"` // 状态 0审核1播放2暂停3取消4过期5审核不通过
|
|
|
+ TenantId int `gorm:"column:tenant_id;type:int(11);comment:租户ID" json:"tenantTd" :"TenantId"` // 租户ID
|
|
|
+ Remarks string `gorm:"column:remarks;type:varchar(4000);comment:系统类型:0-多媒体系统,1-广播系统" json:"remarks" :"Remarks"` // 备注
|
|
|
+ SysType int `gorm:"column:sys_type;type:int(11);default:0;comment:编号" json:"sysStype" :"SysType"` // 系统类型:0-多媒体系统,1-广播系统
|
|
|
+ KsTime string `gorm:"column:ks_time;type:varchar(50);comment:播放开始时间" json:"ksTime" :"KsTime"` // 播放开始时间
|
|
|
+ JsTime string `gorm:"column:js_time;type:varchar(50);comment:播放结束时间" json:"jsTime" :"JsTime"` // 播放结束时间
|
|
|
+ FileId int `gorm:"column:file_id;type:int(11);comment:文件ID,系统类型为广播系统时使用" json:"fileId" :"FileId"` // 文件ID,系统类型为广播系统时使用
|
|
|
+ TaskId int `gorm:"column:task_id;type:int(11);comment:任务ID,发布后才有用于控制启动与停止" json:"taskId" :"TaskId"` // 任务ID,发布后才有用于控制启动与停止
|
|
|
+ PlayTime int `gorm:"column:play_time;type:int(11);default:1;comment:播放次数(1-100)" json:"playTime" :"PlayTime"` // 播放次数(1-100)
|
|
|
+ PlayInterval int `gorm:"column:play_interval;type:int(11);default:0;comment: 播放间隔(0-360秒)" json:"playInterval" :"PlayInterval"` // 播放间隔(0-360秒)
|
|
|
+
|
|
|
+ PlayPeriod string `gorm:"-" json:"playPeriod"` //播放期间
|
|
|
+ ResolutionName string `gorm:"-" json:"resolutionName"` //分辨率
|
|
|
+ CountDeviceNum int `gorm:"-;default:0" json:"countDeviceNum"` //关联设备数量
|
|
|
}
|
|
|
|
|
|
func (PublishLibraries) TableName() string {
|
|
|
@@ -39,6 +45,21 @@ func (PublishLibraries) TableName() string {
|
|
|
|
|
|
func (c *PublishLibraries) GetList(offset int, limit int) ([]PublishLibraries, error) {
|
|
|
var list []PublishLibraries
|
|
|
- err := Db.Debug().Model(&c).Where("tenant_id = ? and is_deleted = 0", c.TenantId).Find(&list).Error
|
|
|
+ err := Db.Debug().Model(&c).Where("tenant_id = ? and sys_type=? and is_deleted = 0", c.TenantId, c.SysType).Find(&list).Error
|
|
|
return list, err
|
|
|
}
|
|
|
+
|
|
|
+func (c *PublishLibraries) Create() error {
|
|
|
+ fmt.Printf("c = %v", c)
|
|
|
+ return Db.Debug().Model(&c).Save(c).Error
|
|
|
+}
|
|
|
+
|
|
|
+func (c *PublishLibraries) Update() error {
|
|
|
+ return Db.Debug().Model(&c).Where(" id = ? ", c.ID).Updates(&c).Error
|
|
|
+}
|
|
|
+
|
|
|
+func (c *PublishLibraries) GetProgram() (int, error) {
|
|
|
+ var librarie PublishLibraries
|
|
|
+ err := Db.Debug().Model(&c).Where("id = ?", c.ID).First(&librarie).Error
|
|
|
+ return librarie.FileId, err
|
|
|
+}
|