resourceserver.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // Code generated by goctl. DO NOT EDIT!
  2. // Source: resource.proto
  3. package server
  4. import (
  5. "context"
  6. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/logic"
  7. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/svc"
  8. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
  9. )
  10. type ResourceServer struct {
  11. svcCtx *svc.ServiceContext
  12. pb.UnimplementedResourceServer
  13. }
  14. func NewResourceServer(svcCtx *svc.ServiceContext) *ResourceServer {
  15. return &ResourceServer{
  16. svcCtx: svcCtx,
  17. }
  18. }
  19. // 开通或者取消用户/企业权益
  20. func (s *ResourceServer) PowerHandle(ctx context.Context, in *pb.PowerReq) (*pb.Resp, error) {
  21. l := logic.NewPowerHandleLogic(ctx, s.svcCtx)
  22. return l.PowerHandle(in)
  23. }
  24. // 检查用户/企业权益
  25. func (s *ResourceServer) CheckPower(ctx context.Context, in *pb.CheckPowerReq) (*pb.Resp, error) {
  26. l := logic.NewCheckPowerLogic(ctx, s.svcCtx)
  27. return l.CheckPower(in)
  28. }
  29. // 资源扣减
  30. func (s *ResourceServer) Deduction(ctx context.Context, in *pb.DeductionReq) (*pb.Resp, error) {
  31. l := logic.NewDeductionLogic(ctx, s.svcCtx)
  32. return l.Deduction(in)
  33. }
  34. // 资源充值
  35. func (s *ResourceServer) Recharge(ctx context.Context, in *pb.RechargeReq) (*pb.Resp, error) {
  36. l := logic.NewRechargeLogic(ctx, s.svcCtx)
  37. return l.Recharge(in)
  38. }
  39. // 先把有权限的人清空,再把权益授权给新的人
  40. func (s *ResourceServer) ReEmpower(ctx context.Context, in *pb.EmpowerReq) (*pb.Resp, error) {
  41. l := logic.NewReEmpowerLogic(ctx, s.svcCtx)
  42. return l.ReEmpower(in)
  43. }
  44. // 先根据功能分类把人的权益清空,再给人授权新的权益
  45. func (s *ResourceServer) CrReEmpower(ctx context.Context, in *pb.CrReEmpowerReq) (*pb.Resp, error) {
  46. l := logic.NewCrReEmpowerLogic(ctx, s.svcCtx)
  47. return l.CrReEmpower(in)
  48. }
  49. // 授权
  50. func (s *ResourceServer) Empower(ctx context.Context, in *pb.EmpowerReq) (*pb.Resp, error) {
  51. l := logic.NewEmpowerLogic(ctx, s.svcCtx)
  52. return l.Empower(in)
  53. }
  54. // 根据功能代码取消授权
  55. func (s *ResourceServer) CancelEmpower(ctx context.Context, in *pb.EmpowerReq) (*pb.Resp, error) {
  56. l := logic.NewCancelEmpowerLogic(ctx, s.svcCtx)
  57. return l.CancelEmpower(in)
  58. }
  59. // 根据功能分类取消授权
  60. func (s *ResourceServer) CancelAllEmpower(ctx context.Context, in *pb.AllEmpowerReq) (*pb.Resp, error) {
  61. l := logic.NewCancelAllEmpowerLogic(ctx, s.svcCtx)
  62. return l.CancelAllEmpower(in)
  63. }
  64. // 授权列表
  65. func (s *ResourceServer) EmpowerList(ctx context.Context, in *pb.EmpowerListReq) (*pb.EmpowerListResp, error) {
  66. l := logic.NewEmpowerListLogic(ctx, s.svcCtx)
  67. return l.EmpowerList(in)
  68. }
  69. // 所有的权益
  70. func (s *ResourceServer) Haspowers(ctx context.Context, in *pb.HaspowersReq) (*pb.HaspowersResp, error) {
  71. l := logic.NewHaspowersLogic(ctx, s.svcCtx)
  72. return l.Haspowers(in)
  73. }
  74. // 根据功能代码获取待授权详情
  75. func (s *ResourceServer) WaitEmpowerDetail(ctx context.Context, in *pb.WaitEmpowerDetailReq) (*pb.WaitEmpowerDetailResp, error) {
  76. l := logic.NewWaitEmpowerDetailLogic(ctx, s.svcCtx)
  77. return l.WaitEmpowerDetail(in)
  78. }
  79. // 根据商品规格获取待授权详情
  80. func (s *ResourceServer) WaitEmpowerDetailBySpecId(ctx context.Context, in *pb.WaitEmpowerDetailBySpecIdReq) (*pb.WaitEmpowerDetailsResp, error) {
  81. l := logic.NewWaitEmpowerDetailBySpecIdLogic(ctx, s.svcCtx)
  82. return l.WaitEmpowerDetailBySpecId(in)
  83. }