task_qa.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package dao
  2. import (
  3. "context"
  4. "time"
  5. "go-common/app/admin/main/videoup-task/model"
  6. "go-common/library/database/sql"
  7. )
  8. const (
  9. _inTaskQA = "INSERT INTO task_qa(state,type,detail_id,uid,ctime,mtime) VALUES(?,?,?,?,?,?)"
  10. _upTaskQA = "UPDATE task_qa SET state=?, ftime=?, mtime=? WHERE id=?"
  11. )
  12. //InTaskQA insert a qa task
  13. func (d *Dao) InTaskQA(tx *sql.Tx, uid int64, detailID int64, taskType int8) (id int64, err error) {
  14. now := time.Now()
  15. res, err := tx.Exec(_inTaskQA, model.QAStateWait, taskType, detailID, uid, now, now)
  16. if err != nil {
  17. PromeErr("arcdb: insert", "InTaskQA tx.Exe error(%v) uid(%d) detailid(%d)", err, uid, detailID)
  18. return
  19. }
  20. id, err = res.LastInsertId()
  21. return
  22. }
  23. //UpTask update qa task
  24. func (d *Dao) UpTask(ctx context.Context, id int64, state int16, ftime time.Time) (rows int64, err error) {
  25. res, err := d.arcDB.Exec(ctx, _upTaskQA, state, ftime, ftime, id)
  26. if err != nil {
  27. PromeErr("arcdb: update", "UpTask d.arcDB.Exec error(%v) id(%d) state(%d)", err, id, state)
  28. return
  29. }
  30. rows, err = res.RowsAffected()
  31. return
  32. }