From fb367038f75863ad6d2321e65db78a3f64fcbfbc Mon Sep 17 00:00:00 2001 From: Changbaiqi Date: Mon, 23 Dec 2024 23:37:36 +0800 Subject: [PATCH] fixed: fixed yinghua can't exam bug --- .github/workflows/release.yaml | 5 ++-- config/logo.txt | 2 +- logic/yinghua/YinghuaPart.go | 52 ++++++++++++++++++---------------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7f9cd45..b08cbca 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,7 @@ on: tag_name: description: 'Tag name for the release' required: true - default: 'v2.5.0-Beta.4' # Default tag name + default: 'v2.5.0-Beta.5' # Default tag name permissions: contents: write # Allow writing to GitHub releases @@ -23,8 +23,7 @@ env: VERSION: ${{ github.ref_name }} # Dynamic version based on the tag name RELEASE_DIR: release RELEASE_NOTICES: | - - [‍👏] 优化学习通部分日志显示 - - [‍👏] 优化学习通提交学时算法 + - [‍👏] 修复学习通无法正常考试BUG 注:当前学习通功能为测试阶段日志显示比较乱,后续版本更新会调整 diff --git a/config/logo.txt b/config/logo.txt index 785211c..31dfb73 100644 --- a/config/logo.txt +++ b/config/logo.txt @@ -13,7 +13,7 @@ : \ \; : .' \ | , / `----' ---' ; : ; \ ' ;| , .-./ ---`-' | , / `--` `--`---' ---`-' - Yatori-go-console v2.5.0-Beta.4 + Yatori-go-console v2.5.0-Beta.5 仅用于学习交流,请勿用于违法和商业用途!!! GitHub开源地址:https://github.com/yatori-dev/yatori-go-console 个人博客:https://blogs.changbaiqi.top \ No newline at end of file diff --git a/logic/yinghua/YinghuaPart.go b/logic/yinghua/YinghuaPart.go index 3a7d38e..364496b 100644 --- a/logic/yinghua/YinghuaPart.go +++ b/logic/yinghua/YinghuaPart.go @@ -70,7 +70,8 @@ var soundMut sync.Mutex func userBlock(setting config.Setting, user *config.Users, cache *yinghuaApi.YingHuaUserCache) { list, _ := yinghua.CourseListAction(cache) //拉取课程列表 - for _, item := range list { //遍历所有待刷视频 + lg.Print(lg.INFO, "[", lg.Green, cache.Account, lg.Default, "] ", lg.Purple, "正在定位上次学习位置...") + for _, item := range list { //遍历所有待刷视频 nodesLock.Add(1) go nodeListStudy(setting, user, cache, &item) //多携程刷课 } @@ -108,32 +109,30 @@ func nodeListStudy(setting config.Setting, user *config.Users, userCache *yinghu return } modelLog.ModelPrint(setting.BasicSetting.LogModel == 1, lg.INFO, "[", lg.Green, userCache.Account, lg.Default, "] ", "正在学习课程:", lg.Yellow, " 【"+course.Name+"】 ") - if int(course.Progress) != 1 { //如果课程没有学完则开始学 - //执行刷课--------------------------------- - nodeList, _ := yinghua.VideosListAction(userCache, *course) //拉取对应课程的视频列表 - // 提交学时 - for _, node := range nodeList { - //视频处理逻辑 - switch user.CoursesCustom.VideoModel { //根据视频模式进行刷课 - case 1: - videoAction(setting, user, userCache, node) - break - case 2: - videoVioLenceAction(setting, user, userCache, node) - break - } - //作业处理逻辑 - workAction(setting, user, userCache, node) - //考试处理逻辑 - examAction(setting, user, userCache, node) + //执行刷课--------------------------------- + nodeList, _ := yinghua.VideosListAction(userCache, *course) //拉取对应课程的视频列表 + // 提交学时 + for _, node := range nodeList { + //视频处理逻辑 + switch user.CoursesCustom.VideoModel { //根据视频模式进行刷课 + case 1: + videoAction(setting, user, userCache, node) + break + case 2: + videoVioLenceAction(setting, user, userCache, node) + break + } + //作业处理逻辑 + workAction(setting, user, userCache, node) + //考试处理逻辑 + examAction(setting, user, userCache, node) - action, err := yinghua.CourseDetailAction(userCache, course.Id) - if err != nil { - lg.Print(lg.INFO, "[", lg.Green, userCache.Account, lg.Default, "] ", lg.Default, " 【"+course.Name+"】 ", lg.Red, "拉取课程进度失败", err.Error()) - break - } - modelLog.ModelPrint(setting.BasicSetting.LogModel == 1, lg.INFO, "[", lg.Green, userCache.Account, lg.Default, "] ", lg.Default, " 【"+course.Name+"】 ", "视频学习进度:", strconv.Itoa(action.VideoLearned), "/", strconv.Itoa(action.VideoCount), " ", "课程总学习进度:", fmt.Sprintf("%.2f", action.Progress*100), "%") + action, err := yinghua.CourseDetailAction(userCache, course.Id) + if err != nil { + lg.Print(lg.INFO, "[", lg.Green, userCache.Account, lg.Default, "] ", lg.Default, " 【"+course.Name+"】 ", lg.Red, "拉取课程进度失败", err.Error()) + break } + modelLog.ModelPrint(setting.BasicSetting.LogModel == 1, lg.INFO, "[", lg.Green, userCache.Account, lg.Default, "] ", lg.Default, " 【"+course.Name+"】 ", "视频学习进度:", strconv.Itoa(action.VideoLearned), "/", strconv.Itoa(action.VideoCount), " ", "课程总学习进度:", fmt.Sprintf("%.2f", action.Progress*100), "%") } modelLog.ModelPrint(setting.BasicSetting.LogModel == 1, lg.INFO, "[", lg.Green, userCache.Account, lg.Default, "] ", lg.Green, "课程", " 【"+course.Name+"】 ", "学习完毕") nodesLock.Done() @@ -195,6 +194,9 @@ func videoVioLenceAction(setting config.Setting, user *config.Users, UserCache * if !node.TabVideo { //过滤非视频节点 return } + if int(node.Progress) == 100 { //过滤看完了的视屏 + return + } videosLock.Add(1) go func() { if int(node.Progress) == 100 { //过滤看完了的视屏