diff --git a/cron/cp_cron/anniversary.go b/cron/cp_cron/anniversary.go index 86a89b5f52d6a45a1c216b744aa2892497ac011e..9d31966cfdb243121a457edf7d1ec60e7eb3108a 100644 --- a/cron/cp_cron/anniversary.go +++ b/cron/cp_cron/anniversary.go @@ -1,12 +1,12 @@ package cp_cron import ( - "encoding/json" + "git.hilo.cn/hilo-common/_const/enum/msg_e" "git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/resource/config" "github.com/robfig/cron" "hilo-user/domain/model/cp_m" - "hilo-user/domain/model/user_m" + "hilo-user/domain/model/msg_m" ) // 纪念日 @@ -30,17 +30,13 @@ func CpAnniversaryNotice() { for _, v := range anniversary { var userIds []uint64 userIds = append(userIds, v.UserId1, v.UserId2) - users, err := user_m.GetUsersByIds(model, userIds) - if err != nil || len(users) < 2 { - model.Log.Errorf("GetUserMapByIds fail:%v", err) - continue + 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, "", "", "", "", "") + err1, err2 := record1.Persistent(), record2.Persistent() + if err1 != nil || err2 != nil { + model.Log.Errorf("NewUserRecord fail:%v-%v", err1, err2) + return } - data, _ := json.Marshal(CpAnniversaryNoticeMsg{ - Identifier: "CpAnniversaryNotice", - Content: v.Content, - Timestamp: v.Timestamp, - }) - println(data) // todo 小助手 //if err := tencentyun.BatchSendCustomMsg(model, 1, users[0].ExternalId, []string{users[1].ExternalId}, string(data), "cp纪念日"); err != nil { // model.Log.Errorf("BatchSendCustomMsg fail:%v", err) //}