Skip to content

Commit 011f7f2

Browse files
committed
fix:fix some uncorrect description
1 parent 0035701 commit 011f7f2

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

internal/course/service/exam_snapshot_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,10 @@ func TestCourseServiceSendExamNotification(t *testing.T) {
190190
},
191191
).Build()
192192

193-
err := new(CourseService).sendExamNotification(courseExamChange{
193+
new(CourseService).sendExamNotification(courseExamChange{
194194
Tag: utils.MD5("数据结构|张老师|4.0"),
195195
Exam: CourseExamInfo{Name: "数据结构"},
196196
})
197-
198-
assert.NoError(t, err)
199197
})
200198
}
201199
}

internal/course/service/get_course_list.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"github.com/west2-online/fzuhelper-server/pkg/constants"
3535
"github.com/west2-online/fzuhelper-server/pkg/db/model"
3636
"github.com/west2-online/fzuhelper-server/pkg/errno"
37+
"github.com/west2-online/fzuhelper-server/pkg/logger"
3738
"github.com/west2-online/fzuhelper-server/pkg/taskqueue"
3839
"github.com/west2-online/fzuhelper-server/pkg/umeng"
3940
"github.com/west2-online/fzuhelper-server/pkg/utils"
@@ -241,7 +242,8 @@ func (s *CourseService) putExamToDatabase(stuId string, term string, rawCourses
241242
for _, change := range claimed {
242243
// 单个考试变化对应一个 dispatcher task,避免一批变化绕过 Umeng 限流。
243244
_ = umeng.EnqueueAsync(func() error {
244-
return s.sendExamNotification(change)
245+
s.sendExamNotification(change)
246+
return nil
245247
})
246248
}
247249

@@ -258,15 +260,22 @@ func (s *CourseService) updateExamSnapshot(id int64, examInfo, examInfoSHA256 st
258260
return err
259261
}
260262

261-
func (s *CourseService) sendExamNotification(change courseExamChange) error {
263+
func (s *CourseService) sendExamNotification(change courseExamChange) {
262264
// 与成绩通知一致,推送失败仅由 Umeng 任务队列统一记录,不影响业务快照。
265+
// 这里直接不返回错误了,直接打印错误日志,因为就是安卓跟iOS都直推送一次,如果错过就直接算了
263266
title := fmt.Sprintf("%v考试信息更新啦", change.Exam.Name)
264267
description := fmt.Sprintf("考试信息更新%v", change.Tag[:12])
265-
_ = umeng.SendAndroidGroupcastWithGoApp(
268+
if err := umeng.SendAndroidGroupcastWithGoApp(
266269
title, "", "", change.Tag, description, constants.UmengExamRoomDeeplink,
267-
)
268-
_ = umeng.SendIOSGroupcast(title, "", "", change.Tag, description, constants.UmengExamRoomDeeplink)
269-
return nil
270+
); err != nil {
271+
logger.Errorf("CourseService.sendExamNotification: send Android notification failed: %v", err)
272+
}
273+
274+
if err := umeng.SendIOSGroupcast(
275+
title, "", "", change.Tag, description, constants.UmengExamRoomDeeplink,
276+
); err != nil {
277+
logger.Errorf("CourseService.sendExamNotification: send iOS notification failed: %v", err)
278+
}
270279
}
271280

272281
func (s *CourseService) GetCourseListYjsy(req *course.CourseListRequest, loginData *kitexModel.LoginData) ([]*kitexModel.Course, error) {

0 commit comments

Comments
 (0)