Browse Source

fix:修复预约成功后返回-1

zhangxinlei1996 3 years ago
parent
commit
69da424bfb
1 changed files with 9 additions and 10 deletions
  1. 9 10
      api/internal/logic/appointmentaddlogic.go

+ 9 - 10
api/internal/logic/appointmentaddlogic.go

@@ -38,19 +38,18 @@ func (l *AppointmentAddLogic) AppointmentAdd(req *types.AppointmentAddReq) (resp
 		UseProductType: req.UseProductType,
 		ProductId:      req.ProductId,
 	})
-	if err != nil {
+	if err != nil || marketingResp == nil {
 		l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
 		resp.Error_code, resp.Error_msg = -1, "预约失败"
+		return
 	}
-	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": 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
 }