account.go 759 B

123456789101112131415161718192021222324252627282930313233
  1. package dao
  2. import (
  3. "context"
  4. "fmt"
  5. "net/url"
  6. "go-common/library/log"
  7. )
  8. // BlockAccount block account
  9. func (d *Dao) BlockAccount(c context.Context, mid int64, reason string) (err error) {
  10. params := url.Values{}
  11. params.Set("mid", fmt.Sprintf("%d", mid))
  12. params.Set("admin_reason", reason)
  13. params.Set("blockType", "6")
  14. params.Set("operator", "anticheat")
  15. params.Set("type", "json")
  16. var resp struct {
  17. Code int64 `json:"code"`
  18. }
  19. // get
  20. if err = d.httpClient.Get(c, d.c.Property.BlockAccountURL, "", params, &resp); err != nil {
  21. log.Error("httpClient.Do() error(%v)", err)
  22. return
  23. }
  24. if resp.Code != 0 {
  25. err = fmt.Errorf("GET block account url resp(%v)", resp)
  26. return
  27. }
  28. log.Info("account user(%d) block suc(%v)", mid, resp)
  29. return
  30. }