Commit a4a24136 authored by hujiebin's avatar hujiebin

Update anniversary.go

parent 831fb5a9
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment