im.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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 GenPhoneVerifyCode(GenPhoneVerifyCodeRequest)returns(DefaultReply){}
  16. rpc CheckVerifyCode(CheckVerifyCodeRequest)returns(DefaultReply){}
  17. rpc SignUpUserCode (SignUpRequest) returns (CreateReply) {}
  18. rpc SignUpPhone (SignUpRequest) returns (CreateReply) {}
  19. rpc SignInUserCode (SignInPasswordRequest) returns (SignInReply) {}
  20. rpc SignInWithPhonePassword (SignInPasswordRequest) returns (SignInReply) {}
  21. // ---子系统专用---
  22. // 检查token有效性
  23. rpc SubSessionCheck (TokenParam) returns (SessionCheckReply) {}
  24. // session添加KV对
  25. rpc SubSessionSetValue (SubSessionSetValueRequest) returns (DefaultReply) {}
  26. // session获取KV对
  27. rpc SubSessionGetValue (SubSessionGetValueRequest) returns (SubSessionGetValueReply) {}
  28. // 检查token所属用户是否拥有调用service权限
  29. rpc SubPermissionListCheck (PermissionCheck) returns (PermissionCheckReply) {}
  30. // 登出传入token
  31. rpc SubSignOut (TokenParam) returns (DefaultReply) {}
  32. // 批量保存service
  33. rpc SubServiceSaveList (SaveServiceListRequest) returns (DefaultReply) {}
  34. // ---子系统专用---
  35. // 用户列表
  36. rpc UserList (UserListRequest) returns (UserListReply) {}
  37. // 单个用户信息详情
  38. rpc UserGetInfo (UserGetInfoRequest) returns (UserInfo) {}
  39. // 用户添加多个角色
  40. rpc UserAddRoles(UserRolesRequest) returns (DefaultReply) {}
  41. // 用户移除多个角色
  42. rpc UserRemoveRoles(UserRolesRequest) returns (DefaultReply) {}
  43. // 用户获取栏目列表
  44. rpc UserGetColumnList(UserGetColumnListRequest) returns (UserGetColumnListReply) {}
  45. // 创建角色
  46. rpc RoleCreate(CreateRoleRequest) returns (DefaultReply) {}
  47. // 角色列表
  48. rpc RoleList(RoleListRequest) returns (RoleListReply) {}
  49. // 角色编辑
  50. rpc RoleEdit(Role) returns (DefaultReply) {}
  51. // 角色添加多个service权限
  52. rpc RoleAddPermissions(RolePermissionRequest) returns (DefaultReply) {}
  53. // 角色移除多个service权限
  54. rpc RoleRemovePermissions(RolePermissionRequest) returns (DefaultReply) {}
  55. // service权限列表
  56. rpc ServiceList(ServiceListRequest) returns (ServiceListReply) {}
  57. // 移除service
  58. rpc ServiceRemoveList(ServiceRemoveRequest) returns (DefaultReply) {}
  59. // 创建商户
  60. rpc ShopCreate (CreateShopRequest) returns (CreateReply) {}
  61. // 商户列表
  62. rpc ShopList (ShopListRequest) returns (ShopListReply) {}
  63. // 商户详情
  64. rpc ShopDetail (ShopDetailRequest) returns (ShopInfo) {}
  65. // 商户许可列表
  66. rpc ShopLicenseList (ShopDetailRequest) returns (LicenseList) {}
  67. // 商户添加用户
  68. rpc ShopAddUser (ShopAddUserRequest) returns (DefaultReply) {}
  69. // 商户添加许可证
  70. rpc ShopAddLicense (ShopAddLicenseRequest) returns (DefaultReply) {}
  71. // 系统添加商户
  72. rpc SystemAddShop (SystemAddShopRequest) returns (DefaultReply) {}
  73. // 系统添加用户
  74. rpc SystemAddUser (SystemAddUserRequest) returns (DefaultReply) {}
  75. // 创建栏目
  76. rpc ColumnCreate (ColumnCreateRequest) returns (CreateReply) {}
  77. // 创建许可
  78. rpc LicenseCreate (LicenseCreateRequest) returns (CreateReply) {}
  79. // 许可类型字典
  80. rpc LicenseTypeMap (IdList) returns (LicenseTypeMapReply) {}
  81. // 许可证批量绑定栏目(之前绑定的会全部取消)
  82. rpc LicenseBindColumns (LicenseBindColumnsRequest) returns (DefaultReply) {}
  83. // ---总后台专用API---
  84. rpc IMSystemCreate (CreateSystemRequest) returns (TokenParam) {}
  85. rpc IMSignOut (DefaultRequest) returns (DefaultReply) {}
  86. rpc IMSelfInfo (DefaultRequest) returns (UserInfo) {}
  87. rpc IMMessageRcv (DefaultRequest) returns (stream Message) {}
  88. // ---总后台专用API---
  89. }
  90. message DefaultRequest{
  91. }
  92. message GenVerifyImageRequest{
  93. int32 height = 1;
  94. int32 width = 2;
  95. }
  96. enum VerifyType{
  97. Undefined = 0;
  98. SignUp = 1;
  99. SignIn = 2;
  100. ChangePassword = 3;
  101. }
  102. message GenPhoneVerifyCodeRequest{
  103. VerifyType verifyType = 1;
  104. string code = 2;
  105. string account = 3;
  106. string ip = 4;
  107. string templateCode = 5;
  108. int64 expireDurationNano = 6;
  109. }
  110. message CheckVerifyCodeRequest{
  111. VerifyType verifyType = 1;
  112. string code = 2;
  113. string account = 3;
  114. }
  115. message GenVerifyImageReply{
  116. string codeId = 1;
  117. string imageBase64 = 2;
  118. }
  119. message SubSessionSetValueRequest{
  120. string token = 1;
  121. map<string, string> kv = 2;
  122. }
  123. message SubSessionGetValueRequest{
  124. string token = 1;
  125. repeated string keys = 2;
  126. }
  127. message SubSessionGetValueReply{
  128. repeated string values = 1;
  129. }
  130. message TokenParam{
  131. string token = 1;
  132. }
  133. message SignInReply{
  134. string token = 1;
  135. int64 userId = 2;
  136. }
  137. message DefaultReply{}
  138. message CreateReply{
  139. int64 id = 1;
  140. }
  141. message License{
  142. int64 id = 1;
  143. int64 shopId = 2;
  144. int64 lcsTypeId = 3;
  145. string name =4;
  146. // nanoSec
  147. int64 validPeriod =5;
  148. // 分
  149. int64 lcsPrice = 6;
  150. // nanoSec
  151. int64 lcsBeginTime = 7;
  152. // nanoSec
  153. int64 lcsEndTime = 8;
  154. int64 feeId = 9;
  155. Status status = 10;
  156. string memo = 11;
  157. // nanoSec
  158. int64 createdAt = 12;
  159. int64 createdUser = 13;
  160. // nanoSec
  161. int64 updatedAt = 14;
  162. int64 updatedUser = 15;
  163. }
  164. message LicenseType{
  165. int64 typeId = 1;
  166. string name = 2;
  167. // 有效期时长,单位毫秒
  168. int64 validPeriodMs = 3;
  169. // 单位:分
  170. int32 price = 4;
  171. string memo = 5;
  172. int64 execUser = 6;
  173. Status status = 7;
  174. int64 sysId = 8;
  175. }
  176. message LicenseTypeMapReply{
  177. map<int64, LicenseType> licenseMap = 1;
  178. }
  179. message SignInPasswordRequest {
  180. string codeId = 1;
  181. string verifyCode = 2;
  182. //登录凭据,用户名、手机号等
  183. string credential = 3;
  184. string password = 4;
  185. //仅综合管理后台有效
  186. int64 sysId = 5;
  187. //session有效期,单位:秒
  188. int64 expirationSec = 6;
  189. string ip = 7;
  190. string clientInfo = 8;
  191. }
  192. enum Status{
  193. Null = 0;
  194. Ban = 1;
  195. On = 2;
  196. Delete = 9;
  197. }
  198. message SignUpRequest {
  199. string userCode = 1 ;
  200. string name = 2 ;
  201. string email = 3 ;
  202. string phone = 4 ;
  203. string wxOpenId = 5;
  204. string qq = 6;
  205. string password = 7;
  206. string question = 8;
  207. string answer = 9;
  208. string memo = 10;
  209. }
  210. message UserInfo {
  211. int64 id = 1 ;
  212. string userCode = 2 ;
  213. string name = 3 ;
  214. string email = 4 ;
  215. string phone = 5 ;
  216. string qq = 7;
  217. string memo = 11;
  218. Status status = 12;
  219. }
  220. message PermissionCheck {
  221. string token = 1;
  222. int64 shopId = 2;
  223. // servicePath全路径,区分大小写,如User/List
  224. repeated string servicePathList = 3;
  225. }
  226. message SessionCheckReply {
  227. int64 userId = 1;
  228. }
  229. message PermissionCheckReply{
  230. repeated bool resultList = 1;
  231. }
  232. message Service {
  233. string path = 1;
  234. string memo = 2;
  235. }
  236. message SaveServiceListRequest{
  237. repeated Service list = 1;
  238. }
  239. message CreateSystemRequest{
  240. string fullName = 1;
  241. string shortname = 2;
  242. string sysUrl = 3;
  243. string memo = 4;
  244. }
  245. message UserGetColumnListRequest{
  246. int64 userId = 1;
  247. int64 shopId = 2;
  248. // 最顶层为0
  249. int64 parentId = 3;
  250. // 仅综合管理后台调用有效
  251. int64 sysId = 4;
  252. Status status = 5;
  253. }
  254. message Column{
  255. string name = 1;
  256. string url = 2;
  257. string code = 3;
  258. // 顺序
  259. int32 sn = 4;
  260. Status status = 5;
  261. bool navShow = 6;
  262. int64 id = 7;
  263. string icon = 8;
  264. }
  265. message UserGetColumnListReply{
  266. repeated Column list = 1;
  267. }
  268. message CreateRoleRequest{
  269. string name = 1;
  270. string memo = 2;
  271. }
  272. message Role {
  273. int64 id = 1;
  274. string name = 2;
  275. string memo = 3;
  276. Status status = 4;
  277. string systemName = 5;
  278. }
  279. message RoleListRequest{
  280. int64 userId = 1;
  281. int64 sysId = 2;
  282. }
  283. message UserListRequest{
  284. // 0为全部
  285. int64 roleId = 1;
  286. Status status = 2;
  287. // 模糊查询
  288. string name = 3;
  289. // 仅总后台请求时有效
  290. int64 sysId = 5;
  291. // 0为全部
  292. int64 shopId = 6;
  293. }
  294. message UserListReply{
  295. repeated UserInfo list = 1;
  296. }
  297. message UserGetInfoRequest{
  298. int64 userId = 1;
  299. }
  300. message UserRolesRequest{
  301. int64 userId = 1;
  302. repeated int64 roleIdList = 2;
  303. }
  304. message RoleListReply {
  305. repeated Role list = 1;
  306. }
  307. message RolePermissionRequest{
  308. int64 roleId = 1;
  309. repeated string servicePath = 2;
  310. }
  311. message ServiceListRequest{
  312. // 仅总系统有效
  313. int64 sysId = 1;
  314. }
  315. message ServiceListReply{
  316. repeated Service list = 1;
  317. }
  318. message ServiceRemoveRequest{
  319. repeated string pathList = 1;
  320. }
  321. message CreateShopRequest{
  322. string name = 1;
  323. string key = 2;
  324. //上级商家Id
  325. int64 sId = 3;
  326. string addr = 4;
  327. string phone = 5;
  328. string contacts =6;
  329. int64 createUser = 7;
  330. }
  331. message ShopListRequest{
  332. // 子系统调用时,0:展示所有商家,大于0则展示本系统商家
  333. int64 sysId = 1;
  334. // 模糊查询
  335. string name = 2;
  336. // Status_Null查询全部
  337. Status status = 3;
  338. //上级商家Id, -1 时查询全部
  339. int64 sId = 4;
  340. }
  341. message ShopDetailRequest{
  342. int64 shopId = 1;
  343. }
  344. message ShopAddUserRequest{
  345. int64 shopId = 1;
  346. int64 userId = 2;
  347. }
  348. message ShopAddLicenseRequest{
  349. int64 shopId = 1;
  350. int64 licenseId = 2;
  351. int64 feeId = 3;
  352. int64 beginTimestamp = 4;
  353. int64 execUserId = 5;
  354. string memo = 6;
  355. }
  356. message ShopInfo{
  357. int64 shopId =1;
  358. string name =2;
  359. int64 sId =3;
  360. string addr =4;
  361. string phone =5;
  362. string contacts =6;
  363. Status status =7;
  364. int64 created_at =8;
  365. int64 created_user =9;
  366. int64 updated_at =10;
  367. int64 updated_user =11;
  368. }
  369. message IdList{
  370. repeated int64 idList = 1;
  371. }
  372. message LicenseList{
  373. repeated License list = 1;
  374. }
  375. message ShopListReply{
  376. repeated ShopInfo list = 1;
  377. }
  378. message SystemAddShopRequest{
  379. // 仅总后台调用有效
  380. int64 sysId = 1;
  381. int64 shopId = 2;
  382. }
  383. message SystemAddUserRequest{
  384. // 仅总后台调用有效
  385. int64 sysId = 1;
  386. int64 userId = 2;
  387. string memo = 3;
  388. }
  389. message ColumnCreateRequest{
  390. // 仅总后台调用有效
  391. int64 sysId = 1;
  392. // 父级栏目ID
  393. int64 parentId = 2;
  394. string name = 3;
  395. string url = 4;
  396. // 栏目代码
  397. string code = 5;
  398. // 栏目序号,排序用
  399. int32 no = 6;
  400. bool show = 7;
  401. string icon = 8;
  402. }
  403. message LicenseCreateRequest{
  404. // 仅总后台调用有效
  405. int64 sysId = 1;
  406. string name = 2;
  407. // 有效期时长,单位秒
  408. int64 validPeriodSec = 3;
  409. // 单位:分
  410. int32 price = 4;
  411. string memo = 5;
  412. int64 execUser = 6;
  413. }
  414. message LicenseBindColumnsRequest{
  415. int64 licenseId =1;
  416. repeated int64 columnIdList = 2;
  417. string memo = 3;
  418. int64 execUser = 4;
  419. }
  420. message Message{
  421. int64 id = 1;
  422. string title = 2;
  423. string content = 3;
  424. enum Level{
  425. Null = 0;
  426. Normal = 1;
  427. Warn = 2;
  428. Error = 3;
  429. }
  430. Level level = 4;
  431. int64 createAt = 5;
  432. }