Commit 46ddc687 authored by hujiebin's avatar hujiebin

纪念日的时间

parent f5f4c255
...@@ -12,12 +12,13 @@ type CvCpBase struct { ...@@ -12,12 +12,13 @@ type CvCpBase struct {
} }
type CvCpAnniversary struct { type CvCpAnniversary struct {
Type cp_e.AnniversaryItemType `json:"type"` // 列表类型 0:普通 1:头像 Type cp_e.AnniversaryItemType `json:"type"` // 列表类型 0:普通 1:头像
CpInfo *CvCpBase `json:"cpInfo,omitempty"` // cp信息,type=1(头像)时候用到 CpInfo *CvCpBase `json:"cpInfo,omitempty"` // cp信息,type=1(头像)时候用到
Id uint64 `json:"id"` // 记录id Id uint64 `json:"id"` // 记录id
Content string `json:"content"` // 纪念日内容 Content string `json:"content"` // 纪念日内容
Timestamp int64 `json:"timestamp"` // 纪念日时间戳 OriginTimestamp int64 `json:"originTimestamp"` // 纪念日的时间
IsRemind bool `json:"isRemind"` // 是否提醒 Timestamp int64 `json:"timestamp"` // 下次纪念日时间戳
CanDel bool `json:"canDel"` // 能否删除 IsRemind bool `json:"isRemind"` // 是否提醒
IsTop bool `json:"isTop"` // 是否置顶 CanDel bool `json:"canDel"` // 能否删除
IsTop bool `json:"isTop"` // 是否置顶
} }
...@@ -34,10 +34,10 @@ func InitCpAnniversary(model *domain.Model, cp CpRelationTmp) error { ...@@ -34,10 +34,10 @@ func InitCpAnniversary(model *domain.Model, cp CpRelationTmp) error {
if err := AddCpAnniversary(model, cp_e.AnniversaryItemTypeNormal, cp, "我们在一起", time.Now().Unix(), true, 100); err != nil { if err := AddCpAnniversary(model, cp_e.AnniversaryItemTypeNormal, cp, "我们在一起", time.Now().Unix(), true, 100); err != nil {
return err return err
} }
if err := AddCpAnniversary(model, cp_e.AnniversaryItemTypeAnniversary, cp, fmt.Sprintf("%s的生日", users[cp.UserId1].Nick), int64(users[cp.UserId1].Birthday), true, 0); err != nil { if err := AddCpAnniversary(model, cp_e.AnniversaryItemTypeAnniversary, cp, fmt.Sprintf("%s的生日", users[cp.UserId1].Nick), 0, true, 0); err != nil {
return err return err
} }
if err := AddCpAnniversary(model, cp_e.AnniversaryItemTypeAnniversary, cp, fmt.Sprintf("%s的生日", users[cp.UserId2].Nick), int64(users[cp.UserId2].Birthday), true, 0); err != nil { if err := AddCpAnniversary(model, cp_e.AnniversaryItemTypeAnniversary, cp, fmt.Sprintf("%s的生日", users[cp.UserId2].Nick), 0, true, 0); err != nil {
return err return err
} }
if err := AddCpAnniversary(model, cp_e.AnniversaryItemTypeNormal, cp, "第一次说我爱你", 0, false, 0); err != nil { if err := AddCpAnniversary(model, cp_e.AnniversaryItemTypeNormal, cp, "第一次说我爱你", 0, false, 0); err != nil {
......
...@@ -114,8 +114,9 @@ func PageAnniversary(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -114,8 +114,9 @@ func PageAnniversary(c *gin.Context) (*mycontext.MyContext, error) {
UserInfo: *userInfo, UserInfo: *userInfo,
CpUserInfo: *cpUserInfo, CpUserInfo: *cpUserInfo,
}, },
Timestamp: cpRelation.CreatedTime.Unix(), OriginTimestamp: cpRelation.CreatedTime.Unix(),
CanDel: false, Timestamp: cpRelation.CreatedTime.Unix(),
CanDel: false,
}) })
} }
anniversary := cp_m.GetAllCpAnniversary(model, userId) anniversary := cp_m.GetAllCpAnniversary(model, userId)
...@@ -130,13 +131,14 @@ func PageAnniversary(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -130,13 +131,14 @@ func PageAnniversary(c *gin.Context) (*mycontext.MyContext, error) {
Type = cp_e.AnniversaryItemTypeNormal Type = cp_e.AnniversaryItemTypeNormal
} }
response = append(response, cp_cv.CvCpAnniversary{ response = append(response, cp_cv.CvCpAnniversary{
Type: Type, Type: Type,
Id: v.ID, Id: v.ID,
Content: v.Content, Content: v.Content,
Timestamp: timestamp, Timestamp: timestamp,
IsRemind: v.IsRemind, OriginTimestamp: v.Timestamp,
CanDel: true, IsRemind: v.IsRemind,
IsTop: v.Sort > 0, CanDel: true,
IsTop: v.Sort > 0,
}) })
} }
resp.ResponsePageBaseOk(c, response, 0, false) resp.ResponsePageBaseOk(c, response, 0, false)
......
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