diff --git a/link_homework/internal/logic/homework/homework.go b/link_homework/internal/logic/homework/homework.go
index e5470b2..2491b42 100644
--- a/link_homework/internal/logic/homework/homework.go
+++ b/link_homework/internal/logic/homework/homework.go
@@ -12,7 +12,6 @@ import (
"link_homework/internal/model/do"
"link_homework/internal/model/entity"
"link_homework/internal/service"
- "sort"
)
type (
@@ -41,7 +40,7 @@ func (s *sHomework) GetHomeworkList(ctx context.Context, pageNo int, pageSize in
}
// 如果Redis中没有数据,查询数据库
- err = dao.ActivityInteractiveGroup.Ctx(ctx).With(entity.Live{}).Order("start_date desc, end_date desc").Page(pageNo, pageSize).Scan(&homeworkList)
+ err = dao.ActivityInteractiveGroup.Ctx(ctx).With(entity.Live{}).OrderDesc("created_at").Page(pageNo, pageSize).Scan(&homeworkList)
err = g.DB("cms").Model("fx_article").Where("id", gdb.ListItemValuesUnique(homeworkList, "ArticleId")).ScanList(&homeworkList, "Article", "id:ArticleId")
homeworkList = UpdateHomework(ctx, homeworkList)
if err != nil {
@@ -71,20 +70,6 @@ func UpdateHomework(ctx context.Context, homeworkList []*entity.ActivityInteract
}
}
- // 对 homeworkList 进行排序
- sort.Slice(homeworkList, func(i, j int) bool {
- if homeworkList[i].Status != homeworkList[j].Status {
- return homeworkList[i].Status < homeworkList[j].Status
- }
- if homeworkList[i].Status == 0 {
- return homeworkList[i].StartDate.Before(homeworkList[j].StartDate)
- }
- if homeworkList[i].Status == 1 {
- return homeworkList[i].EndDate.Before(homeworkList[j].EndDate)
- }
- return false
- })
-
return homeworkList
}