isappointmentlogic.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/api/internal/svc"
  6. "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/api/internal/types"
  7. "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/public/service"
  8. "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/rpc/pb"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type IsAppointmentLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewIsAppointmentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IsAppointmentLogic {
  17. return &IsAppointmentLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *IsAppointmentLogic) IsAppointment(req *types.IsAppointmentReq) (resp *types.Reply, err error) {
  24. // todo: add your logic here and delete this line
  25. resp = &types.Reply{
  26. Data: map[string]interface{}{
  27. "status": -1,
  28. },
  29. }
  30. marketingResp, err := service.MarketingRpc.IsAppointment(l.ctx, &pb.IsAppointmentReq{
  31. AppId: req.AppId,
  32. UserId: req.UserId,
  33. ActivityId: req.ActivityId,
  34. })
  35. if err != nil {
  36. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  37. }
  38. if marketingResp != nil {
  39. if marketingResp.ErrorMsg != "" {
  40. resp.Error_msg = marketingResp.ErrorMsg
  41. resp.Error_code = -1
  42. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  43. }
  44. resp.Data = map[string]interface{}{
  45. "status": marketingResp.Status,
  46. }
  47. }
  48. return
  49. }