reply.go 844 B

123456789101112131415161718192021222324252627282930313233343536
  1. package reply
  2. import (
  3. "context"
  4. "errors"
  5. "net/url"
  6. "strconv"
  7. "go-common/library/log"
  8. )
  9. const (
  10. _changeSubjectMid = "/x/internal/v2/reply/subject/mid"
  11. )
  12. // ChangeSubjectMid change av's owner
  13. func (d *Dao) ChangeSubjectMid(oid, mid int64) (err error) {
  14. params := url.Values{}
  15. params.Set("adid", "0")
  16. params.Set("oid", strconv.FormatInt(oid, 10))
  17. params.Set("type", "1")
  18. params.Set("mid", strconv.FormatInt(mid, 10))
  19. var res struct {
  20. Code int64 `json:"code"`
  21. }
  22. if err = d.client.Post(context.TODO(), d.changeSubMid, "", params, &res); err != nil {
  23. log.Error("d.client.Post(%s) error(%v)", d.changeSubMid+"?"+params.Encode(), err)
  24. return
  25. }
  26. if res.Code != 0 {
  27. err = errors.New(strconv.FormatInt(res.Code, 10))
  28. log.Error("d.client.Post(%s) code(%v)", d.changeSubMid+"?"+params.Encode(), res.Code)
  29. return
  30. }
  31. return
  32. }