forbid.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package archive
  2. import (
  3. "go-common/app/service/main/videoup/model/archive"
  4. xsql "go-common/library/database/sql"
  5. "go-common/library/log"
  6. )
  7. const (
  8. _upFlowIDSQL = "INSERT INTO archive_forbid (aid,on_flow_id) VALUES (?,?) ON DUPLICATE KEY UPDATE on_flow_id=?"
  9. _inForbidSQL = `INSERT INTO archive_forbid (aid,rank_attr,recommend_attr,dynamic_attr,show_attr) VALUES (?,?,?,?,?) ON DUPLICATE KEY UPDATE
  10. rank_attr=?,recommend_attr=?,dynamic_attr=?,show_attr=?`
  11. )
  12. // TxUpForbid update archive addit.
  13. func (d *Dao) TxUpForbid(tx *xsql.Tx, aid, flowID int64) (rows int64, err error) {
  14. res, err := tx.Exec(_upFlowIDSQL, aid, flowID, flowID)
  15. if err != nil {
  16. log.Error("d.upFlowID.Exec() error(%v)", err)
  17. return
  18. }
  19. rows, err = res.RowsAffected()
  20. return
  21. }
  22. // TxUpForbidAttr insert archive forbid.
  23. func (d *Dao) TxUpForbidAttr(tx *xsql.Tx, af *archive.ForbidAttr) (rows int64, err error) {
  24. res, err := tx.Exec(_inForbidSQL, af.Aid, af.RankV, af.RecommendV, af.DynamicV, af.ShowV, af.RankV, af.RecommendV, af.DynamicV, af.ShowV)
  25. if err != nil {
  26. log.Error("d.inForbid.Exec error(%v)", err)
  27. return
  28. }
  29. rows, err = res.RowsAffected()
  30. return
  31. }