im.proto 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. syntax = "proto3";
  2. option go_package =".;im";
  3. package im;
  4. enum ErrorCode{
  5. OK = 0;
  6. PARAM = 4001;
  7. Exist = 4002;
  8. }
  9. // metadata: 综合管理系统前端调用需要字段 token 用作登录验证;子系统调用需要字段 sys_token 用作系统验证
  10. service Api {
  11. rpc SignUpUserCode (SignUpRequest) returns (SignUpReply) {}
  12. rpc SignUpPhone (SignUpRequest) returns (SignUpReply) {}
  13. rpc SignInUserCode (SignInPasswordRequest) returns (TokenParam) {}
  14. rpc SignInWithPhonePassword (SignInPasswordRequest) returns (TokenParam) {}
  15. // ---子系统专用---
  16. // 检查token有效性
  17. rpc SubSessionCheck (TokenParam) returns (SessionCheckReply) {}
  18. // 检查token所属用户是否拥有调用service权限
  19. rpc SubPermissionCheck (PermissionCheck) returns (SessionCheckReply) {}
  20. // 登出传入token
  21. rpc SubSignOut (TokenParam) returns (DefaultReply) {}
  22. // 批量保存service
  23. rpc SubServiceSaveList (SaveServiceListRequest) returns (DefaultReply) {}
  24. // ---子系统专用---
  25. // 用户列表
  26. rpc UserList (UserListRequest) returns (UserListReply) {}
  27. // 单个用户信息详情
  28. rpc UserGetInfo (UserGetInfoRequest) returns (UserInfo) {}
  29. // 用户添加多个角色
  30. rpc UserAddRoles(UserRolesRequest) returns (DefaultReply) {}
  31. // 用户移除多个角色
  32. rpc UserRemoveRoles(UserRolesRequest) returns (DefaultReply) {}
  33. // 用户获取栏目列表
  34. rpc UserGetColumnList(UserGetColumnListRequest) returns (UserGetColumnListReply) {}
  35. // 创建角色
  36. rpc RoleCreate(CreateRoleRequest) returns (DefaultReply) {}
  37. // 角色列表
  38. rpc RoleList(RoleListRequest) returns (RoleListReply) {}
  39. // 角色编辑
  40. rpc RoleEdit(Role) returns (DefaultReply) {}
  41. // 角色添加多个service权限
  42. rpc RoleAddPermissions(RolePermissionRequest) returns (DefaultReply) {}
  43. // 角色移除多个service权限
  44. rpc RoleRemovePermissions(RolePermissionRequest) returns (DefaultReply) {}
  45. // service权限列表
  46. rpc ServiceList(ServiceListRequest) returns (ServiceListReply) {}
  47. // 移除service
  48. rpc ServiceRemoveList(ServiceRemoveRequest) returns (DefaultReply) {}
  49. rpc ShopCreate (CreateShopRequest) returns (CreateReply) {}
  50. rpc ShopList (ShopListRequest) returns (ShopListReply) {}
  51. rpc SystemAddShop (SystemAddShopRequest) returns (DefaultReply) {}
  52. // ---总后台专用API---
  53. rpc IMSystemCreate (CreateSystemRequest) returns (TokenParam) {}
  54. rpc IMSignOut (DefaultRequest) returns (DefaultReply) {}
  55. rpc IMSelfInfo (DefaultRequest) returns (UserInfo) {}
  56. // ---总后台专用API---
  57. }
  58. message DefaultRequest{
  59. }
  60. message TokenParam{
  61. string token = 1;
  62. }
  63. message DefaultReply{}
  64. message SignUpReply{
  65. int64 userId = 1;
  66. }
  67. message SignInPasswordRequest {
  68. string auth = 1;
  69. string password = 2;
  70. int64 sysId = 3;
  71. //session有效期,单位:秒
  72. int64 expirationSec = 4;
  73. }
  74. enum Status{
  75. Null = 0;
  76. Ban = 1;
  77. On = 2;
  78. Delete = 9;
  79. }
  80. message SignUpRequest {
  81. string userCode = 1 ;
  82. string name = 2 ;
  83. string email = 3 ;
  84. string phone = 4 ;
  85. string wxOpenId = 5;
  86. string qq = 6;
  87. string password = 7;
  88. string question = 8;
  89. string answer = 9;
  90. string memo = 10;
  91. }
  92. message UserInfo {
  93. int64 id = 1 ;
  94. string userCode = 2 ;
  95. string name = 3 ;
  96. string email = 4 ;
  97. string phone = 5 ;
  98. string qq = 7;
  99. string memo = 11;
  100. Status status = 12;
  101. }
  102. message CreateReply{
  103. int64 id = 1;
  104. }
  105. message PermissionCheck {
  106. string token = 1;
  107. // service全路径,区分大小写,如User/List
  108. string servicePath = 2;
  109. }
  110. message SessionCheckReply {
  111. int64 userId = 1;
  112. }
  113. message Service {
  114. string path = 1;
  115. string memo = 2;
  116. }
  117. message SaveServiceListRequest{
  118. repeated Service list = 1;
  119. }
  120. message CreateSystemRequest{
  121. string fullName = 1;
  122. string shortname = 2;
  123. string sysUrl = 3;
  124. string memo = 4;
  125. }
  126. message UserGetColumnListRequest{
  127. int64 userId = 1;
  128. // 最顶层为0
  129. int32 parentId = 2;
  130. // 仅综合管理后台调用有效
  131. int64 sysId = 3;
  132. }
  133. message Column{
  134. string name = 1;
  135. string url = 2;
  136. string code = 3;
  137. // 顺序
  138. int32 sn = 4;
  139. Status status = 5;
  140. bool navShow = 6;
  141. int64 id = 7;
  142. }
  143. message UserGetColumnListReply{
  144. repeated Column list = 1;
  145. }
  146. message CreateRoleRequest{
  147. string name = 1;
  148. string memo = 2;
  149. }
  150. message Role {
  151. int64 id = 1;
  152. string name = 2;
  153. string memo = 3;
  154. Status status = 4;
  155. string systemName = 5;
  156. }
  157. message RoleListRequest{
  158. int64 userId = 1;
  159. int64 sysId = 2;
  160. }
  161. message UserListRequest{
  162. // 0为全部
  163. int64 roleId = 1;
  164. Status status = 2;
  165. // 模糊查询
  166. string name = 3;
  167. int64 lcstypeid = 4;
  168. // 仅总后台请求时有效
  169. int64 sysId = 5;
  170. }
  171. message UserListReply{
  172. repeated UserInfo list = 1;
  173. }
  174. message UserGetInfoRequest{
  175. int64 userId = 1;
  176. }
  177. message UserRolesRequest{
  178. int64 userId = 1;
  179. repeated int64 roleIdList = 2;
  180. }
  181. message RoleListReply {
  182. repeated Role list = 1;
  183. }
  184. message RolePermissionRequest{
  185. int64 roleId = 1;
  186. repeated string servicePath = 2;
  187. }
  188. message ServiceListRequest{
  189. // 仅总系统有效
  190. int64 sysId = 1;
  191. }
  192. message ServiceListReply{
  193. repeated Service list = 1;
  194. }
  195. message ServiceRemoveRequest{
  196. repeated string pathList = 1;
  197. }
  198. message CreateShopRequest{
  199. string name = 1;
  200. string key = 2;
  201. //上级商家Id
  202. int64 sId = 3;
  203. string addr = 4;
  204. string phone = 5;
  205. string contacts =6;
  206. int64 createUser = 7;
  207. }
  208. message ShopListRequest{
  209. // 子系统调用时,0:展示所有商家,大于0则展示本系统商家
  210. int64 sysId = 1;
  211. // 模糊查询
  212. string name = 2;
  213. // Status_Null查询全部
  214. Status status = 3;
  215. //上级商家Id, -1 时查询全部
  216. int64 sId = 4;
  217. }
  218. message ShopInfo{
  219. int64 shopId =1;
  220. string name =2;
  221. int64 sId =3;
  222. string addr =4;
  223. string phone =5;
  224. string contacts =6;
  225. Status status =7;
  226. int64 created_at =8;
  227. int64 created_user =9;
  228. int64 updated_at =10;
  229. int64 updated_user =11;
  230. }
  231. message ShopListReply{
  232. repeated ShopInfo list = 1;
  233. }
  234. message SystemAddShopRequest{
  235. // 仅总后台调用有效
  236. int64 sysId = 1;
  237. int64 shopId = 2;
  238. }