Commit a4a24136 authored by hujiebin's avatar hujiebin

Update anniversary.go

parent 831fb5a9
...@@ -3,6 +3,7 @@ package cp_m ...@@ -3,6 +3,7 @@ package cp_m
import ( import (
"git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql" "git.hilo.cn/hilo-common/resource/mysql"
"hilo-user/_const/enum/cp_e"
"time" "time"
) )
...@@ -10,12 +11,14 @@ import ( ...@@ -10,12 +11,14 @@ import (
type CpAnniversary struct { type CpAnniversary struct {
mysql.Entity mysql.Entity
CpId mysql.ID CpId mysql.ID
Type cp_e.AnniversaryItemType
UserId1 mysql.ID UserId1 mysql.ID
UserId2 mysql.ID UserId2 mysql.ID
Content string Content string
Timestamp int64 Timestamp int64
IsRemind bool IsRemind bool
Reminded mysql.YesNo Reminded mysql.YesNo
Sort int
} }
// 添加cp纪念日 // 添加cp纪念日
...@@ -52,7 +55,7 @@ func GetAllCpAnniversary(model *domain.Model, userId mysql.ID) []CpAnniversary { ...@@ -52,7 +55,7 @@ func GetAllCpAnniversary(model *domain.Model, userId mysql.ID) []CpAnniversary {
if !exists { if !exists {
return res 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) model.Log.Errorf("GetAllCpAnniversary fail:%v", err)
} }
return res 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