im.proto 8.5 KB

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