isappointmentlogic.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. marketingResp, err := service.MarketingRpc.IsAppointment(l.ctx, &pb.IsAppointmentReq{
  27. AppId: req.AppId,
  28. UserId: req.UserId,
  29. ActivityId: req.ActivityId,
  30. })
  31. if err != nil {
  32. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  33. resp.Data = map[string]interface{}{
  34. "status": -1,
  35. }
  36. }
  37. if marketingResp.ErrorMsg != "" {
  38. resp.Error_msg = marketingResp.ErrorMsg
  39. resp.Error_code = -1
  40. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  41. }
  42. resp.Data = map[string]interface{}{
  43. "status": marketingResp.Status,
  44. }
  45. return
  46. }