i2bill.api 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. syntax = "v1"
  2. info(
  3. title: // TODO: add title
  4. desc: // TODO: add description
  5. author: "double.huang"
  6. email: "2637309949@qq.com"
  7. )
  8. type WXLoginResponse {
  9. OpenID string `json:"openid"`
  10. SessionKey string `json:"session_key"`
  11. UnionID string `json:"unionid"`
  12. ErrCode int `json:"errcode"`
  13. ErrMsg string `json:"errmsg"`
  14. }
  15. type Watermark {
  16. AppID string `json:"appid"`
  17. TimeStamp int64 `json:"timestamp"`
  18. }
  19. type WXUserInfo {
  20. OpenID string `json:"openId,omitempty"`
  21. SessionKey string `json:"SessionKey"`
  22. NickName string `json:"nickName"`
  23. AvatarUrl string `json:"avatarUrl"`
  24. Gender int64 `json:"gender"`
  25. Country string `json:"country"`
  26. Province string `json:"province"`
  27. City string `json:"city"`
  28. UnionID string `json:"unionId,omitempty"`
  29. Language string `json:"language"`
  30. Watermark Watermark `json:"watermark,omitempty"`
  31. }
  32. type ResUserInfo {
  33. UserInfo WXUserInfo `json:"userInfo"`
  34. RawData string `json:"rawData"`
  35. Signature string `json:"signature"`
  36. EncryptedData string `json:"encryptedData"`
  37. IV string `json:"iv"`
  38. }
  39. type loginByWeixinRequest {
  40. Code string `json:"code"`
  41. // UserInfo ResUserInfo `json:"userInfo"`
  42. }
  43. type AuthUserInfo {
  44. ID int64 `json:"id"`
  45. Mobile string `json:"mobile"`
  46. UserName string `json:"username"`
  47. NickName string `json:"nickname"`
  48. Gender int64 `json:"gender"`
  49. Avatar string `json:"avatar"`
  50. Birthday int64 `json:"birthday"`
  51. }
  52. type loginByWeixinResponse {
  53. Token string `json:"token"`
  54. UserInfo AuthUserInfo `json:"userInfo"`
  55. }
  56. type jzQrcodeResponse {
  57. Id int64 `json:"id"`
  58. FileId string `json:"fileId"`
  59. }
  60. type bindMobileRequest {
  61. Iv string `json:"iv"`
  62. EncryptedData string `json:"encryptedData"`
  63. }
  64. type bindMobileResponse {
  65. Id int64 `json:"id"`
  66. }
  67. type infoResponse {
  68. ID int64 `json:"id"`
  69. Mobile string `json:"mobile"`
  70. UserName string `json:"username"`
  71. NickName string `json:"nickname"`
  72. Gender int64 `json:"gender"`
  73. Avatar string `json:"avatar"`
  74. Birthday int64 `json:"birthday"`
  75. IsJzMem bool `json:"isJzMem"`
  76. IsJzMk bool `json:"isJzMk"`
  77. }
  78. service i2bill-api {
  79. @handler Hello
  80. get /api/hello
  81. @handler LoginByWeixin
  82. post /api/auth/loginByWeixin(loginByWeixinRequest) returns(loginByWeixinResponse)
  83. }
  84. @server(
  85. jwt: JwtAuth
  86. )
  87. service i2bill-api {
  88. @handler JzQrCode
  89. get /api/user/share/jzQrcode returns(jzQrcodeResponse)
  90. @handler BindMobile
  91. post /api/user/bindMobile(bindMobileRequest) returns(bindMobileResponse)
  92. @handler GetUser
  93. get /api/user/info returns(infoResponse)
  94. }