package logic import ( "context" "fmt" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/public/entity" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/rpc/internal/svc" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/rpc/pb" "github.com/zeromicro/go-zero/core/logx" ) type AppointmentInfoLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewAppointmentInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AppointmentInfoLogic { return &AppointmentInfoLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } // 预热信息 func (l *AppointmentInfoLogic) AppointmentInfo(in *pb.AppointmentInfoReq) (*pb.AppointmentInfoResp, error) { // todo: add your logic here and delete this line resp := &pb.AppointmentInfoResp{} appointment := &entity.AppointmentStruct{ Appid: in.AppId, UserId: in.UserId, ProductId: in.ProductId, UseProductType: in.UseProductType, } data, err := appointment.Info() if err != nil { l.Error(fmt.Sprintf("%+v", in), err.Error()) resp.ErrorMsg = err.Error() resp.ErrorCode = -1 } else { resp.ActivityId = data.ActivityId resp.ActivityName = data.ActivityName resp.ActivityType = data.ActivityType resp.StartTime = data.StartTime resp.EndTime = data.EndTime resp.PreheatStartTime = data.PreStartTime resp.PreheatEndTime = data.StartTime resp.PreheatStatus = data.IsAppointment resp.StockNumber = data.StockNumber } return resp, nil }