participateSetUpInfoLogic.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package logic
  2. import (
  3. "context"
  4. "jyBXCore/rpc/type/bxcore"
  5. "net/http"
  6. "jyBXCore/api/internal/svc"
  7. "jyBXCore/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type ParticipateSetUpInfoLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. r *http.Request
  15. }
  16. func NewParticipateSetUpInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *ParticipateSetUpInfoLogic {
  17. return &ParticipateSetUpInfoLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. r: r,
  22. }
  23. }
  24. func (l *ParticipateSetUpInfoLogic) ParticipateSetUpInfo(req *types.ParticipateSetUpInfoReq) (resp *types.CommonResp, err error) {
  25. var (
  26. bidType []*bxcore.BidTypeReq
  27. remindRule []*bxcore.RemindRuleReq
  28. )
  29. if len(req.BidType) > 0 {
  30. for _, v := range req.BidType {
  31. bidType = append(bidType, &bxcore.BidTypeReq{
  32. Name: v.Name,
  33. Content: v.Content,
  34. })
  35. }
  36. }
  37. if len(req.RemindRule) > 0 {
  38. for _, v := range req.RemindRule {
  39. remindRule = append(remindRule, &bxcore.RemindRuleReq{
  40. BidState: v.BidState,
  41. Remainder: v.Remainder,
  42. Node: v.Node,
  43. })
  44. }
  45. }
  46. res, err := l.svcCtx.BxCore.ParticipateSetUpInfo(l.ctx, &bxcore.ParticipateSetUpInfoReq{
  47. EntId: req.EntId,
  48. EntUserId: req.EntUserId,
  49. PositionId: req.PositionId,
  50. PositionType: req.PositionType,
  51. SetAction: req.SetAction,
  52. IsAllow: req.IsAllow,
  53. BidType: bidType,
  54. RemindRule: remindRule,
  55. })
  56. if err != nil {
  57. return &types.CommonResp{
  58. Err_code: res.ErrCode,
  59. Err_msg: res.ErrMsg,
  60. Data: false,
  61. }, nil
  62. }
  63. return &types.CommonResp{
  64. Err_code: res.ErrCode,
  65. Err_msg: res.ErrMsg,
  66. Data: res.Data,
  67. }, nil
  68. }