isappointmentlogic.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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.AppointmentAddReq) (*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. ProductId: in.ProductId,
  30. UseProductType: in.UseProductType,
  31. }
  32. status, err := appointment.IsAppointment()
  33. if err != nil {
  34. l.Error(fmt.Sprintf("%+v", in), err.Error())
  35. resp.ErrorMsg = err.Error()
  36. resp.ErrorCode = -1
  37. }
  38. resp.Status = status
  39. return resp, nil
  40. }