im.proto 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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 (CreateReply) {}
  13. rpc SignUpPhone (SignUpRequest) returns (CreateReply) {}
  14. rpc SignInUserCode (SignInPasswordRequest) returns (SignInReply) {}
  15. rpc SignInWithPhonePassword (SignInPasswordRequest) returns (SignInReply) {}
  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. // 创建商户
  51. rpc ShopCreate (CreateShopRequest) returns (CreateReply) {}
  52. // 商户列表
  53. rpc ShopList (ShopListRequest) returns (ShopListReply) {}
  54. // 商户添加用户
  55. rpc ShopAddUser (ShopAddUserRequest) returns (DefaultReply) {}
  56. // 商户添加许可证
  57. rpc ShopAddLicense (ShopAddLicenseRequest) returns (DefaultReply) {}
  58. // 系统添加商户
  59. rpc SystemAddShop (SystemAddShopRequest) returns (DefaultReply) {}
  60. // 系统添加用户
  61. rpc SystemAddUser (SystemAddUserRequest) returns (DefaultReply) {}
  62. // 创建栏目
  63. rpc ColumnCreate (ColumnCreateRequest) returns (CreateReply) {}
  64. // 创建许可
  65. rpc LicenseCreate (LicenseCreateRequest) returns (CreateReply) {}
  66. // 许可证批量绑定栏目(之前绑定的会全部取消)
  67. rpc LicenseBindColumns (LicenseBindColumnsRequest) returns (DefaultReply) {}
  68. // ---总后台专用API---
  69. rpc IMSystemCreate (CreateSystemRequest) returns (TokenParam) {}
  70. rpc IMSignOut (DefaultRequest) returns (DefaultReply) {}
  71. rpc IMSelfInfo (DefaultRequest) returns (UserInfo) {}
  72. rpc IMMessageRcv (DefaultRequest) returns (stream Message) {}
  73. // ---总后台专用API---
  74. }
  75. message DefaultRequest{
  76. }
  77. message TokenParam{
  78. string token = 1;
  79. }
  80. message SignInReply{
  81. string token = 1;
  82. int64 userId = 2;
  83. }
  84. message DefaultReply{}
  85. message CreateReply{
  86. int64 id = 1;
  87. }
  88. message SignInPasswordRequest {
  89. //登录凭据,用户名、手机号等
  90. string credential = 1;
  91. string password = 2;
  92. //仅综合管理后台有效
  93. int64 sysId = 3;
  94. //session有效期,单位:秒
  95. int64 expirationSec = 4;
  96. string ip = 5;
  97. string clientInfo = 6;
  98. }
  99. enum Status{
  100. Null = 0;
  101. Ban = 1;
  102. On = 2;
  103. Delete = 9;
  104. }
  105. message SignUpRequest {
  106. string userCode = 1 ;
  107. string name = 2 ;
  108. string email = 3 ;
  109. string phone = 4 ;
  110. string wxOpenId = 5;
  111. string qq = 6;
  112. string password = 7;
  113. string question = 8;
  114. string answer = 9;
  115. string memo = 10;
  116. }
  117. message UserInfo {
  118. int64 id = 1 ;
  119. string userCode = 2 ;
  120. string name = 3 ;
  121. string email = 4 ;
  122. string phone = 5 ;
  123. string qq = 7;
  124. string memo = 11;
  125. Status status = 12;
  126. }
  127. message PermissionCheck {
  128. string token = 1;
  129. int64 shopId = 2;
  130. // servicePath全路径,区分大小写,如User/List
  131. repeated string servicePathList = 3;
  132. }
  133. message SessionCheckReply {
  134. int64 userId = 1;
  135. }
  136. message PermissionCheckReply{
  137. repeated bool resultList = 1;
  138. }
  139. message Service {
  140. string path = 1;
  141. string memo = 2;
  142. }
  143. message SaveServiceListRequest{
  144. repeated Service list = 1;
  145. }
  146. message CreateSystemRequest{
  147. string fullName = 1;
  148. string shortname = 2;
  149. string sysUrl = 3;
  150. string memo = 4;
  151. }
  152. message UserGetColumnListRequest{
  153. int64 userId = 1;
  154. int64 shopId = 2;
  155. // 最顶层为0
  156. int32 parentId = 3;
  157. // 仅综合管理后台调用有效
  158. int64 sysId = 4;
  159. }
  160. message Column{
  161. string name = 1;
  162. string url = 2;
  163. string code = 3;
  164. // 顺序
  165. int32 sn = 4;
  166. Status status = 5;
  167. bool navShow = 6;
  168. int64 id = 7;
  169. }
  170. message UserGetColumnListReply{
  171. repeated Column list = 1;
  172. }
  173. message CreateRoleRequest{
  174. string name = 1;
  175. string memo = 2;
  176. }
  177. message Role {
  178. int64 id = 1;
  179. string name = 2;
  180. string memo = 3;
  181. Status status = 4;
  182. string systemName = 5;
  183. }
  184. message RoleListRequest{
  185. int64 userId = 1;
  186. int64 sysId = 2;
  187. }
  188. message UserListRequest{
  189. // 0为全部
  190. int64 roleId = 1;
  191. Status status = 2;
  192. // 模糊查询
  193. string name = 3;
  194. int64 lcstypeid = 4;
  195. // 仅总后台请求时有效
  196. int64 sysId = 5;
  197. }
  198. message UserListReply{
  199. repeated UserInfo list = 1;
  200. }
  201. message UserGetInfoRequest{
  202. int64 userId = 1;
  203. }
  204. message UserRolesRequest{
  205. int64 userId = 1;
  206. repeated int64 roleIdList = 2;
  207. }
  208. message RoleListReply {
  209. repeated Role list = 1;
  210. }
  211. message RolePermissionRequest{
  212. int64 roleId = 1;
  213. repeated string servicePath = 2;
  214. }
  215. message ServiceListRequest{
  216. // 仅总系统有效
  217. int64 sysId = 1;
  218. }
  219. message ServiceListReply{
  220. repeated Service list = 1;
  221. }
  222. message ServiceRemoveRequest{
  223. repeated string pathList = 1;
  224. }
  225. message CreateShopRequest{
  226. string name = 1;
  227. string key = 2;
  228. //上级商家Id
  229. int64 sId = 3;
  230. string addr = 4;
  231. string phone = 5;
  232. string contacts =6;
  233. int64 createUser = 7;
  234. }
  235. message ShopListRequest{
  236. // 子系统调用时,0:展示所有商家,大于0则展示本系统商家
  237. int64 sysId = 1;
  238. // 模糊查询
  239. string name = 2;
  240. // Status_Null查询全部
  241. Status status = 3;
  242. //上级商家Id, -1 时查询全部
  243. int64 sId = 4;
  244. }
  245. message ShopAddUserRequest{
  246. int64 shopId = 1;
  247. int64 userId = 2;
  248. }
  249. message ShopAddLicenseRequest{
  250. int64 shopId = 1;
  251. int64 licenseId = 2;
  252. int64 feeId = 3;
  253. int64 beginTimestamp = 4;
  254. int64 execUserId = 5;
  255. string memo = 6;
  256. }
  257. message ShopInfo{
  258. int64 shopId =1;
  259. string name =2;
  260. int64 sId =3;
  261. string addr =4;
  262. string phone =5;
  263. string contacts =6;
  264. Status status =7;
  265. int64 created_at =8;
  266. int64 created_user =9;
  267. int64 updated_at =10;
  268. int64 updated_user =11;
  269. }
  270. message ShopListReply{
  271. repeated ShopInfo list = 1;
  272. }
  273. message SystemAddShopRequest{
  274. // 仅总后台调用有效
  275. int64 sysId = 1;
  276. int64 shopId = 2;
  277. }
  278. message SystemAddUserRequest{
  279. // 仅总后台调用有效
  280. int64 sysId = 1;
  281. int64 userId = 2;
  282. string memo = 3;
  283. }
  284. message ColumnCreateRequest{
  285. // 仅总后台调用有效
  286. int64 sysId = 1;
  287. // 父级栏目ID
  288. int64 parentId = 2;
  289. string name = 3;
  290. string url = 4;
  291. // 栏目代码
  292. string code = 5;
  293. // 栏目序号,排序用
  294. int32 no = 6;
  295. bool show = 7;
  296. }
  297. message LicenseCreateRequest{
  298. // 仅总后台调用有效
  299. int64 sysId = 1;
  300. string name = 2;
  301. // 有效期时长,单位秒
  302. int64 validPeriodSec = 3;
  303. // 单位:分
  304. int32 price = 4;
  305. string memo = 5;
  306. int64 execUser = 6;
  307. }
  308. message LicenseBindColumnsRequest{
  309. int64 licenseId =1;
  310. repeated int64 columnIdList = 2;
  311. string memo = 3;
  312. int64 execUser = 4;
  313. }
  314. message Message{
  315. int64 id = 1;
  316. string title = 2;
  317. string content = 3;
  318. enum Level{
  319. Null = 0;
  320. Normal = 1;
  321. Warn = 2;
  322. Error = 3;
  323. }
  324. Level level = 4;
  325. int64 createAt = 5;
  326. }