i2bill.api 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. NickName string `json:"nickName"`
  22. AvatarUrl string `json:"avatarUrl"`
  23. Gender int64 `json:"gender"`
  24. Country string `json:"country"`
  25. Province string `json:"province"`
  26. City string `json:"city"`
  27. UnionID string `json:"unionId,omitempty"`
  28. Language string `json:"language"`
  29. Watermark Watermark `json:"watermark,omitempty"`
  30. }
  31. type ResUserInfo {
  32. UserInfo WXUserInfo `json:"userInfo"`
  33. RawData string `json:"rawData"`
  34. Signature string `json:"signature"`
  35. EncryptedData string `json:"encryptedData"`
  36. IV string `json:"iv"`
  37. }
  38. type authLoginBody {
  39. Code string `json:"code"`
  40. // UserInfo ResUserInfo `json:"userInfo"`
  41. }
  42. type AuthUserInfo {
  43. ID int64 `json:"id"`
  44. Mobile string `json:"mobile"`
  45. ErpRoles string `json:"erpRoles"`
  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 authResponse {
  53. Token string `json:"token"`
  54. UserInfo AuthUserInfo `json:"userInfo"`
  55. }
  56. type request {
  57. // TODO: add members here and delete this comment
  58. Id int64 `form:"id"`
  59. }
  60. type response {
  61. // TODO: add members here and delete this comment
  62. Id int64 `json:"id"`
  63. }
  64. type partTimeUserAddRequest {
  65. Name string `json:"name"`
  66. IponeNumber string `json:"ipone_number"`
  67. Sex int64 `json:"sex"`
  68. MkId string `json:"mk_id"`
  69. CityId int64 `json:"city_id"` // 城市
  70. }
  71. service i2bill-api {
  72. @handler Hello // TODO
  73. get /api/hello
  74. @handler LoginByWeixin // TODO
  75. post /api/auth/loginByWeixin(authLoginBody) returns(authResponse)
  76. }
  77. @server(
  78. jwt: JwtAuth
  79. )
  80. service i2bill-api {
  81. @handler GetUser // TODO: set handler name and delete this comment
  82. get /api/users/id/:userId(request) returns(response)
  83. @handler PartTimeUserAd
  84. post /api/v1/part_time_user/add (partTimeUserAddRequest) returns(response)
  85. }