token.api 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import "../base.api"
  2. type (
  3. // The data of token information | Token信息
  4. TokenInfo {
  5. BaseIDInfo
  6. // 过期时间
  7. ExpireAt *int64 `json:"expireAt,optional"`
  8. ExpireAtStr *string `json:"expireAtStr,optional"`
  9. // Token
  10. Token *string `json:"token,optional"`
  11. // Mac地址
  12. Mac *string `json:"mac,optional"`
  13. }
  14. // The response data of token list | Token列表数据
  15. TokenListResp {
  16. BaseDataInfo
  17. // Token list data | Token列表数据
  18. Data TokenListInfo `json:"data"`
  19. }
  20. // Token list data | Token列表数据
  21. TokenListInfo {
  22. BaseListInfo
  23. // The API list data | Token列表数据
  24. Data []TokenInfo `json:"data"`
  25. }
  26. // Get token list request params | Token列表请求参数
  27. TokenListReq {
  28. PageInfo
  29. // Token
  30. Token *string `json:"token,optional"`
  31. // Mac地址
  32. Mac *string `json:"mac,optional"`
  33. }
  34. // Token information response | Token信息返回体
  35. TokenInfoResp {
  36. BaseDataInfo
  37. // Token information | Token数据
  38. Data TokenInfo `json:"data"`
  39. }
  40. CheckTokenReq {
  41. // Token
  42. Token *string `json:"token"`
  43. // Mac地址
  44. Mac *string `json:"mac"`
  45. }
  46. CheckTokenResp {
  47. // 是否合法
  48. Valid *bool `json:"valid"`
  49. // Sign 签名内容
  50. Sign *string `json:"sign"`
  51. // Timestamp 时间戳
  52. Timestamp *int64 `json:"timestamp"`
  53. }
  54. )
  55. @server(
  56. group: token
  57. )
  58. service Wechat {
  59. // Check if token and mac are valid | 检查token和mac的合法性
  60. @handler checkToken
  61. post /token/check (CheckTokenReq) returns (CheckTokenResp)
  62. }
  63. @server(
  64. group: token
  65. jwt: Auth
  66. middleware: Authority
  67. )
  68. service Wechat {
  69. // Create token information | 创建Token
  70. @handler createToken
  71. post /token/third/create (TokenInfo) returns (BaseMsgResp)
  72. // Update token information | 更新Token
  73. @handler updateToken
  74. post /token/third/update (TokenInfo) returns (BaseMsgResp)
  75. // Delete token information | 删除Token信息
  76. @handler deleteToken
  77. post /token/third/delete (IDsReq) returns (BaseMsgResp)
  78. // Get token list | 获取Token列表
  79. @handler getTokenList
  80. post /token/third/list (TokenListReq) returns (TokenListResp)
  81. // Get token by ID | 通过ID获取Token
  82. @handler getTokenById
  83. post /token/third/detail (IDReq) returns (TokenInfoResp)
  84. }