From eeaa2caea03470695e774fee9fd2d7e1dbd400d4 Mon Sep 17 00:00:00 2001 From: dorlolo <428192774@qq.com> Date: Wed, 15 Mar 2023 09:53:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=80=E8=AF=B7=E5=85=B3=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=96=B0=E5=A2=9E=E6=8C=89=E7=85=A7=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=E5=80=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/internal/dao/artistInfo_user.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/internal/dao/artistInfo_user.go b/cmd/internal/dao/artistInfo_user.go index df94b5b..3e0e577 100644 --- a/cmd/internal/dao/artistInfo_user.go +++ b/cmd/internal/dao/artistInfo_user.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "sort" "time" _ "dubbo.apache.org/dubbo-go/v3/imports" @@ -1098,12 +1099,16 @@ func GetInviteStaticList(in *artistInfoUser.GetInviteStaticListRequest) (res *ar Joins(fmt.Sprintf("LEFT JOIN %v su ON su.invited_code = ui.invite_code", model.User{}.TableName())). Joins((fmt.Sprintf("LEFT JOIN %v rn ON rn.id = su.real_name_id", model.RealName{}.TableName()))). Where("su.deleted_at=0"). - Group("ui.invite_code") + Group("ui.invite_code") //HAVING count(ui.invited_code) >0 if in.KeyWords != "" { orm = orm.Where("rn.name LIKE '%%?%%' OR su.tel_num LIKE '%%?%%' OR su.invited_code LIKE '%%?%%' ", in.KeyWords, in.KeyWords, in.KeyWords) } var datas []inviteStatic err = orm.Count(&res.Page.Total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&datas).Error + //倒序排序 + sort.Slice(datas, func(i, j int) bool { + return datas[i].InvitedCount < datas[j].InvitedCount + }) if len(datas) > 0 { for i, v := range datas { res.Data = append(res.Data, &artistInfoUser.GetInviteStaticListData{