im.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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. }
  253. message Column{
  254. string name = 1;
  255. string url = 2;
  256. string code = 3;
  257. // 顺序
  258. int32 sn = 4;
  259. Status status = 5;
  260. bool navShow = 6;
  261. int64 id = 7;
  262. }
  263. message UserGetColumnListReply{
  264. repeated Column list = 1;
  265. }
  266. message CreateRoleRequest{
  267. string name = 1;
  268. string memo = 2;
  269. }
  270. message Role {
  271. int64 id = 1;
  272. string name = 2;
  273. string memo = 3;
  274. Status status = 4;
  275. string systemName = 5;
  276. }
  277. message RoleListRequest{
  278. int64 userId = 1;
  279. int64 sysId = 2;
  280. }
  281. message UserListRequest{
  282. // 0为全部
  283. int64 roleId = 1;
  284. Status status = 2;
  285. // 模糊查询
  286. string name = 3;
  287. // 仅总后台请求时有效
  288. int64 sysId = 5;
  289. // 0为全部
  290. int64 shopId = 6;
  291. }
  292. message UserListReply{
  293. repeated UserInfo list = 1;
  294. }
  295. message UserGetInfoRequest{
  296. int64 userId = 1;
  297. }
  298. message UserRolesRequest{
  299. int64 userId = 1;
  300. repeated int64 roleIdList = 2;
  301. }
  302. message RoleListReply {
  303. repeated Role list = 1;
  304. }
  305. message RolePermissionRequest{
  306. int64 roleId = 1;
  307. repeated string servicePath = 2;
  308. }
  309. message ServiceListRequest{
  310. // 仅总系统有效
  311. int64 sysId = 1;
  312. }
  313. message ServiceListReply{
  314. repeated Service list = 1;
  315. }
  316. message ServiceRemoveRequest{
  317. repeated string pathList = 1;
  318. }
  319. message CreateShopRequest{
  320. string name = 1;
  321. string key = 2;
  322. //上级商家Id
  323. int64 sId = 3;
  324. string addr = 4;
  325. string phone = 5;
  326. string contacts =6;
  327. int64 createUser = 7;
  328. }
  329. message ShopListRequest{
  330. // 子系统调用时,0:展示所有商家,大于0则展示本系统商家
  331. int64 sysId = 1;
  332. // 模糊查询
  333. string name = 2;
  334. // Status_Null查询全部
  335. Status status = 3;
  336. //上级商家Id, -1 时查询全部
  337. int64 sId = 4;
  338. }
  339. message ShopDetailRequest{
  340. int64 shopId = 1;
  341. }
  342. message ShopAddUserRequest{
  343. int64 shopId = 1;
  344. int64 userId = 2;
  345. }
  346. message ShopAddLicenseRequest{
  347. int64 shopId = 1;
  348. int64 licenseId = 2;
  349. int64 feeId = 3;
  350. int64 beginTimestamp = 4;
  351. int64 execUserId = 5;
  352. string memo = 6;
  353. }
  354. message ShopInfo{
  355. int64 shopId =1;
  356. string name =2;
  357. int64 sId =3;
  358. string addr =4;
  359. string phone =5;
  360. string contacts =6;
  361. Status status =7;
  362. int64 created_at =8;
  363. int64 created_user =9;
  364. int64 updated_at =10;
  365. int64 updated_user =11;
  366. }
  367. message IdList{
  368. repeated int64 idList = 1;
  369. }
  370. message LicenseList{
  371. repeated License list = 1;
  372. }
  373. message ShopListReply{
  374. repeated ShopInfo list = 1;
  375. }
  376. message SystemAddShopRequest{
  377. // 仅总后台调用有效
  378. int64 sysId = 1;
  379. int64 shopId = 2;
  380. }
  381. message SystemAddUserRequest{
  382. // 仅总后台调用有效
  383. int64 sysId = 1;
  384. int64 userId = 2;
  385. string memo = 3;
  386. }
  387. message ColumnCreateRequest{
  388. // 仅总后台调用有效
  389. int64 sysId = 1;
  390. // 父级栏目ID
  391. int64 parentId = 2;
  392. string name = 3;
  393. string url = 4;
  394. // 栏目代码
  395. string code = 5;
  396. // 栏目序号,排序用
  397. int32 no = 6;
  398. bool show = 7;
  399. }
  400. message LicenseCreateRequest{
  401. // 仅总后台调用有效
  402. int64 sysId = 1;
  403. string name = 2;
  404. // 有效期时长,单位秒
  405. int64 validPeriodSec = 3;
  406. // 单位:分
  407. int32 price = 4;
  408. string memo = 5;
  409. int64 execUser = 6;
  410. }
  411. message LicenseBindColumnsRequest{
  412. int64 licenseId =1;
  413. repeated int64 columnIdList = 2;
  414. string memo = 3;
  415. int64 execUser = 4;
  416. }
  417. message Message{
  418. int64 id = 1;
  419. string title = 2;
  420. string content = 3;
  421. enum Level{
  422. Null = 0;
  423. Normal = 1;
  424. Warn = 2;
  425. Error = 3;
  426. }
  427. Level level = 4;
  428. int64 createAt = 5;
  429. }