Commit 8d27979c authored by hujiebin's avatar hujiebin

feat:两边的nick

parent 78403c9e
...@@ -108,9 +108,20 @@ func GetAllCpAnniversary(model *domain.Model, userId mysql.ID, lang string) []Cp ...@@ -108,9 +108,20 @@ func GetAllCpAnniversary(model *domain.Model, userId mysql.ID, lang string) []Cp
if err := model.DB().Model(CpAnniversary{}).Where("cp_id = ?", relation.Id).Order("`sort` DESC,updated_time DESC,id ASC").Find(&res).Error; err != nil { if err := model.DB().Model(CpAnniversary{}).Where("cp_id = ?", relation.Id).Order("`sort` DESC,updated_time DESC,id ASC").Find(&res).Error; err != nil {
model.Log.Errorf("GetAllCpAnniversary fail:%v", err) model.Log.Errorf("GetAllCpAnniversary fail:%v", err)
} }
var userIds = []mysql.ID{relation.UserId1, relation.UserId2}
users, _ := user_m.GetUserMapByIds(model, userIds)
n := 0
for i, v := range res { for i, v := range res {
if v.CreatedTime.Equal(v.UpdatedTime) && v.MsgId > 0 { if v.CreatedTime.Equal(v.UpdatedTime) && v.MsgId > 0 {
res[i].Content = GetTranslate(v.MsgId, lang) res[i].Content = GetTranslate(v.MsgId, lang)
if v.MsgId == 260 {
n++
if n == 1 {
res[i].Content = fmt.Sprintf(GetTranslate(v.MsgId, lang), users[relation.UserId1].Nick)
} else {
res[i].Content = fmt.Sprintf(GetTranslate(v.MsgId, lang), users[relation.UserId2].Nick)
}
}
} }
} }
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