i2bill.api 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 partTimeUserAddRequest {
  68. Name string `json:"name"`
  69. IponeNumber string `json:"ipone_number"`
  70. Sex int64 `json:"sex"`
  71. MkId string `json:"mk_id"`
  72. CityId int64 `json:"city_id"` // 城市
  73. }
  74. type infoResponse {
  75. ID int64 `json:"id"`
  76. Mobile string `json:"mobile"`
  77. UserName string `json:"username"`
  78. NickName string `json:"nickname"`
  79. Gender int64 `json:"gender"`
  80. Avatar string `json:"avatar"`
  81. Birthday int64 `json:"birthday"`
  82. ErpRoleType int64 `json:"erpRoleType"`
  83. }
  84. type Response {
  85. Code int `json:"code"`
  86. Msg string `json:"msg"`
  87. Data interface{} `json:"data"`
  88. }
  89. service i2bill-api {
  90. @handler Hello
  91. get /api/hello
  92. @handler LoginByWeixin
  93. post /api/auth/loginByWeixin(loginByWeixinRequest) returns(loginByWeixinResponse)
  94. }
  95. @server(
  96. jwt: JwtAuth
  97. )
  98. service i2bill-api {
  99. @handler JzQrCode
  100. get /api/user/share/jzQrcode returns(jzQrcodeResponse)
  101. @handler BindMobile
  102. post /api/user/bindMobile(bindMobileRequest) returns(bindMobileResponse)
  103. @handler GetUser
  104. get /api/user/info returns(infoResponse)
  105. @handler PartTimeUserAdd
  106. post /api/v1/part_time_user/add (partTimeUserAddRequest) returns(Response)
  107. @handler PartTimeUserUpdate
  108. post /api/v1/part_time_user/update (partTimeUserAddRequest) returns(Response)
  109. }