notify.go 677 B

12345678910111213141516171819202122232425262728
  1. package dao
  2. import (
  3. "context"
  4. "fmt"
  5. "go-common/library/log"
  6. )
  7. const (
  8. _setOriginStreamingStatus = "UPDATE `sv_ls_stream` SET `up_rank` = ? where `room_id` = ? and `src` = ? and `up_rank` = ? LIMIT 1;"
  9. )
  10. // SetOriginStreamingStatus 用于设置 老版本数据结构的 推流状态
  11. func (d *Dao) SetOriginStreamingStatus(c context.Context, rid int64, src, from, to int) error {
  12. res, err := d.stmtLegacyStreamNotify.Exec(c, to, rid, src, from)
  13. if err != nil {
  14. return err
  15. }
  16. er, err := res.RowsAffected()
  17. if err != nil {
  18. return err
  19. }
  20. if er == 0 {
  21. log.Infow(c, "no_record_updated", fmt.Sprintf("%d_%d_%d_%d", rid, src, from, to))
  22. return nil
  23. }
  24. return err
  25. }