assist.go 992 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package danmu
  2. import (
  3. "context"
  4. "net/url"
  5. "strconv"
  6. "go-common/library/ecode"
  7. "go-common/library/log"
  8. )
  9. const (
  10. // api
  11. _setDmBannedURI = "/x/internal/dm/assist/banned/upt"
  12. )
  13. // ResetUpBanned pool 0:cancel move,1:cancel ignore
  14. func (d *Dao) ResetUpBanned(c context.Context, mid int64, state int8, hash, ip string) (err error) {
  15. params := url.Values{}
  16. params.Set("mid", strconv.FormatInt(mid, 10))
  17. params.Set("hash", hash)
  18. params.Set("stat", strconv.FormatInt(mid, 10)) //0:撤销添加屏蔽,1:撤销删除屏蔽
  19. var res struct {
  20. Code int `json:"code"`
  21. }
  22. if err = d.client.Post(c, d.assistDmBannedURL, ip, params, &res); err != nil {
  23. err = ecode.CreativeDanmuErr
  24. log.Error("d.SetDmStat.Post(%s,%s,%s) err(%v)", d.assistDmBannedURL, ip, params.Encode(), err)
  25. return
  26. }
  27. if res.Code != 0 {
  28. err = ecode.Int(res.Code)
  29. log.Error("d.SetDmStat.Post(%s,%s,%s) err(%v)|code(%d)", d.assistDmBannedURL, ip, params.Encode(), err, res.Code)
  30. return
  31. }
  32. return
  33. }