forked from yuezhongxin/MessageManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76fb46b
commit b3fe705
Showing
9 changed files
with
213 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
MessageManager.Domain/DomainService/DeleteMessageService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* author:xishuai | ||
* address:https://www.github.com/yuezhongxin/MessageManager | ||
**/ | ||
|
||
using MessageManager.Domain.Entity; | ||
using MessageManager.Infrastructure; | ||
namespace MessageManager.Domain.DomainService | ||
{ | ||
/// <summary> | ||
/// DeleteMessage领域服务实现 | ||
/// </summary> | ||
public class DeleteMessageService | ||
{ | ||
public static OperationResponse DeleteMessage(Message message, User operateUser) | ||
{ | ||
if (!(message.SendUser == operateUser || message.ReceiveUser == operateUser)) | ||
{ | ||
return OperationResponse.Error("您并不是收发件人,没有权限删除本条短消息"); | ||
} | ||
//if (message.SendUser == operateUser) | ||
//{ | ||
// operateUser.SendMessages.Remove(message); | ||
//} | ||
//else | ||
//{ | ||
// operateUser.ReceiveMessages.Remove(message); | ||
//} | ||
return OperationResponse.Success("删除短消息成功"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
MessageManager.Domain/DomainService/ReplyMessageService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* author:xishuai | ||
* address:https://www.github.com/yuezhongxin/MessageManager | ||
**/ | ||
|
||
using MessageManager.Domain.Entity; | ||
using MessageManager.Infrastructure; | ||
using System; | ||
using System.Linq; | ||
namespace MessageManager.Domain.DomainService | ||
{ | ||
/// <summary> | ||
/// ReplyMessage领域服务实现 | ||
/// </summary> | ||
public class ReplyMessageService | ||
{ | ||
public static OperationResponse<Message> ReplyMessage(Message message) | ||
{ | ||
//示例业务规则,对象导航关联访问需要探讨 | ||
if (message.SendUser.SendMessages.Where(m => m.SendTime.Date == DateTime.Now.Date).Count() > 200) | ||
{ | ||
return new OperationResponse<Message>(false, "发件人一天之内只能回复200个短消息"); | ||
} | ||
if (message.SendUser.SendMessages.Where(m => m.SendTime.Date == DateTime.Now.Date && m.ReceiveUser == message.ReceiveUser).Count() > 50) | ||
{ | ||
return new OperationResponse<Message>(false, "发件人一天之内只能和同一人回复50个短消息"); | ||
} | ||
//to do... | ||
return new OperationResponse<Message>(true, "回复消息成功", message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.