participateSetUpInfoLogic.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 req.SetAction != "" {
  30. if len(req.BidType) > 0 {
  31. for _, v := range req.BidType {
  32. bidType = append(bidType, &bxcore.BidTypeReq{
  33. Name: v.Name,
  34. Content: v.Content,
  35. })
  36. }
  37. }
  38. if len(req.RemindRule) > 0 {
  39. for _, v := range req.RemindRule {
  40. remindRule = append(remindRule, &bxcore.RemindRuleReq{
  41. BidState: v.BidState,
  42. Remainder: v.Remainder,
  43. Node: v.Node,
  44. })
  45. }
  46. }
  47. }
  48. res, err := l.svcCtx.BxCore.ParticipateSetUpInfo(l.ctx, &bxcore.ParticipateSetUpInfoReq{
  49. EntId: req.EntId,
  50. EntUserId: req.EntUserId,
  51. PositionId: req.PositionId,
  52. PositionType: req.PositionType,
  53. AppId: req.AppId,
  54. UserId: req.UserId,
  55. NewUserId: req.NewUserId,
  56. AccountId: req.AccountId,
  57. SetAction: req.SetAction,
  58. IsAllow: req.IsAllow,
  59. BidType: bidType,
  60. RemindRule: remindRule,
  61. })
  62. if err != nil {
  63. return &types.CommonResp{
  64. Err_code: res.ErrCode,
  65. Err_msg: res.ErrMsg,
  66. Data: false,
  67. }, nil
  68. }
  69. return &types.CommonResp{
  70. Err_code: res.ErrCode,
  71. Err_msg: res.ErrMsg,
  72. Data: res.Data,
  73. }, nil
  74. }