isappointmentlogic.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/public/entity"
  6. "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/rpc/internal/svc"
  7. "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/rpc/pb"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type IsAppointmentLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewIsAppointmentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IsAppointmentLogic {
  16. return &IsAppointmentLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 用户是否预约
  23. func (l *IsAppointmentLogic) IsAppointment(in *pb.IsAppointmentReq) (*pb.Resp, error) {
  24. // todo: add your logic here and delete this line
  25. resp := &pb.Resp{}
  26. appointment := &entity.AppointmentStruct{
  27. Appid: in.AppId,
  28. UserId: in.UserId,
  29. ActivityId: in.ActivityId,
  30. }
  31. status, err := appointment.IsAppointment()
  32. if err != nil {
  33. l.Error(fmt.Sprintf("%+v", in), err.Error())
  34. resp.ErrorMsg = err.Error()
  35. resp.ErrorCode = -1
  36. }
  37. resp.Status = status
  38. return resp, nil
  39. }