Skip to content

Commit

Permalink
fix getting the first page error
Browse files Browse the repository at this point in the history
  • Loading branch information
SchwarzSail committed Jan 6, 2025
1 parent 3dbfb0e commit 9681462
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions notice.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,21 @@ import (
)

func (s *Student) GetNoticeInfo(req *NoticeInfoReq) (list []*NoticeInfo, err error) {

Check failure on line 29 in notice.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary leading newline (whitespace)

// 获取通知公告页面的总页数
res, err := s.PostWithIdentifier(constants.NoticeInfoQueryURL, map[string]string{})
if err != nil {
return nil, err
}
// 首页直接爬取
if req.PageNum == 1 {
list, err = parseNoticeInfo(res)
if err != nil {
return nil, err
}
return list, nil
}
// 分页需要根据页数计算 url
lastPageNum, err := getTotalPages(res)
if err != nil {
return nil, err
Expand Down Expand Up @@ -82,6 +92,7 @@ func parseNoticeInfo(doc *html.Node) ([]*NoticeInfo, error) {
URL: url,
Date: date,
}
fmt.Println(title)
list = append(list, noticeInfo)
}

Expand Down

0 comments on commit 9681462

Please sign in to comment.