From 8725bbcc5169063ec370794264f8c214474930e6 Mon Sep 17 00:00:00 2001 From: LeafYeeXYZ Date: Tue, 25 Jun 2024 14:01:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=A4=E6=96=AD=E5=8F=AF?= =?UTF-8?q?=E9=80=89=E4=BA=BA=E6=95=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- catch.go | 7 +++++++ frontend/src/components/Header.tsx | 2 +- frontend/src/styles/App.css | 1 - watch.go | 5 +++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index f22ba39..6266a0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/bin node_modules frontend/dist -package.json.md5 \ No newline at end of file +package.json.md5 +.DS_Store \ No newline at end of file diff --git a/catch.go b/catch.go index 6e4421a..32244f9 100644 --- a/catch.go +++ b/catch.go @@ -3,6 +3,7 @@ package main import ( "fmt" "time" + "github.com/playwright-community/playwright-go" "github.com/wailsapp/wails/v2/pkg/runtime" ) @@ -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 diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index 9b914b6..d45005a 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -41,7 +41,7 @@ export function Header({ systemStatus }: HeaderProps ) {

- 小鸦抢课 v1.5.1 - {systemStatus} + 小鸦抢课 v1.5.2 - {systemStatus}