getpushsetlogic.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package logic
  2. import (
  3. "context"
  4. "github.com/zeromicro/go-zero/core/logx"
  5. "jyBXSubscribe/rpc/internal/svc"
  6. "jyBXSubscribe/rpc/model/service"
  7. "jyBXSubscribe/rpc/type/bxsubscribe"
  8. "jyBXSubscribe/rpc/util"
  9. )
  10. type GetPushSetLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewGetPushSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPushSetLogic {
  16. return &GetPushSetLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 用户推送设置查看
  23. func (l *GetPushSetLogic) GetPushSet(in *bxsubscribe.GetPushSetReq) (*bxsubscribe.GetPushSetResp, error) {
  24. // todo: add your logic here and delete this line
  25. subService := &service.PushSetService{
  26. UserId: in.UserId,
  27. PositionType: in.PositionType,
  28. EntUserId: in.EntUserId,
  29. EntId: in.EntId,
  30. AccountId: in.AccountId,
  31. BaseUserId: in.BaseUserId,
  32. PositionId: in.PositionId,
  33. }
  34. TimeData := map[int64]*bxsubscribe.TimeJson{}
  35. for k, v := range util.TimeMap {
  36. TimeData[int64(k)] = &bxsubscribe.TimeJson{ATimes: v}
  37. }
  38. pushSet := subService.Find()
  39. return &bxsubscribe.GetPushSetResp{
  40. Data: pushSet,
  41. TimeData: TimeData,
  42. }, nil
  43. }