package logic import ( "context" "fmt" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/api/internal/svc" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/api/internal/types" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/public/service" "bp.jydev.jianyu360.cn/ApplicationCenter/marketing/rpc/pb" "github.com/zeromicro/go-zero/core/logx" ) type ActivityInfoLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewActivityInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ActivityInfoLogic { return &ActivityInfoLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *ActivityInfoLogic) ActivityInfo(req *types.AppointmentAddReq) (resp *types.Reply, err error) { // todo: add your logic here and delete this line resp = &types.Reply{} marketingResp, err := service.MarketingRpc.AppointmentInfo(l.ctx, &pb.AppointmentInfoReq{ AppId: req.AppId, UserId: req.UserId, ProductId: req.ProductId, UseProductType: req.UseProductType, }) if err != nil { l.Error(fmt.Sprintf("%+v", req), resp.Error_msg) resp.Data = map[string]interface{}{ "status": -1, } resp.Error_code, resp.Error_msg = -1, "预约失败" } if marketingResp.ErrorMsg != "" { resp.Error_msg = marketingResp.ErrorMsg resp.Error_code = -1 resp.Data = nil l.Error(fmt.Sprintf("%+v", req), resp.Error_msg) } else { resp.Data = map[string]interface{}{ "activityName": marketingResp.ActivityName, "activityId": marketingResp.ActivityId, "activityType": marketingResp.ActivityType, "startTime": marketingResp.StartTime, "endTime": marketingResp.EndTime, "preStartTime": marketingResp.PreheatStartTime, "stockNumber": marketingResp.StockNumber, "isAppointment": marketingResp.PreheatStatus, } } return }