haspowerslogic.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/api/internal/svc"
  6. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/api/internal/types"
  7. . "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/service"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type HaspowersLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewHaspowersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *HaspowersLogic {
  16. return &HaspowersLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *HaspowersLogic) Haspowers(req *types.Req) (resp *types.Reply, err error) {
  23. resp = &types.Reply{}
  24. if req.AppId == "" {
  25. resp.Error_msg = "无效的参数appid"
  26. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  27. return resp, nil
  28. } else if req.User_id == 0 && req.Ent_id == 0 && req.Ent_user_id == 0 {
  29. resp.Error_msg = "无效的参数user_id、ent_id、ent_user_id"
  30. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  31. return resp, nil
  32. }
  33. resp.Error_code = 0
  34. resp.Data = HasPowers(req.AppId, req.User_id, req.Ent_id, req.Ent_user_id)
  35. return
  36. }