cancelempowerlogic.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 CancelEmpowerLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewCancelEmpowerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CancelEmpowerLogic {
  16. return &CancelEmpowerLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 取消授权
  23. func (l *CancelEmpowerLogic) CancelEmpower(in *pb.EmpowerReq) (*pb.Resp, error) {
  24. resp := &pb.Resp{}
  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. } else if len(in.EntUserId) == 0 {
  35. l.Error(fmt.Sprintf("%+v", in), "无效的参数ent_user_id")
  36. return resp, nil
  37. }
  38. resp.Status = CancelEmpower(in.Appid, in.FunctionCode, in.EntId, in.EntUserId)
  39. return resp, nil
  40. }