diff --git a/src/core/web/box.go b/src/core/web/box.go index 141fc42..11ed2ea 100644 --- a/src/core/web/box.go +++ b/src/core/web/box.go @@ -4,6 +4,7 @@ import ( "arknights_bot/plugins/account" "arknights_bot/plugins/skland" "arknights_bot/utils" + "fmt" "github.com/gin-gonic/gin" "log" "net/http" @@ -103,6 +104,10 @@ func Box(r *gin.Engine) { box.Name = playerData.Status.Name box.Chars = chars + if len(box.Chars) == 0 { + utils.WebC <- fmt.Errorf("无符合干员") + return + } c.HTML(http.StatusOK, "Box.tmpl", box) }) diff --git a/src/core/web/missing.go b/src/core/web/missing.go index a8e506b..e76a08e 100644 --- a/src/core/web/missing.go +++ b/src/core/web/missing.go @@ -4,6 +4,7 @@ import ( "arknights_bot/plugins/account" "arknights_bot/plugins/skland" "arknights_bot/utils" + "fmt" "github.com/gin-gonic/gin" "log" "net/http" @@ -102,6 +103,10 @@ func Missing(r *gin.Engine) { missingInfo.Name = playerData.Status.Name missingInfo.Chars = chars + if len(missingInfo.Chars) == 0 { + utils.WebC <- fmt.Errorf("你什么都不缺") + return + } c.HTML(http.StatusOK, "Missing.tmpl", missingInfo) }) diff --git a/src/utils/base_utils.go b/src/utils/base_utils.go index 239d468..04b5c69 100644 --- a/src/utils/base_utils.go +++ b/src/utils/base_utils.go @@ -278,7 +278,6 @@ func Screenshot(url string, waitTime float64, scale float64) ([]byte, error) { }) if len(WebC) > 0 { e := <-WebC - close(WebC) return nil, e } page.WaitForTimeout(waitTime)