audit.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package audit
  2. import (
  3. "context"
  4. xtime "time"
  5. "go-common/app/interface/main/tv/model"
  6. xsql "go-common/library/database/sql"
  7. "go-common/library/time"
  8. )
  9. const (
  10. _updateCont = "UPDATE `tv_content` SET `state` = ?, `valid` = ?, `reason` = ?, `inject_time` = ? WHERE `epid` = ? AND `is_deleted` = 0"
  11. _updateSea = "UPDATE `tv_ep_season` SET `check` = ?, `valid` = ?, `reason` = ?, `inject_time` = ? WHERE `id` = ? AND `is_deleted` = 0"
  12. _updateVideo = "UPDATE `ugc_video` SET `result` = ?, `valid` = ?, `reason` = ? , `inject_time` = ? WHERE `cid` = ? AND `deleted` = 0"
  13. _updateArc = "UPDATE `ugc_archive` SET `result` = ?, `valid` = ?, `reason` = ?, `inject_time` = ? WHERE `aid` = ? AND `deleted` = 0"
  14. )
  15. // BeginTran def.
  16. func (d *Dao) BeginTran(c context.Context) (tx *xsql.Tx, err error) {
  17. return d.db.Begin(c)
  18. }
  19. // UpdateVideo .
  20. func (d *Dao) UpdateVideo(c context.Context, v *model.AuditOp, tx *xsql.Tx) (err error) {
  21. now := time.Time(xtime.Now().Unix())
  22. _, err = tx.Exec(_updateVideo, v.Result, v.Valid, v.AuditMsg, now, v.KID)
  23. return
  24. }
  25. // UpdateArc .
  26. func (d *Dao) UpdateArc(c context.Context, v *model.AuditOp, tx *xsql.Tx) (err error) {
  27. now := time.Time(xtime.Now().Unix())
  28. _, err = tx.Exec(_updateArc, v.Result, v.Valid, v.AuditMsg, now, v.KID)
  29. return
  30. }
  31. // UpdateCont .
  32. func (d *Dao) UpdateCont(c context.Context, val *model.AuditOp, tx *xsql.Tx) (err error) {
  33. now := time.Time(xtime.Now().Unix())
  34. _, err = tx.Exec(_updateCont, val.Result, val.Valid, val.AuditMsg, now, val.KID)
  35. return
  36. }
  37. // UpdateSea .
  38. func (d *Dao) UpdateSea(c context.Context, val *model.AuditOp, tx *xsql.Tx) (err error) {
  39. now := time.Time(xtime.Now().Unix())
  40. _, err = tx.Exec(_updateSea, val.Result, val.Valid, val.AuditMsg, now, val.KID)
  41. return
  42. }