identify.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package http
  2. import (
  3. "go-common/app/service/main/identify/api/grpc"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. // const (
  8. // _actionChangePWD = "changePwd"
  9. // _actionLoginOut = "loginOut"
  10. // )
  11. func accessCookie(c *bm.Context) {
  12. cookie := c.Request.Header.Get("Cookie")
  13. if cookie == "" {
  14. c.JSON(nil, ecode.NoLogin)
  15. return
  16. }
  17. res, err := srv.GetCookieInfo(c, cookie)
  18. if err == nil {
  19. c.Set("mid", res.Mid)
  20. }
  21. c.JSON(res, err)
  22. }
  23. func accessToken(c *bm.Context) {
  24. token := new(v1.GetTokenInfoReq)
  25. if err := c.Bind(token); err != nil {
  26. c.JSON(nil, ecode.NoLogin)
  27. return
  28. }
  29. res, err := srv.GetTokenInfo(c, token)
  30. if err == nil {
  31. c.Set("mid", res.Mid)
  32. }
  33. c.JSON(res, err)
  34. }
  35. func delCache(c *bm.Context) {
  36. // query := c.Request.Form
  37. // action := query.Get("modifiedAttr")
  38. // if action != _actionChangePWD && action != _actionLoginOut {
  39. // return
  40. // }
  41. // key := query.Get("access_token")
  42. // if key == "" {
  43. // key = query.Get("session")
  44. // }
  45. // if key == "" {
  46. // return
  47. // }
  48. c.JSON(nil, nil)
  49. }