diff --git a/cron/cp_cron/anniversary.go b/cron/cp_cron/anniversary.go index 9d31966cfdb243121a457edf7d1ec60e7eb3108a..7b54887e85e9397f9835c641dcbbefcf3327833f 100644 --- a/cron/cp_cron/anniversary.go +++ b/cron/cp_cron/anniversary.go @@ -7,6 +7,7 @@ import ( "github.com/robfig/cron" "hilo-user/domain/model/cp_m" "hilo-user/domain/model/msg_m" + "hilo-user/domain/model/user_m" ) // 纪念日 @@ -27,11 +28,20 @@ func CpAnniversaryNotice() { _ = c.AddFunc(spec, func() { var model = domain.CreateModelNil() anniversary := cp_m.GetNeedRemindCpAnniversary(model) + var userIds []uint64 for _, v := range anniversary { - var userIds []uint64 - userIds = append(userIds, v.UserId1, v.UserId2) - record1 := msg_m.NewUserRecord(model, v.UserId1, msg_e.CpAnniversaryNotice, v.Content, 0, "", "", "", "", "") - record2 := msg_m.NewUserRecord(model, v.UserId2, msg_e.CpAnniversaryNotice, v.Content, 0, "", "", "", "", "") + userIds = append(userIds, v.UserId1) + userIds = append(userIds, v.UserId2) + } + users, err := user_m.GetUserMapByIds(model, userIds) + if err != nil { + model.Log.Errorf("GetUserMapByIds fail:%v", err) + } + for _, v := range anniversary { + content1 := cp_m.GetTranslate(285, users[v.UserId1].Language) + content2 := cp_m.GetTranslate(285, users[v.UserId2].Language) + record1 := msg_m.NewUserRecord(model, v.UserId1, msg_e.CpAnniversaryNotice, content1, 0, "", "", "", "", "") + record2 := msg_m.NewUserRecord(model, v.UserId2, msg_e.CpAnniversaryNotice, content2, 0, "", "", "", "", "") err1, err2 := record1.Persistent(), record2.Persistent() if err1 != nil || err2 != nil { model.Log.Errorf("NewUserRecord fail:%v-%v", err1, err2) diff --git a/domain/model/cp_m/level.go b/domain/model/cp_m/level.go index ea6c5a69108c84ff00ba49ffc711c75f66c880b7..55fe3c48b1ed2fd45d389f46a4171c766dbdde8b 100644 --- a/domain/model/cp_m/level.go +++ b/domain/model/cp_m/level.go @@ -294,7 +294,15 @@ func AddCpLevelPoints(model *domain.Model, cpRelation CpRelation, points mysql.N model.Log.Errorf("") return } - if err := rpc.SendCpUpgrade(users[userId1].Nick, users[userId2].Nick, users[userId1].Avatar, users[userId2].Avatar, uint32(cpLevel.Level), "成为 todo"); err != nil { + levelMsgIdMap := map[cp_e.CpLevel]uint{ + cp_e.CpLevel1: 252, + cp_e.CpLevel2: 253, + cp_e.CpLevel3: 254, + cp_e.CpLevel4: 255, + cp_e.CpLevel5: 256, + } + content := fmt.Sprintf(GetTranslate(286, users[userId1].Language), GetTranslate(levelMsgIdMap[cpLevel.Level], users[userId1].Language)) + if err := rpc.SendCpUpgrade(users[userId1].Nick, users[userId2].Nick, users[userId1].Avatar, users[userId2].Avatar, uint32(cpLevel.Level), content); err != nil { model.Log.Errorf("SendCpUpgrade fail:%v", err) } }()