Skip to content

Commit

Permalink
update: update xutxitong log show
Browse files Browse the repository at this point in the history
  • Loading branch information
Changbaiqi committed Dec 20, 2024
1 parent 02e0c25 commit 3039960
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
)

require github.com/yatori-dev/yatori-go-core v1.2.0
require github.com/yatori-dev/yatori-go-core v1.2.1

require (
github.com/PuerkitoBio/goquery v1.10.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho=
github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE=
github.com/yalue/onnxruntime_go v1.12.1 h1:joCCmBnNjHy04jK9EMP/UV6oPPqySXlRgf3gcUcnI/g=
github.com/yalue/onnxruntime_go v1.12.1/go.mod h1:b4X26A8pekNb1ACJ58wAXgNKeUCGEAQ9dmACut9Sm/4=
github.com/yatori-dev/yatori-go-core v1.2.0 h1:NqkiV4gQf4ZvKVXL9cHR4jt0yNwGIhSnTvsnGbLEy5A=
github.com/yatori-dev/yatori-go-core v1.2.0/go.mod h1:M32eb5ULwWC5We8QD1653UpdWldfv7wNdMB8UgdDVdw=
github.com/yatori-dev/yatori-go-core v1.2.1 h1:v5fc7mBeliiPKtzMJoK5pUbHO1UbmMlOTh80JGTa8SA=
github.com/yatori-dev/yatori-go-core v1.2.1/go.mod h1:M32eb5ULwWC5We8QD1653UpdWldfv7wNdMB8UgdDVdw=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
Expand Down
25 changes: 17 additions & 8 deletions logic/xuexitong/XueXiTongPart.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"github.com/thedevsaddam/gojsonq"
xuexitong "github.com/yatori-dev/yatori-go-core/aggregation/xuexitong"
"github.com/yatori-dev/yatori-go-core/aggregation/xuexitong/point"
"github.com/yatori-dev/yatori-go-core/api/entity"
xuexitongApi "github.com/yatori-dev/yatori-go-core/api/xuexitong"
lg "github.com/yatori-dev/yatori-go-core/utils/log"
Expand Down Expand Up @@ -153,10 +152,8 @@ func nodeListStudy(setting config.Setting, user *config.Users, userCache *xuexit
log.Fatal(err)
}
documentDTO.AttachmentsDetection(card)
point.ExecuteDocument(userCache, &documentDTO)
if err != nil {
log.Fatal(err)
}
//point.ExecuteDocument(userCache, &documentDTO)
ExecuteDocument(userCache, &documentDTO)
time.Sleep(5 * time.Second)
}
}
Expand All @@ -165,13 +162,13 @@ func nodeListStudy(setting config.Setting, user *config.Users, userCache *xuexit
videosLock.Done()
}

// 常规刷视屏逻辑
// 常规刷视频逻辑
func ExecuteVideo(cache *xuexitongApi.XueXiTUserCache, p *entity.PointVideoDto) {
if state, _ := xuexitong.VideoDtoFetchAction(cache, p); state {
var playingTime = p.PlayTime
for {
if p.Duration-playingTime >= 58 {
playReport, err := cache.VideoDtoPlayReport(p, playingTime, 0)
playReport, err := cache.VideoDtoPlayReport(p, playingTime, 0, 8, nil)
if gojsonq.New().JSONString(playReport).Find("isPassed") == nil || err != nil {
lg.Print(lg.INFO, `[`, cache.Name, `] `, lg.BoldRed, "提交学时接口访问异常,返回信息:", playReport, err.Error())
}
Expand All @@ -183,7 +180,7 @@ func ExecuteVideo(cache *xuexitongApi.XueXiTUserCache, p *entity.PointVideoDto)
playingTime = playingTime + 58
time.Sleep(58 * time.Second)
} else if p.Duration-playingTime < 58 {
playReport, err := cache.VideoDtoPlayReport(p, p.Duration, 2)
playReport, err := cache.VideoDtoPlayReport(p, p.Duration, 2, 8, nil)
if gojsonq.New().JSONString(playReport).Find("isPassed") == nil || err != nil {
lg.Print(lg.INFO, `[`, cache.Name, `] `, lg.BoldRed, "提交学时接口访问异常,返回信息:", playReport, err.Error())
}
Expand All @@ -199,3 +196,15 @@ func ExecuteVideo(cache *xuexitongApi.XueXiTUserCache, p *entity.PointVideoDto)
log.Fatal("视频解析失败")
}
}

// 常规刷文档逻辑
func ExecuteDocument(cache *xuexitongApi.XueXiTUserCache, p *entity.PointDocumentDto) {
report, err := cache.DocumentDtoReadingReport(p)
if gojsonq.New().JSONString(report).Find("status") == nil || err != nil {
lg.Print(lg.INFO, `[`, cache.Name, `] `, lg.BoldRed, "提交学时接口访问异常,返回信息:", report, err.Error())
log.Fatalln(err)
}
if gojsonq.New().JSONString(report).Find("status").(bool) {
lg.Print(lg.INFO, "[", lg.Green, cache.Name, lg.Default, "] ", " 【", p.Title, "】 >>> ", "文档阅览状态:", lg.Green, lg.Green, strconv.FormatBool(gojsonq.New().JSONString(report).Find("status").(bool)), lg.Default, " ")
}
}

0 comments on commit 3039960

Please sign in to comment.