resource.proto 3.2 KB

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