participateSetUpInfoLogic.go 2.1 KB

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