im.proto 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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 SubPermissionListCheck (PermissionCheck) returns (PermissionCheckReply) {}
  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. int64 shopId = 2;
  111. // servicePath全路径,区分大小写,如User/List
  112. repeated string servicePathList = 3;
  113. }
  114. message SessionCheckReply {
  115. int64 userId = 1;
  116. }
  117. message PermissionCheckReply{
  118. repeated bool resultList = 1;
  119. }
  120. message Service {
  121. string path = 1;
  122. string memo = 2;
  123. }
  124. message SaveServiceListRequest{
  125. repeated Service list = 1;
  126. }
  127. message CreateSystemRequest{
  128. string fullName = 1;
  129. string shortname = 2;
  130. string sysUrl = 3;
  131. string memo = 4;
  132. }
  133. message UserGetColumnListRequest{
  134. int64 userId = 1;
  135. int64 shopId = 2;
  136. // 最顶层为0
  137. int32 parentId = 3;
  138. // 仅综合管理后台调用有效
  139. int64 sysId = 4;
  140. }
  141. message Column{
  142. string name = 1;
  143. string url = 2;
  144. string code = 3;
  145. // 顺序
  146. int32 sn = 4;
  147. Status status = 5;
  148. bool navShow = 6;
  149. int64 id = 7;
  150. }
  151. message UserGetColumnListReply{
  152. repeated Column list = 1;
  153. }
  154. message CreateRoleRequest{
  155. string name = 1;
  156. string memo = 2;
  157. }
  158. message Role {
  159. int64 id = 1;
  160. string name = 2;
  161. string memo = 3;
  162. Status status = 4;
  163. string systemName = 5;
  164. }
  165. message RoleListRequest{
  166. int64 userId = 1;
  167. int64 sysId = 2;
  168. }
  169. message UserListRequest{
  170. // 0为全部
  171. int64 roleId = 1;
  172. Status status = 2;
  173. // 模糊查询
  174. string name = 3;
  175. int64 lcstypeid = 4;
  176. // 仅总后台请求时有效
  177. int64 sysId = 5;
  178. }
  179. message UserListReply{
  180. repeated UserInfo list = 1;
  181. }
  182. message UserGetInfoRequest{
  183. int64 userId = 1;
  184. }
  185. message UserRolesRequest{
  186. int64 userId = 1;
  187. repeated int64 roleIdList = 2;
  188. }
  189. message RoleListReply {
  190. repeated Role list = 1;
  191. }
  192. message RolePermissionRequest{
  193. int64 roleId = 1;
  194. repeated string servicePath = 2;
  195. }
  196. message ServiceListRequest{
  197. // 仅总系统有效
  198. int64 sysId = 1;
  199. }
  200. message ServiceListReply{
  201. repeated Service list = 1;
  202. }
  203. message ServiceRemoveRequest{
  204. repeated string pathList = 1;
  205. }
  206. message CreateShopRequest{
  207. string name = 1;
  208. string key = 2;
  209. //上级商家Id
  210. int64 sId = 3;
  211. string addr = 4;
  212. string phone = 5;
  213. string contacts =6;
  214. int64 createUser = 7;
  215. }
  216. message ShopListRequest{
  217. // 子系统调用时,0:展示所有商家,大于0则展示本系统商家
  218. int64 sysId = 1;
  219. // 模糊查询
  220. string name = 2;
  221. // Status_Null查询全部
  222. Status status = 3;
  223. //上级商家Id, -1 时查询全部
  224. int64 sId = 4;
  225. }
  226. message ShopInfo{
  227. int64 shopId =1;
  228. string name =2;
  229. int64 sId =3;
  230. string addr =4;
  231. string phone =5;
  232. string contacts =6;
  233. Status status =7;
  234. int64 created_at =8;
  235. int64 created_user =9;
  236. int64 updated_at =10;
  237. int64 updated_user =11;
  238. }
  239. message ShopListReply{
  240. repeated ShopInfo list = 1;
  241. }
  242. message SystemAddShopRequest{
  243. // 仅总后台调用有效
  244. int64 sysId = 1;
  245. int64 shopId = 2;
  246. }
  247. message SystemAddUserRequest{
  248. // 仅总后台调用有效
  249. int64 sysId = 1;
  250. int64 userId = 2;
  251. }
  252. message Message{
  253. int64 id = 1;
  254. string title = 2;
  255. string content = 3;
  256. enum Level{
  257. Null = 0;
  258. Normal = 1;
  259. Warn = 2;
  260. Error = 3;
  261. }
  262. Level level = 4;
  263. int64 createAt = 5;
  264. }