From 8750c8e85153427d48025c8987481844e1e06521 Mon Sep 17 00:00:00 2001 From: majun <3060162534@qq.com> Date: Fri, 20 Dec 2024 10:29:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- link_homework/internal/logic/homework/homework.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/link_homework/internal/logic/homework/homework.go b/link_homework/internal/logic/homework/homework.go index c1af4df..c4bdf17 100644 --- a/link_homework/internal/logic/homework/homework.go +++ b/link_homework/internal/logic/homework/homework.go @@ -12,6 +12,7 @@ import ( "link_homework/internal/model/do" "link_homework/internal/model/entity" "link_homework/internal/service" + "sort" ) type ( @@ -69,6 +70,12 @@ func UpdateHomework(ctx context.Context, homeworkList []*entity.ActivityInteract } } } + + // 对 homeworkList 按 Status 升序排序 + sort.Slice(homeworkList, func(i, j int) bool { + return homeworkList[i].Status < homeworkList[j].Status + }) + return homeworkList }