From a4a24136412a5fc87d8ffd8f5f0d552196ce2ccd Mon Sep 17 00:00:00 2001 From: hujiebin Date: Wed, 7 Jun 2023 14:07:41 +0800 Subject: [PATCH] Update anniversary.go --- domain/model/cp_m/anniversary.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/domain/model/cp_m/anniversary.go b/domain/model/cp_m/anniversary.go index e930fba..e48d66c 100644 --- a/domain/model/cp_m/anniversary.go +++ b/domain/model/cp_m/anniversary.go @@ -3,6 +3,7 @@ package cp_m import ( "git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/resource/mysql" + "hilo-user/_const/enum/cp_e" "time" ) @@ -10,12 +11,14 @@ import ( type CpAnniversary struct { mysql.Entity CpId mysql.ID + Type cp_e.AnniversaryItemType UserId1 mysql.ID UserId2 mysql.ID Content string Timestamp int64 IsRemind bool Reminded mysql.YesNo + Sort int } // 添加cp纪念日 @@ -52,7 +55,7 @@ func GetAllCpAnniversary(model *domain.Model, userId mysql.ID) []CpAnniversary { if !exists { return res } - if err := model.DB().Model(CpAnniversary{}).Where("cp_id = ?", relation.ID).Order("`timestamp` DESC,id DESC").Find(&res).Error; err != nil { + if err := model.DB().Model(CpAnniversary{}).Where("cp_id = ?", relation.ID).Order("`sort` DESC,updated_time DESC").Find(&res).Error; err != nil { model.Log.Errorf("GetAllCpAnniversary fail:%v", err) } return res -- 2.22.0