i2bill.api 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. CityName string `json:"cityname"`
  79. NickName string `json:"nickname"`
  80. Gender int64 `json:"gender"`
  81. Avatar string `json:"avatar"`
  82. Birthday int64 `json:"birthday"`
  83. ErpRoleType int64 `json:"erpRoleType"`
  84. }
  85. type punchClockRequest {
  86. Lat string `json:"lat"`
  87. Address string `json:"address"`
  88. Type int64 `json:"type"`
  89. }
  90. type enrollRequest {
  91. Scene string `json:"scene"`
  92. Name string `json:"name"`
  93. Sex int64 `json:"sex"`
  94. IponeNumber string `json:"ipone_number"`
  95. Target int64 `json:"target"`
  96. }
  97. type Response {
  98. Code int `json:"code"`
  99. Msg string `json:"msg"`
  100. Data interface{} `json:"data"`
  101. }
  102. // 认证模块
  103. @server(
  104. group: auth
  105. )
  106. service i2bill-api {
  107. @handler Hello
  108. get /api/hello
  109. @handler LoginByWeixin
  110. post /api/auth/loginByWeixin(loginByWeixinRequest) returns(loginByWeixinResponse)
  111. }
  112. // 用户模块
  113. @server(
  114. jwt: JwtAuth
  115. group: user
  116. )
  117. service i2bill-api {
  118. @handler JzQrCode
  119. get /api/user/share/jzQrcode returns(jzQrcodeResponse)
  120. @handler BindMobile
  121. post /api/user/bindMobile(bindMobileRequest) returns(bindMobileResponse)
  122. @handler GetUser
  123. get /api/user/info returns(infoResponse)
  124. @handler PunchClock
  125. post /api/user/punchClock(punchClockRequest) returns(Response)
  126. }
  127. // 兼职模块
  128. @server(
  129. jwt: JwtAuth
  130. group: part_time_user
  131. )
  132. service i2bill-api {
  133. @handler PartTimeUserAdd
  134. post /api/v1/part_time_user/add (partTimeUserAddRequest) returns(Response)
  135. @handler PartTimeUserUpdate
  136. post /api/v1/part_time_user/update (partTimeUserAddRequest) returns(Response)
  137. @handler PartTimeUserGet
  138. get /api/v1/part_time_user/get returns(Response)
  139. }
  140. // 收单模块
  141. @server(
  142. jwt: JwtAuth
  143. group: acquirer
  144. )
  145. service i2bill-api {
  146. @handler Enroll
  147. post /api/acquirer/enroll(enrollRequest) returns(Response)
  148. }