resource.proto 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. syntax = "proto3";
  2. option go_package="./pb";
  3. message Empower {
  4. int64 ent_user_id = 1; //企业用户id
  5. }
  6. message PowerReq {
  7. string appid = 1;
  8. string goods_code = 2; //商品代码
  9. int64 goods_spec_id = 3; //商品规格id
  10. int64 ent_id = 4; //企业id
  11. int64 account_id = 5; //个人/企业员工账户id
  12. int64 buy_num = 6; //购买的数量或者购买的份数
  13. int64 type = 7; //操作类型 1:开通权益 -1:取消权益
  14. string start_time = 8; //权益开始时间 格式:2006-01-02 15:04:05
  15. string end_time = 9; //权益到期时间 格式:2006-01-02 15:04:05
  16. int64 ent_account_id = 10; //企业账户id
  17. }
  18. message CheckPowerReq {
  19. string appid = 1;
  20. string function_code = 2; //功能代码
  21. int64 account_id = 3; //账户id
  22. int64 ent_account_id = 4; //企业账户id
  23. int64 ent_id = 5; //企业id
  24. int64 ent_user_id = 6; //企业用户id
  25. }
  26. message DeductionReq {
  27. string appid = 1;
  28. string function_code = 2; //功能代码
  29. int64 account_id = 3; //账户id
  30. int64 ent_account_id = 4; //企业账户id
  31. int64 count = 5; //扣除数量
  32. repeated string ids = 6; //id列表
  33. }
  34. message RechargeReq {
  35. string appid = 1;
  36. string function_code = 2; //功能代码
  37. int64 account_id = 3; //账户id
  38. int64 ent_account_id = 4; //企业账户id
  39. int64 count = 5; //充值数量
  40. repeated string ids = 6; //id列表
  41. }
  42. message EmpowerReq {
  43. string appid = 1;
  44. string function_code = 2; //功能代码
  45. int64 ent_id = 3; //企业id
  46. repeated int64 ent_user_id = 4; //企业用户id
  47. }
  48. message AllEmpowerReq {
  49. string appid = 1;
  50. repeated string function_module = 2; //功能分类
  51. int64 ent_id = 3; //企业id
  52. repeated int64 ent_user_id = 4; //企业用户id
  53. }
  54. message CrReEmpowerReq {
  55. string appid = 1;
  56. repeated string function_module = 2; //功能分类
  57. repeated string function_code = 3; //功能代码
  58. int64 ent_id = 4; //企业id
  59. repeated int64 ent_user_id = 5; //企业用户id
  60. }
  61. message EmpowerListReq {
  62. string appid = 1;
  63. string function_code = 2; //功能代码
  64. int64 ent_id = 3; //企业id
  65. int64 page_num = 4; //开始页码,小于1的话,返回所有数据,不进行分页
  66. int64 page_size = 5; //每页大小
  67. }
  68. message EmpowerListResp {
  69. int64 count = 1; //总条数,只有第一页的时候才返回, 如果企业下所有人都有权限返回-1
  70. repeated Empower list = 2; //列表,如果企业下所有人都有权限,返回空数组
  71. }
  72. message Resp {
  73. int64 status = 1; //0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权 -4:超额
  74. int64 use_count = 2; //使用数量
  75. int64 surplus_count = 3; //剩余数量
  76. string start_time = 4; //权益开始时间
  77. string end_time = 5; //权益到期时间
  78. }
  79. message HaspowersReq {
  80. string appid = 1;
  81. int64 account_id = 2; //账户id
  82. int64 ent_account_id = 3; //企业账户id
  83. int64 ent_id = 4; //企业id
  84. int64 ent_user_id = 5; //企业用户id
  85. }
  86. message HaspowersResp {
  87. repeated string powers = 1; //所有权益
  88. }
  89. message WaitEmpowerDetailReq {
  90. string appid = 1;
  91. string function_code = 2; //功能代码
  92. int64 ent_id = 3; //企业id
  93. }
  94. message WaitEmpowerDetailBySpecIdReq {
  95. string appid = 1;
  96. int64 spec_id = 2; //功能代码
  97. int64 ent_id = 3; //企业id
  98. }
  99. message WaitEmpowerDetailsResp {
  100. repeated WaitEmpowerDetailResp waitEmpowerDetails = 1;
  101. }
  102. message WaitEmpowerDetailResp {
  103. int64 id = 1; //id
  104. string start_time = 2; //开始时间
  105. string end_time = 3; //结束时间
  106. int64 empower_count = 4; //授权数量
  107. int64 use_count = 5; //使用数量
  108. string limit_strategy = 6; //频率限制
  109. }
  110. service Resource {
  111. //开通或者取消用户/企业权益
  112. rpc PowerHandle(PowerReq) returns(Resp);
  113. //检查用户/企业权益
  114. rpc CheckPower(CheckPowerReq) returns(Resp);
  115. //资源扣减
  116. rpc Deduction(DeductionReq) returns(Resp);
  117. //资源充值
  118. rpc Recharge(RechargeReq) returns(Resp);
  119. //先把有权限的人清空,再把权益授权给新的人
  120. rpc ReEmpower(EmpowerReq) returns(Resp);
  121. //先根据功能分类把人的权益清空,再给人授权新的权益
  122. rpc CrReEmpower(CrReEmpowerReq) returns(Resp);
  123. //授权
  124. rpc Empower(EmpowerReq) returns(Resp);
  125. //根据功能代码取消授权
  126. rpc CancelEmpower(EmpowerReq) returns(Resp);
  127. //根据功能分类取消授权
  128. rpc CancelAllEmpower(AllEmpowerReq) returns(Resp);
  129. //授权列表
  130. rpc EmpowerList(EmpowerListReq) returns(EmpowerListResp);
  131. //所有的权益
  132. rpc Haspowers(HaspowersReq) returns(HaspowersResp);
  133. //根据功能代码获取待授权详情
  134. rpc WaitEmpowerDetail(WaitEmpowerDetailReq) returns(WaitEmpowerDetailResp);
  135. //根据商品规格获取待授权详情
  136. rpc WaitEmpowerDetailBySpecId(WaitEmpowerDetailBySpecIdReq) returns(WaitEmpowerDetailsResp);
  137. }