Skip to content

Commit

Permalink
fixed: fixed yinghua can't exam bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Changbaiqi committed Dec 23, 2024
1 parent 865b964 commit fb36703
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,8 +23,7 @@ env:
VERSION: ${{ github.ref_name }} # Dynamic version based on the tag name
RELEASE_DIR: release
RELEASE_NOTICES: |
- [‍👏] 优化学习通部分日志显示
- [‍👏] 优化学习通提交学时算法
- [‍👏] 修复学习通无法正常考试BUG
注:当前学习通功能为测试阶段日志显示比较乱,后续版本更新会调整
Expand Down
2 changes: 1 addition & 1 deletion config/logo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
52 changes: 27 additions & 25 deletions logic/yinghua/YinghuaPart.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) //多携程刷课
}
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 { //过滤看完了的视屏
Expand Down

0 comments on commit fb36703

Please sign in to comment.