File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,10 +111,16 @@ func (s *Student) GetTermEvents(termId string) (*CalTermEvents, error) {
111111 }
112112
113113 rawData := strings .Split (event , "为" )
114- rawDate := strings .Split (rawData [0 ], "至" )
114+ if len (rawData ) < 2 {
115+ // 远古学期的数据格式可能不统一,不做处理
116+ res .Events = append (res .Events , CalTermEvent {Name : strings .TrimSpace (event )})
117+ continue
118+ }
119+
120+ rawDate := strings .Split (strings .TrimSpace (rawData [0 ]), "至" )
121+ name := strings .TrimSpace (strings .Join (rawData [1 :], "为" ))
115122
116123 if len (rawDate ) >= 2 {
117- name := strings .TrimSpace (rawData [1 ])
118124 startDate := strings .TrimSpace (rawDate [0 ])
119125 endDate := strings .TrimSpace (rawDate [1 ])
120126
@@ -124,9 +130,12 @@ func (s *Student) GetTermEvents(termId string) (*CalTermEvents, error) {
124130 EndDate : endDate ,
125131 })
126132 } else {
127- // 远古学期的数据格式可能不统一,不做处理
133+ // 兼容单日事件格式: 2025-09-07为学生注册
134+ date := strings .TrimSpace (rawDate [0 ])
128135 res .Events = append (res .Events , CalTermEvent {
129- Name : rawData [0 ],
136+ Name : name ,
137+ StartDate : date ,
138+ EndDate : date ,
130139 })
131140 }
132141 }
You can’t perform that action at this time.
0 commit comments