resource.proto 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 EmpowerListReq {
  49. string appid = 1;
  50. string function_code = 2; //功能代码
  51. int64 ent_id = 3; //企业id
  52. int64 page_num = 4; //开始页码,小于1的话,返回所有数据,不进行分页
  53. int64 page_size = 5; //每页大小
  54. }
  55. message EmpowerListResp {
  56. int64 count = 1; //总条数,只有第一页的时候才返回, 如果企业下所有人都有权限返回-1
  57. repeated Empower list = 2; //列表,如果企业下所有人都有权限,返回空数组
  58. }
  59. message Resp {
  60. int64 status = 1; //0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权 -4:超额
  61. int64 use_count = 2; //使用数量
  62. int64 surplus_count = 3; //剩余数量
  63. string start_time = 4; //权益开始时间
  64. string end_time = 5; //权益到期时间
  65. }
  66. message HaspowersReq {
  67. string appid = 1;
  68. int64 account_id = 2; //账户id
  69. int64 ent_account_id = 3; //企业账户id
  70. int64 ent_id = 4; //企业id
  71. int64 ent_user_id = 5; //企业用户id
  72. }
  73. message HaspowersResp {
  74. repeated string powers = 1; //所有权益
  75. }
  76. service Resource {
  77. //开通或者取消用户/企业权益
  78. rpc PowerHandle(PowerReq) returns(Resp);
  79. //检查用户/企业权益
  80. rpc CheckPower(CheckPowerReq) returns(Resp);
  81. //资源扣减
  82. rpc Deduction(DeductionReq) returns(Resp);
  83. //资源充值
  84. rpc Recharge(RechargeReq) returns(Resp);
  85. //重新授权
  86. rpc ReEmpower(EmpowerReq) returns(Resp);
  87. //授权
  88. rpc Empower(EmpowerReq) returns(Resp);
  89. //取消授权
  90. rpc CancelEmpower(EmpowerReq) returns(Resp);
  91. //授权列表
  92. rpc EmpowerList(EmpowerListReq) returns(EmpowerListResp);
  93. //所有的权益
  94. rpc Haspowers(HaspowersReq) returns(HaspowersResp);
  95. }