Browse Source

semeTime: 同期优化

ping 8 months ago
parent
commit
c7e5b26b34
1 changed files with 7 additions and 2 deletions
  1. 7 2
      model/event_seme_time_flow.go

+ 7 - 2
model/event_seme_time_flow.go

@@ -34,8 +34,13 @@ func NewEventSemeTimeFlow(semeTimeId int64, req *pasturePb.SemeTimeRequest) *Eve
 		if i != len(req.Graph.Nodes)-1 && i < len(req.Graph.Edges) {
 			edgesTextValue := req.Graph.Edges[i].Text.Value
 			dayHours := strings.Split(edgesTextValue, "/")
-			dayStr := regexp.MustCompile(`\d+`).FindString(dayHours[0])
-			hoursStr := regexp.MustCompile(`\d+`).FindString(dayHours[1])
+			dayStr, hoursStr := "0", "0"
+			if len(dayHours) > 0 && len(dayHours) == 1 {
+				dayStr = regexp.MustCompile(`\d+`).FindString(dayHours[0])
+			}
+			if len(dayHours) > 0 && len(dayHours) == 2 {
+				hoursStr = regexp.MustCompile(`\d+`).FindString(dayHours[1])
+			}
 			day, _ := strconv.Atoi(dayStr)
 			hours, _ := strconv.Atoi(hoursStr)
 			conditions.Day = int32(day)