syntax = "proto3"; option go_package="./pb"; message Empower { int64 ent_user_id = 1; //企业用户id } message PowerReq { string appid = 1; string goods_code = 2; //商品代码 int64 goods_spec_id = 3; //商品规格id int64 ent_id = 4; //企业id int64 account_id = 5; //个人/企业员工账户id int64 buy_num = 6; //购买的数量或者购买的份数 int64 type = 7; //操作类型 1:开通权益 -1:取消权益 string start_time = 8; //权益开始时间 格式:2006-01-02 15:04:05 string end_time = 9; //权益到期时间 格式:2006-01-02 15:04:05 int64 ent_account_id = 10; //企业账户id } message CheckPowerReq { string appid = 1; string function_code = 2; //功能代码 int64 account_id = 3; //账户id int64 ent_account_id = 4; //企业账户id int64 ent_id = 5; //企业id int64 ent_user_id = 6; //企业用户id } message DeductionReq { string appid = 1; string function_code = 2; //功能代码 int64 account_id = 3; //账户id int64 ent_account_id = 4; //企业账户id int64 count = 5; //扣除数量 repeated string ids = 6; //id列表 } message RechargeReq { string appid = 1; string function_code = 2; //功能代码 int64 account_id = 3; //账户id int64 ent_account_id = 4; //企业账户id int64 count = 5; //充值数量 repeated string ids = 6; //id列表 } message EmpowerReq { string appid = 1; string function_code = 2; //功能代码 int64 ent_id = 3; //企业id repeated int64 ent_user_id = 4; //企业用户id } message EmpowerListReq { string appid = 1; string function_code = 2; //功能代码 int64 ent_id = 3; //企业id int64 page_num = 4; //开始页码,小于1的话,返回所有数据,不进行分页 int64 page_size = 5; //每页大小 } message EmpowerListResp { int64 count = 1; //总条数,只有第一页的时候才返回, 如果企业下所有人都有权限返回-1 repeated Empower list = 2; //列表,如果企业下所有人都有权限,返回空数组 } message Resp { int64 status = 1; //0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权 -4:超额 int64 use_count = 2; //使用数量 int64 surplus_count = 3; //剩余数量 string start_time = 4; //权益开始时间 string end_time = 5; //权益到期时间 } message HaspowersReq { string appid = 1; int64 account_id = 2; //账户id int64 ent_account_id = 3; //企业账户id int64 ent_id = 4; //企业id int64 ent_user_id = 5; //企业用户id } message HaspowersResp { repeated string powers = 1; //所有权益 } service Resource { //开通或者取消用户/企业权益 rpc PowerHandle(PowerReq) returns(Resp); //检查用户/企业权益 rpc CheckPower(CheckPowerReq) returns(Resp); //资源扣减 rpc Deduction(DeductionReq) returns(Resp); //资源充值 rpc Recharge(RechargeReq) returns(Resp); //重新授权 rpc ReEmpower(EmpowerReq) returns(Resp); //授权 rpc Empower(EmpowerReq) returns(Resp); //取消授权 rpc CancelEmpower(EmpowerReq) returns(Resp); //授权列表 rpc EmpowerList(EmpowerListReq) returns(EmpowerListResp); //所有的权益 rpc Haspowers(HaspowersReq) returns(HaspowersResp); }