video_shot.go 553 B

1234567891011121314151617181920212223
  1. package archive
  2. import (
  3. "context"
  4. "time"
  5. "go-common/library/log"
  6. )
  7. const (
  8. _inVideoShotSQL = "INSERT INTO archive_video_shot (id,count,ctime,mtime) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE count=?,mtime=? "
  9. )
  10. // AddVideoShot add a videoshot into mysql.
  11. func (d *Dao) AddVideoShot(c context.Context, cid int64, count int) (rows int64, err error) {
  12. var now = time.Now()
  13. res, err := d.db.Exec(c, _inVideoShotSQL, cid, count, now, now, count, now)
  14. if err != nil {
  15. log.Error("d.db.Exec error(%v)", err)
  16. return
  17. }
  18. return res.RowsAffected()
  19. }