Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LeafYeeXYZ committed Jun 25, 2024
1 parent 8725bbc commit 185a183
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
15 changes: 9 additions & 6 deletions catch.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ func (a *App) CatchCourseMaj(speed int, studentID string, password string, cours
})
time.Sleep(time.Duration(speed) * time.Millisecond)

// 勾选 radio
ele = iiiframe.Locator("#tr0_ischk input")
// 可选人数
ele = iiiframe.Locator("#tr0_kxrs")
count = 0
for {
if count > 10000 {
Expand All @@ -400,14 +400,17 @@ func (a *App) CatchCourseMaj(speed int, studentID string, password string, cours
}
if exists, _ := ele.IsVisible(); exists {
// 检查是否可选人数为 0
if text, _ := iiiframe.Locator("#tr0_kxrs").InnerText(); text == "0" {
if text, _ := ele.InnerText(); text == "0" {
runtime.EventsEmit(a.ctx, "currentStatus", fmt.Sprintf("课程 %s 可选人数为零", courseID))
errCh <- fmt.Errorf("课程 %s 可选人数为零", courseID)
return
} else {
// 勾选
ele = iiiframe.Locator("#tr0_ischk input")
err = ele.Click()
if err != nil { errCh <- err; return }
break
}
err = ele.Click()
if err != nil { errCh <- err; return }
break
} else {
runtime.EventsEmit(a.ctx, "currentStatus", fmt.Sprintf("等待检索课程 %s 结果...", courseID))
time.Sleep(time.Duration(speed) * time.Millisecond)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function Header({ systemStatus }: HeaderProps ) {
<p
className='header-title'
>
小鸦抢课 v1.5.2 - {systemStatus}
小鸦抢课 v1.5.3 - {systemStatus}
</p>

<button
Expand Down
13 changes: 8 additions & 5 deletions watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ func (a *App) watchCourseMajCore(speed int, studentID string, password string, c
time.Sleep(time.Duration(speed) * time.Millisecond)

// 勾选 radio
ele = iiiframe.Locator("#tr0_ischk input")
ele = iiiframe.Locator("#tr0_kxrs")
count = 0
for {
if count > 2000 {
Expand All @@ -617,13 +617,16 @@ func (a *App) watchCourseMajCore(speed int, studentID string, password string, c
}
if exists, _ := ele.IsVisible(); exists {
// 检查可选人数是否为 0
if text, _ := iiiframe.Locator("#tr0_kxrs").InnerText(); text == "0" {
if text, _ := ele.TextContent(); text == "0" {
ch <- nil
return
} else {
// 勾选
ele = iiiframe.Locator("#tr0_ischk input")
err = ele.Check()
if err != nil { ch <- err; return }
break
}
err = ele.Click()
if err != nil { ch <- err; return }
break
} else {
time.Sleep(time.Duration(speed) * time.Millisecond)
count += speed
Expand Down

0 comments on commit 185a183

Please sign in to comment.