作者 tangxvhui

更新消息弹窗

... ... @@ -183,19 +183,68 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
msgList = append(msgList, adapter.MessageListAdapter{
Content: s,
})
payload := map[string]string{
"id": strconv.Itoa(val.Id),
}
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
Content: s,
CreatedAt: time.Time{},
UpdatedAt: time.Time{},
Payload: string(payloadStr),
}
messageRepo.Save(&newMessage)
}
for _, val := range taskStageList2 {
s := fmt.Sprintf("您下级%s负责的项目【%s】里程碑未按时完成,请前往辅导。", val.LeaderName, val.Name)
msgList = append(msgList, adapter.MessageListAdapter{
Content: s,
})
payload := map[string]string{
"id": strconv.Itoa(val.Id),
}
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
Content: s,
CreatedAt: time.Time{},
UpdatedAt: time.Time{},
Payload: string(payloadStr),
}
messageRepo.Save(&newMessage)
}
for _, val := range taskStageList3 {
s := fmt.Sprintf("【您下级%s关注的项目【%s】里程碑未按时完成,请前往辅导。】", val.LeaderName, val.Name)
msgList = append(msgList, adapter.MessageListAdapter{
Content: s,
})
payload := map[string]string{
"id": strconv.Itoa(val.Id),
}
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
Content: s,
CreatedAt: time.Time{},
UpdatedAt: time.Time{},
Payload: string(payloadStr),
}
messageRepo.Save(&newMessage)
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ... @@ -292,18 +341,66 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
msgList = append(msgList, adapter.MessageListAdapter{
Content: s,
})
payload := map[string]string{
"id": strconv.Itoa(val.Id),
}
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
Content: s,
CreatedAt: time.Time{},
UpdatedAt: time.Time{},
Payload: string(payloadStr),
}
messageRepo.Save(&newMessage)
}
for _, val := range taskStageList2 {
s := fmt.Sprintf("【您下级%s负责的项目【%s】已超过N日未反馈进度,请前往辅导。】", val.LeaderName, val.Name)
msgList = append(msgList, adapter.MessageListAdapter{
Content: s,
})
payload := map[string]string{
"id": strconv.Itoa(val.Id),
}
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
Content: s,
CreatedAt: time.Time{},
UpdatedAt: time.Time{},
Payload: string(payloadStr),
}
messageRepo.Save(&newMessage)
}
for _, val := range taskStageList3 {
s := fmt.Sprintf("【您下级%s关注的项目【%s】已超过N日未反馈进度,请前往辅导。】", val.LeaderName, val.Name)
msgList = append(msgList, adapter.MessageListAdapter{
Content: s,
})
payload := map[string]string{
"id": strconv.Itoa(val.Id),
}
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
Content: s,
CreatedAt: time.Time{},
UpdatedAt: time.Time{},
Payload: string(payloadStr),
}
messageRepo.Save(&newMessage)
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ...