zhangxinlei1996 3 anni fa
parent
commit
7088a9043c

+ 5 - 4
api/internal/logic/appointmentaddlogic.go

@@ -27,7 +27,11 @@ func NewAppointmentAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ap
 
 func (l *AppointmentAddLogic) AppointmentAdd(req *types.AppointmentAddReq) (resp *types.Reply, err error) {
 	// todo: add your logic here and delete this line
-	resp = &types.Reply{}
+	resp = &types.Reply{
+		Data: map[string]interface{}{
+			"status": -1,
+		},
+	}
 	marketingResp, err := service.MarketingRpc.AppointmentAdd(l.ctx, &pb.AppointmentAddReq{
 		AppId:          req.AppId,
 		UserId:         req.UserId,
@@ -36,9 +40,6 @@ func (l *AppointmentAddLogic) AppointmentAdd(req *types.AppointmentAddReq) (resp
 	})
 	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 == nil {

+ 13 - 11
api/internal/logic/isappointmentlogic.go

@@ -27,7 +27,11 @@ func NewIsAppointmentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IsA
 
 func (l *IsAppointmentLogic) IsAppointment(req *types.IsAppointmentReq) (resp *types.Reply, err error) {
 	// todo: add your logic here and delete this line
-	resp = &types.Reply{}
+	resp = &types.Reply{
+		Data: map[string]interface{}{
+			"status": -1,
+		},
+	}
 	marketingResp, err := service.MarketingRpc.IsAppointment(l.ctx, &pb.IsAppointmentReq{
 		AppId:      req.AppId,
 		UserId:     req.UserId,
@@ -35,18 +39,16 @@ func (l *IsAppointmentLogic) IsAppointment(req *types.IsAppointmentReq) (resp *t
 	})
 	if err != nil {
 		l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
+	}
+	if marketingResp != nil {
+		if marketingResp.ErrorMsg != "" {
+			resp.Error_msg = marketingResp.ErrorMsg
+			resp.Error_code = -1
+			l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
+		}
 		resp.Data = map[string]interface{}{
-			"status": -1,
+			"status": marketingResp.Status,
 		}
 	}
-
-	if marketingResp.ErrorMsg != "" {
-		resp.Error_msg = marketingResp.ErrorMsg
-		resp.Error_code = -1
-		l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
-	}
-	resp.Data = map[string]interface{}{
-		"status": marketingResp.Status,
-	}
 	return
 }