account.go 937 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package http
  2. import (
  3. "strconv"
  4. "go-common/app/service/main/passport-game/model"
  5. "go-common/library/ecode"
  6. "go-common/library/log"
  7. bm "go-common/library/net/http/blademaster"
  8. )
  9. func myInfo(c *bm.Context) {
  10. var (
  11. err error
  12. params = c.Request.Form
  13. accessKey = params.Get("access_key")
  14. )
  15. if accessKey == "" {
  16. c.JSON(nil, ecode.RequestErr)
  17. return
  18. }
  19. app, ok := c.Get("app")
  20. if !ok {
  21. c.JSON(nil, ecode.AppKeyInvalid)
  22. return
  23. }
  24. info, err := srv.MyInfo(c, app.(*model.App), accessKey)
  25. if err != nil {
  26. log.Error("service.MyInfo(%s) error(%v)", accessKey, err)
  27. c.JSON(nil, err)
  28. return
  29. }
  30. c.JSON(info, nil)
  31. }
  32. func info(c *bm.Context) {
  33. var (
  34. err error
  35. midStr = c.Request.Form.Get("mid")
  36. )
  37. if midStr == "" {
  38. c.JSON(nil, ecode.RequestErr)
  39. return
  40. }
  41. mid, err := strconv.ParseInt(midStr, 10, 64)
  42. if err != nil {
  43. c.JSON(nil, ecode.RequestErr)
  44. return
  45. }
  46. c.JSON(srv.Info(c, mid), nil)
  47. }