reempowerlogic.go 937 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "strings"
  6. . "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/service"
  7. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/svc"
  8. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type ReEmpowerLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewReEmpowerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ReEmpowerLogic {
  17. return &ReEmpowerLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. // 先把有权限的人清空,再把权益授权给新的人
  24. func (l *ReEmpowerLogic) ReEmpower(in *pb.EmpowerReq) (*pb.Resp, error) {
  25. resp := &pb.Resp{}
  26. status, err := ReEmpower(in.Appid, strings.Split(in.FunctionCode, ","), in.EntId, in.EntUserId)
  27. if err != nil {
  28. l.Error(fmt.Sprintf("%+v", in), err)
  29. }
  30. resp.Status = status
  31. return resp, nil
  32. }