im.proto 6.4 KB

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