update 通知公告强化

This commit is contained in:
2021-07-08 18:39:16 +08:00
parent 9c076b1aba
commit 3fdef68de8
10 changed files with 198 additions and 210 deletions

View File

@@ -76,16 +76,17 @@ namespace Ewide.Core.Service.Notice
if (input.Status != (int)NoticeStatus.DRAFT && input.Status != (int)NoticeStatus.PUBLIC)
throw Oops.Oh(ErrorCode.D7000);
var notice = input.Adapt<SysNotice>();
var config = new TypeAdapterConfig().ForType<AddNoticeInput, SysNotice>()
.Map(target => target.Attachments, src => String.Join(",", src.Attachments))
.Config;
var notice = input.Adapt<SysNotice>(config);
var id = System.Guid.NewGuid().ToString().ToLower();
notice.Id = id;
if (input.Attachments!=null)
notice.Attachments = string.Join(",", input.Attachments);
await UpdatePublicInfo(notice);
// 如果是发布,则设置发布时间
if (input.Status == (int)NoticeStatus.PUBLIC)
notice.PublicTime = DateTime.Now;
var newItem = await notice.InsertAsync();
await notice.InsertAsync();
// 通知到的人
var noticeUserIdList = input.NoticeUserIdList;