diff --git a/plugin/mp4/api.go b/plugin/mp4/api.go index 75fd8857..258f24cc 100644 --- a/plugin/mp4/api.go +++ b/plugin/mp4/api.go @@ -41,9 +41,9 @@ func (p *MP4Plugin) List(ctx context.Context, req *pb.ReqRecordList) (resp *pb.R var totalCount int64 //总条数 // 查询总记录数 - countQuery := p.DB.Model(m7s.RecordStream{}) + countQuery := p.DB.Model(&m7s.RecordStream{}) // 查询当前页的数据 - query := p.DB.Model(m7s.RecordStream{}) + query := p.DB.Model(&m7s.RecordStream{}) if req.PageSize > 0 { query = query.Limit(int(req.PageSize)).Offset(int(offset)) } diff --git a/plugin/mp4/index.go b/plugin/mp4/index.go index 8783b44b..dbc93116 100644 --- a/plugin/mp4/index.go +++ b/plugin/mp4/index.go @@ -93,6 +93,7 @@ func (p *MP4Plugin) RegisterHandler() map[string]http.HandlerFunc { func (p *MP4Plugin) OnInit() (err error) { if p.DB != nil { err = p.DB.AutoMigrate(&Exception{}) + p.DB.AutoMigrate(&m7s.RecordStream{}) var deleteRecordTask DeleteRecordTask deleteRecordTask.DB = p.DB deleteRecordTask.DiskMaxPercent = p.DiskMaxPercent