video_history.go 954 B

123456789101112131415161718192021222324252627282930313233
  1. package archive
  2. import (
  3. "context"
  4. "go-common/app/admin/main/videoup/model/archive"
  5. "go-common/library/log"
  6. )
  7. const (
  8. _vhistoryByHIDSQL = "SELECT `id`, `cid`, `eptitle`, `description`, `filename`, `ctime` FROM `archive_video_edit_history` WHERE `hid`=? ORDER BY `id` ASC;"
  9. )
  10. //VideoHistoryByHID 根据稿件编辑历史id, 获取当时视频的用户编辑历史
  11. func (d *Dao) VideoHistoryByHID(c context.Context, hid int64) (hs []*archive.VideoHistory, err error) {
  12. hs = []*archive.VideoHistory{}
  13. rows, err := d.db.Query(c, _vhistoryByHIDSQL, hid)
  14. if err != nil {
  15. log.Error("VideoHistoryByHID d.db.Query(hid(%d)) error(%v)", hid, err)
  16. return
  17. }
  18. defer rows.Close()
  19. for rows.Next() {
  20. h := &archive.VideoHistory{}
  21. if err = rows.Scan(&h.ID, &h.CID, &h.EpTitle, &h.Description, &h.Filename, &h.CTime); err != nil {
  22. log.Error("VideoHistoryByHID rows.Scan(hid(%d)) error(%v)", hid, err)
  23. return
  24. }
  25. hs = append(hs, h)
  26. }
  27. return
  28. }