Skip to content

Commit

Permalink
修复判断可选人数逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
LeafYeeXYZ committed Jun 25, 2024
1 parent 6f4f480 commit 8725bbc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/bin
node_modules
frontend/dist
package.json.md5
package.json.md5
.DS_Store
7 changes: 7 additions & 0 deletions catch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"time"

"github.com/playwright-community/playwright-go"
"github.com/wailsapp/wails/v2/pkg/runtime"
)
Expand Down Expand Up @@ -398,6 +399,12 @@ func (a *App) CatchCourseMaj(speed int, studentID string, password string, cours
return
}
if exists, _ := ele.IsVisible(); exists {
// 检查是否可选人数为 0
if text, _ := iiiframe.Locator("#tr0_kxrs").InnerText(); text == "0" {
runtime.EventsEmit(a.ctx, "currentStatus", fmt.Sprintf("课程 %s 可选人数为零", courseID))
errCh <- fmt.Errorf("课程 %s 可选人数为零", courseID)
return
}
err = ele.Click()
if err != nil { errCh <- err; return }
break
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.1 - {systemStatus}
小鸦抢课 v1.5.2 - {systemStatus}
</p>

<button
Expand Down
1 change: 0 additions & 1 deletion frontend/src/styles/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
width: 100dvw;
overflow: hidden;
background-color: var(--back);
border-radius: 10px!important;

--header-height: 40px;
--footer-height: 30px;
Expand Down
5 changes: 5 additions & 0 deletions watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,11 @@ func (a *App) watchCourseMajCore(speed int, studentID string, password string, c
return
}
if exists, _ := ele.IsVisible(); exists {
// 检查可选人数是否为 0
if text, _ := iiiframe.Locator("#tr0_kxrs").InnerText(); text == "0" {
ch <- nil
return
}
err = ele.Click()
if err != nil { ch <- err; return }
break
Expand Down

0 comments on commit 8725bbc

Please sign in to comment.