im.proto 8.1 KB

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