workdesktopcomprehensivelogic.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package logic
  2. import (
  3. "context"
  4. "net/http"
  5. "strings"
  6. MC "app.yhyue.com/moapp/jybase/common"
  7. "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/config"
  8. "bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
  9. "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
  10. "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
  11. "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/types"
  12. "github.com/zeromicro/go-zero/core/logx"
  13. )
  14. type WorkDesktopComprehensiveLogic struct {
  15. logx.Logger
  16. ctx context.Context
  17. svcCtx *svc.ServiceContext
  18. r *http.Request
  19. }
  20. func NewWorkDesktopComprehensiveLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *WorkDesktopComprehensiveLogic {
  21. return &WorkDesktopComprehensiveLogic{
  22. Logger: logx.WithContext(ctx),
  23. ctx: ctx,
  24. svcCtx: svcCtx,
  25. r: r,
  26. }
  27. }
  28. func (l *WorkDesktopComprehensiveLogic) WorkDesktopComprehensive(req *types.WorkDesktopComprehensiveReq) (resp *types.CommonResp, err error) {
  29. if req.Platform == "H5" {
  30. req.Platform = "APP"
  31. }
  32. res, err := entity.UserCenterRpc.WorkDesktopComprehensive(l.ctx, &pb.WorkDesktopComprehensiveReq{
  33. AppId: req.AppId,
  34. UserId: req.UserId,
  35. Phone: req.Phone,
  36. Platform: req.Platform,
  37. MenuIds: req.MenuIds,
  38. MenuMode: req.MenuMode,
  39. ActionMode: req.ActionMode,
  40. NewUserId: req.NewUserId,
  41. EntId: req.EntId,
  42. EntUserId: req.EntUserId,
  43. IntranetBool: MC.If(config.C.IntranetName != "" && strings.Contains(l.r.Referer(), config.C.IntranetName), true, false).(bool),
  44. AccountId: req.AccountId,
  45. EntAccountId: req.EntAccountId,
  46. PositionId: req.PositionId,
  47. PositionType: req.PositionType,
  48. MgoUserId: req.MgoUserId,
  49. EntNicheDis: req.EntNicheDis,
  50. })
  51. return &types.CommonResp{
  52. Error_code: res.ErrorCode,
  53. Error_msg: res.ErrorMsg,
  54. Data: map[string]interface{}{
  55. "list": res.Data,
  56. "num": res.CommonlySize,
  57. },
  58. }, err
  59. }