resource.proto 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 EmpowerListReq {
  55. string appid = 1;
  56. string function_code = 2; //功能代码
  57. int64 ent_id = 3; //企业id
  58. int64 page_num = 4; //开始页码,小于1的话,返回所有数据,不进行分页
  59. int64 page_size = 5; //每页大小
  60. }
  61. message EmpowerListResp {
  62. int64 count = 1; //总条数,只有第一页的时候才返回, 如果企业下所有人都有权限返回-1
  63. repeated Empower list = 2; //列表,如果企业下所有人都有权限,返回空数组
  64. }
  65. message Resp {
  66. int64 status = 1; //0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权 -4:超额
  67. int64 use_count = 2; //使用数量
  68. int64 surplus_count = 3; //剩余数量
  69. string start_time = 4; //权益开始时间
  70. string end_time = 5; //权益到期时间
  71. }
  72. message HaspowersReq {
  73. string appid = 1;
  74. int64 account_id = 2; //账户id
  75. int64 ent_account_id = 3; //企业账户id
  76. int64 ent_id = 4; //企业id
  77. int64 ent_user_id = 5; //企业用户id
  78. }
  79. message HaspowersResp {
  80. repeated string powers = 1; //所有权益
  81. }
  82. message WaitEmpowerDetailReq {
  83. string appid = 1;
  84. string function_code = 2; //功能代码
  85. int64 ent_id = 3; //企业id
  86. }
  87. message WaitEmpowerDetailBySpecIdReq {
  88. string appid = 1;
  89. int64 spec_id = 2; //功能代码
  90. int64 ent_id = 3; //企业id
  91. }
  92. message WaitEmpowerDetailsResp {
  93. repeated WaitEmpowerDetailResp waitEmpowerDetails = 1;
  94. }
  95. message WaitEmpowerDetailResp {
  96. int64 id = 1; //id
  97. string start_time = 2; //开始时间
  98. string end_time = 3; //结束时间
  99. int64 empower_count = 4; //授权数量
  100. int64 use_count = 5; //使用数量
  101. string limit_strategy = 6; //频率限制
  102. }
  103. service Resource {
  104. //开通或者取消用户/企业权益
  105. rpc PowerHandle(PowerReq) returns(Resp);
  106. //检查用户/企业权益
  107. rpc CheckPower(CheckPowerReq) returns(Resp);
  108. //资源扣减
  109. rpc Deduction(DeductionReq) returns(Resp);
  110. //资源充值
  111. rpc Recharge(RechargeReq) returns(Resp);
  112. //重新授权
  113. rpc ReEmpower(EmpowerReq) returns(Resp);
  114. //授权
  115. rpc Empower(EmpowerReq) returns(Resp);
  116. //根据功能代码取消授权
  117. rpc CancelEmpower(EmpowerReq) returns(Resp);
  118. //根据功能分类取消授权
  119. rpc CancelAllEmpower(AllEmpowerReq) returns(Resp);
  120. //授权列表
  121. rpc EmpowerList(EmpowerListReq) returns(EmpowerListResp);
  122. //所有的权益
  123. rpc Haspowers(HaspowersReq) returns(HaspowersResp);
  124. //根据功能代码获取待授权详情
  125. rpc WaitEmpowerDetail(WaitEmpowerDetailReq) returns(WaitEmpowerDetailResp);
  126. //根据商品规格获取待授权详情
  127. rpc WaitEmpowerDetailBySpecId(WaitEmpowerDetailBySpecIdReq) returns(WaitEmpowerDetailsResp);
  128. }