go-common/app/job/main/videoup/dao/archive/video_shot.go

24 lines
553 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package archive
import (
"context"
"time"
"go-common/library/log"
)
const (
_inVideoShotSQL = "INSERT INTO archive_video_shot (id,count,ctime,mtime) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE count=?,mtime=? "
)
// AddVideoShot add a videoshot into mysql.
func (d *Dao) AddVideoShot(c context.Context, cid int64, count int) (rows int64, err error) {
var now = time.Now()
res, err := d.db.Exec(c, _inVideoShotSQL, cid, count, now, now, count, now)
if err != nil {
log.Error("d.db.Exec error(%v)", err)
return
}
return res.RowsAffected()
}