fix: fix bug

This commit is contained in:
johlanse 2021-12-08 17:51:03 +08:00
parent 434a0787b8
commit d1d8e400ba
2 changed files with 7 additions and 3 deletions

View File

@ -54,9 +54,9 @@ func (c *Core) Init() {
Args: []string{
"--disable-extensions",
"--disable-gpu",
"--start-maximized",
"--no-sandbox",
"--window-size=500,450",
"--start-maximized",
"--mute-audio",
"--window-position=0,0",
"--ignore-certificate-errors",
@ -84,6 +84,7 @@ func (c *Core) Init() {
return
}
c.browser = browser
context, err := c.browser.NewContext()
if err != nil {
return
@ -158,7 +159,10 @@ func (c *Core) Login() ([]Cookie, error) {
removeNode(page)
screen, _ := page.Screenshot()
var result []byte
os.WriteFile("screen1.png", screen, 0666)
buffer := bytes.NewBuffer(result)
_ = Clip(bytes.NewReader(screen), buffer, 0, 0, 525, 35, 755, 255, 0)
c.Push("markdown", fmt.Sprintf("![screenshot](%v) \n>点开查看登录二维码\n>请在五分钟内完成扫码", "data:image/png;base64,"+base64.StdEncoding.EncodeToString(buffer.Bytes())))

View File

@ -185,7 +185,7 @@ func (c *Core) LearnVideo(cookies []Cookie) {
return
}
links, _ := getLinks("video")
if score.Content["video"].CurrentScore < score.Content["video"].MaxScore || score.Content["video_time"].CurrentScore < score.Content["video_time"].MaxScore {
if !(score.Content["video"].CurrentScore >= score.Content["video"].MaxScore && score.Content["video_time"].CurrentScore >= score.Content["video_time"].MaxScore) {
log.Infoln("开始加载视频学习模块")
// core := Core{}
//core.Init()
@ -248,7 +248,7 @@ func (c *Core) LearnVideo(cookies []Cookie) {
time.Sleep(1 * time.Second)
}
fmt.Println()
if score.Content["video"].CurrentScore >= score.Content["video"].MaxScore || score.Content["video_time"].CurrentScore >= score.Content["video_time"].MaxScore {
if score.Content["video"].CurrentScore >= score.Content["video"].MaxScore && score.Content["video_time"].CurrentScore >= score.Content["video_time"].MaxScore {
log.Infoln("检测到本次视频学习分数已满,退出学习")
break
}