empowerlistlogic.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. . "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/service"
  6. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/svc"
  7. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type EmpowerListLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewEmpowerListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EmpowerListLogic {
  16. return &EmpowerListLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 授权列表
  23. func (l *EmpowerListLogic) EmpowerList(in *pb.EmpowerListReq) (*pb.EmpowerListResp, error) {
  24. resp := &pb.EmpowerListResp{}
  25. if in.Appid == "" {
  26. l.Error(fmt.Sprintf("%+v", in), "无效的参数appid")
  27. return resp, nil
  28. } else if in.FunctionCode == "" {
  29. l.Error(fmt.Sprintf("%+v", in), "无效的参数function_code")
  30. return resp, nil
  31. } else if in.EntId == 0 {
  32. l.Error(fmt.Sprintf("%+v", in), "无效的参数ent_id")
  33. return resp, nil
  34. }
  35. resp.Count, resp.List = EmpowerList(in.Appid, in.FunctionCode, in.EntId, in.PageNum, in.PageSize)
  36. return resp, nil
  37. }