54 changed files with 4983 additions and 1559 deletions
@ -1,27 +1,42 @@ |
|||
using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; |
|||
using LINGYUN.Abp.IM.SignalR.Messages; |
|||
using LINGYUN.Abp.RealTime.SignalR; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.IM.SignalR |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpIMModule), |
|||
typeof(AbpRealTimeSignalRModule), |
|||
typeof(AbpAspNetCoreSignalRJwtTokenModule))] |
|||
public class AbpIMSignalRModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpIMOptions>(options => |
|||
{ |
|||
options.Providers.Add<SignalRMessageSenderProvider>(); |
|||
}); |
|||
|
|||
Configure<AbpAspNetCoreSignalRJwtTokenMapPathOptions>(options => |
|||
{ |
|||
options.MapPath("messages"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; |
|||
using LINGYUN.Abp.IM.Localization; |
|||
using LINGYUN.Abp.IM.SignalR.Messages; |
|||
using LINGYUN.Abp.RealTime.SignalR; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace LINGYUN.Abp.IM.SignalR |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpIMModule), |
|||
typeof(AbpRealTimeSignalRModule), |
|||
typeof(AbpAspNetCoreSignalRJwtTokenModule))] |
|||
public class AbpIMSignalRModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpIMOptions>(options => |
|||
{ |
|||
options.Providers.Add<SignalRMessageSenderProvider>(); |
|||
}); |
|||
|
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpIMSignalRModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Get<AbpIMResource>() |
|||
.AddVirtualJson("/LINGYUN/Abp/IM/SignalR/Localization/Resources"); |
|||
}); |
|||
|
|||
Configure<AbpAspNetCoreSignalRJwtTokenMapPathOptions>(options => |
|||
{ |
|||
options.MapPath("messages"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"Messages:RecallMessage": "{User} cancel a message" |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"Messages:RecallMessage": "{User} 撤回了一条消息" |
|||
} |
|||
} |
|||
@ -1,13 +1,31 @@ |
|||
using LINGYUN.Abp.RealTime; |
|||
using LINGYUN.Abp.IM.Localization; |
|||
using LINGYUN.Abp.RealTime; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace LINGYUN.Abp.IM |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpEventBusModule), |
|||
typeof(AbpRealTimeModule))] |
|||
typeof(AbpRealTimeModule), |
|||
typeof(AbpLocalizationModule))] |
|||
public class AbpIMModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpIMModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Add<AbpIMResource>() |
|||
.AddVirtualJson("/LINGYUN/Abp/IM/Localization/Resources"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace LINGYUN.Abp.IM.Localization |
|||
{ |
|||
[LocalizationResourceName("AbpIM")] |
|||
public class AbpIMResource |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
} |
|||
} |
|||
@ -1,82 +1,236 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.ObjectExtending; |
|||
|
|||
namespace LINGYUN.Abp.IM.Messages |
|||
{ |
|||
[Serializable] |
|||
[EventName("im.message")] |
|||
public class ChatMessage : ExtensibleObject |
|||
{ |
|||
/// <summary>
|
|||
/// 租户
|
|||
/// </summary>
|
|||
public Guid? TenantId { get; set; } |
|||
/// <summary>
|
|||
/// 群组标识
|
|||
/// </summary>
|
|||
public string GroupId { get; set; } |
|||
/// <summary>
|
|||
/// 消息标识
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 调用者无需关注此字段,将由服务自动生成
|
|||
/// </remarks>
|
|||
public string MessageId { get; set; } |
|||
/// <summary>
|
|||
/// 发送者标识
|
|||
/// </summary>
|
|||
public Guid FormUserId { get; set; } |
|||
/// <summary>
|
|||
/// 发送者名称
|
|||
/// </summary>
|
|||
public string FormUserName { get; set; } |
|||
/// <summary>
|
|||
/// 接收用户标识
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 设计为可空是为了兼容群聊消息
|
|||
/// /remarks>
|
|||
public Guid? ToUserId { get; set; } |
|||
/// <summary>
|
|||
/// 消息内容
|
|||
/// </summary>
|
|||
[DisableAuditing] |
|||
public string Content { get; set; } |
|||
/// <summary>
|
|||
/// 发送时间
|
|||
/// </summary>
|
|||
public DateTime SendTime { get; set; } |
|||
/// <summary>
|
|||
/// 是否匿名发送(存储在扩展字段)
|
|||
/// </summary>
|
|||
public bool IsAnonymous { get; set; } |
|||
/// <summary>
|
|||
/// 消息类型
|
|||
/// </summary>
|
|||
public MessageType MessageType { get; set; } = MessageType.Text; |
|||
|
|||
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
|||
{ |
|||
var results = ExtensibleObjectValidator.GetValidationErrors(this, validationContext); |
|||
|
|||
foreach (var result in ValidateReceiver(validationContext)) |
|||
{ |
|||
results.Add(result); |
|||
} |
|||
|
|||
return results; |
|||
} |
|||
|
|||
protected virtual IEnumerable<ValidationResult> ValidateReceiver(ValidationContext validationContext) |
|||
{ |
|||
if (GroupId.IsNullOrWhiteSpace() && !ToUserId.HasValue) |
|||
{ |
|||
yield return new ValidationResult(""); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.RealTime.Localization; |
|||
using System; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Timing; |
|||
|
|||
namespace LINGYUN.Abp.IM.Messages |
|||
{ |
|||
[Serializable] |
|||
[EventName("im.message")] |
|||
public class ChatMessage : IHasExtraProperties |
|||
{ |
|||
/// <summary>
|
|||
/// 租户
|
|||
/// </summary>
|
|||
public Guid? TenantId { get; set; } |
|||
/// <summary>
|
|||
/// 群组标识
|
|||
/// </summary>
|
|||
public string GroupId { get; set; } |
|||
/// <summary>
|
|||
/// 消息标识
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 调用者无需关注此字段,将由服务自动生成
|
|||
/// </remarks>
|
|||
public string MessageId { get; set; } |
|||
/// <summary>
|
|||
/// 发送者标识
|
|||
/// </summary>
|
|||
public Guid FormUserId { get; set; } |
|||
/// <summary>
|
|||
/// 发送者名称
|
|||
/// </summary>
|
|||
public string FormUserName { get; set; } |
|||
/// <summary>
|
|||
/// 接收用户标识
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 设计为可空是为了兼容群聊消息
|
|||
/// /remarks>
|
|||
public Guid? ToUserId { get; set; } |
|||
/// <summary>
|
|||
/// 消息内容
|
|||
/// </summary>
|
|||
[DisableAuditing] |
|||
public string Content { get; set; } |
|||
/// <summary>
|
|||
/// 发送时间
|
|||
/// </summary>
|
|||
public DateTime SendTime { get; set; } |
|||
/// <summary>
|
|||
/// 是否匿名发送(存储在扩展字段)
|
|||
/// </summary>
|
|||
public bool IsAnonymous { get; set; } |
|||
/// <summary>
|
|||
/// 消息类型
|
|||
/// </summary>
|
|||
public MessageType MessageType { get; set; } = MessageType.Text; |
|||
|
|||
public MessageSourceTye Source { get; set; } = MessageSourceTye.User; |
|||
|
|||
public ExtraPropertyDictionary ExtraProperties { get; set; } |
|||
|
|||
public ChatMessage() |
|||
{ |
|||
ExtraProperties = new ExtraPropertyDictionary(); |
|||
this.SetDefaultsForExtraProperties(); |
|||
} |
|||
|
|||
public static ChatMessage User( |
|||
Guid formUserId, |
|||
string formUserName, |
|||
Guid toUserId, |
|||
string content, |
|||
IClock clock, |
|||
bool isAnonymous = false, |
|||
MessageType type = MessageType.Text, |
|||
MessageSourceTye souce = MessageSourceTye.User, |
|||
Guid? tenantId = null) |
|||
{ |
|||
return new ChatMessage |
|||
{ |
|||
FormUserId = formUserId, |
|||
FormUserName = formUserName, |
|||
ToUserId = toUserId, |
|||
Content = content, |
|||
SendTime = clock.Now, |
|||
IsAnonymous = isAnonymous, |
|||
MessageType = type, |
|||
TenantId = tenantId, |
|||
Source = souce, |
|||
}; |
|||
} |
|||
public static ChatMessage System( |
|||
Guid formUserId, |
|||
Guid toUserId, |
|||
string content, |
|||
IClock clock, |
|||
MessageType type = MessageType.Text, |
|||
Guid? tenantId = null) |
|||
{ |
|||
return new ChatMessage |
|||
{ |
|||
FormUserId = formUserId, |
|||
FormUserName = "system", |
|||
ToUserId = toUserId, |
|||
Content = content, |
|||
SendTime = clock.Now, |
|||
IsAnonymous = false, |
|||
MessageType = type, |
|||
TenantId = tenantId, |
|||
Source = MessageSourceTye.System, |
|||
} |
|||
.SetProperty("L", false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 本地化系统消息
|
|||
/// 用户消息与群组消息不能使用多语言
|
|||
/// </summary>
|
|||
/// <param name="formUserId"></param>
|
|||
/// <param name="toUserId"></param>
|
|||
/// <param name="content"></param>
|
|||
/// <param name="clock"></param>
|
|||
/// <param name="type"></param>
|
|||
/// <param name="tenantId"></param>
|
|||
/// <returns></returns>
|
|||
public static ChatMessage SystemLocalized( |
|||
Guid formUserId, |
|||
Guid toUserId, |
|||
LocalizableStringInfo content, |
|||
IClock clock, |
|||
MessageType type = MessageType.Text, |
|||
Guid? tenantId = null) |
|||
{ |
|||
return new ChatMessage |
|||
{ |
|||
FormUserId = formUserId, |
|||
FormUserName = "system", |
|||
ToUserId = toUserId, |
|||
Content = "", |
|||
SendTime = clock.Now, |
|||
IsAnonymous = false, |
|||
MessageType = type, |
|||
TenantId = tenantId, |
|||
Source = MessageSourceTye.System, |
|||
} |
|||
.SetProperty("L", true) |
|||
.SetProperty(nameof(ChatMessage.Content).ToPascalCase(), content); |
|||
} |
|||
|
|||
public static ChatMessage System( |
|||
Guid formUserId, |
|||
string groupId, |
|||
string content, |
|||
IClock clock, |
|||
MessageType type = MessageType.Text, |
|||
Guid? tenantId = null) |
|||
{ |
|||
return new ChatMessage |
|||
{ |
|||
FormUserId = formUserId, |
|||
FormUserName = "system", |
|||
GroupId = groupId, |
|||
Content = content, |
|||
SendTime = clock.Now, |
|||
IsAnonymous = false, |
|||
MessageType = type, |
|||
TenantId = tenantId, |
|||
Source = MessageSourceTye.System, |
|||
} |
|||
.SetProperty("L", false); |
|||
} |
|||
/// <summary>
|
|||
/// 本地化系统消息
|
|||
/// 用户消息与群组消息不能使用多语言
|
|||
/// </summary>
|
|||
/// <param name="formUserId"></param>
|
|||
/// <param name="groupId"></param>
|
|||
/// <param name="content"></param>
|
|||
/// <param name="clock"></param>
|
|||
/// <param name="type"></param>
|
|||
/// <param name="tenantId"></param>
|
|||
/// <returns></returns>
|
|||
public static ChatMessage SystemLocalized( |
|||
Guid formUserId, |
|||
string groupId, |
|||
LocalizableStringInfo content, |
|||
IClock clock, |
|||
MessageType type = MessageType.Text, |
|||
Guid? tenantId = null) |
|||
{ |
|||
return new ChatMessage |
|||
{ |
|||
FormUserId = formUserId, |
|||
FormUserName = "system", |
|||
GroupId = groupId, |
|||
Content = "", |
|||
SendTime = clock.Now, |
|||
IsAnonymous = false, |
|||
MessageType = type, |
|||
TenantId = tenantId, |
|||
Source = MessageSourceTye.System, |
|||
} |
|||
.SetProperty("L", true) |
|||
.SetProperty(nameof(ChatMessage.Content).ToPascalCase(), content); |
|||
} |
|||
|
|||
public static ChatMessage Group( |
|||
Guid formUserId, |
|||
string formUserName, |
|||
string groupId, |
|||
string content, |
|||
IClock clock, |
|||
bool isAnonymous = false, |
|||
MessageType type = MessageType.Text, |
|||
MessageSourceTye souce = MessageSourceTye.User, |
|||
Guid? tenantId = null) |
|||
{ |
|||
return new ChatMessage |
|||
{ |
|||
FormUserId = formUserId, |
|||
FormUserName = formUserName, |
|||
GroupId = groupId, |
|||
Content = content, |
|||
SendTime = clock.Now, |
|||
IsAnonymous = isAnonymous, |
|||
MessageType = type, |
|||
TenantId = tenantId, |
|||
Source = souce, |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,9 +1,69 @@ |
|||
namespace LINGYUN.Abp.IM.Messages |
|||
{ |
|||
/// <summary>
|
|||
/// 上一次通讯消息
|
|||
/// </summary>
|
|||
public class LastChatMessage : ChatMessage |
|||
{ |
|||
} |
|||
} |
|||
using System; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace LINGYUN.Abp.IM.Messages |
|||
{ |
|||
/// <summary>
|
|||
/// 上一次通讯消息
|
|||
/// </summary>
|
|||
public class LastChatMessage : IHasExtraProperties |
|||
{ |
|||
public string AvatarUrl { get; set; } |
|||
public string Object { get; set; } |
|||
/// <summary>
|
|||
/// 租户
|
|||
/// </summary>
|
|||
public Guid? TenantId { get; set; } |
|||
/// <summary>
|
|||
/// 群组标识
|
|||
/// </summary>
|
|||
public string GroupId { get; set; } |
|||
/// <summary>
|
|||
/// 消息标识
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 调用者无需关注此字段,将由服务自动生成
|
|||
/// </remarks>
|
|||
public string MessageId { get; set; } |
|||
/// <summary>
|
|||
/// 发送者标识
|
|||
/// </summary>
|
|||
public Guid FormUserId { get; set; } |
|||
/// <summary>
|
|||
/// 发送者名称
|
|||
/// </summary>
|
|||
public string FormUserName { get; set; } |
|||
/// <summary>
|
|||
/// 接收用户标识
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 设计为可空是为了兼容群聊消息
|
|||
/// /remarks>
|
|||
public string ToUserId { get; set; } |
|||
/// <summary>
|
|||
/// 消息内容
|
|||
/// </summary>
|
|||
[DisableAuditing] |
|||
public string Content { get; set; } |
|||
/// <summary>
|
|||
/// 发送时间
|
|||
/// </summary>
|
|||
public DateTime SendTime { get; set; } |
|||
/// <summary>
|
|||
/// 是否匿名发送(存储在扩展字段)
|
|||
/// </summary>
|
|||
public bool IsAnonymous => this.GetProperty(nameof(IsAnonymous), false); |
|||
/// <summary>
|
|||
/// 消息类型
|
|||
/// </summary>
|
|||
public MessageType MessageType { get; set; } |
|||
|
|||
public MessageSourceTye Source { get; set; } |
|||
public ExtraPropertyDictionary ExtraProperties { get; set; } |
|||
public LastChatMessage() |
|||
{ |
|||
ExtraProperties = new ExtraPropertyDictionary(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,8 @@ |
|||
namespace LINGYUN.Abp.IM.Messages |
|||
{ |
|||
public enum MessageSourceTye |
|||
{ |
|||
User = 0, |
|||
System = 10, |
|||
} |
|||
} |
|||
@ -1,31 +1,31 @@ |
|||
using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; |
|||
using LINGYUN.Abp.RealTime.SignalR; |
|||
using Volo.Abp.AspNetCore.SignalR; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.Notifications.SignalR |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpRealTimeSignalRModule), |
|||
typeof(AbpNotificationModule), |
|||
typeof(AbpAspNetCoreSignalRModule), |
|||
typeof(AbpAspNetCoreSignalRJwtTokenModule))] |
|||
public class AbpNotificationsSignalRModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpNotificationOptions>(options => |
|||
{ |
|||
options.PublishProviders.Add<SignalRNotificationPublishProvider>(); |
|||
options.NotificationDataMappings |
|||
.MappingDefault(SignalRNotificationPublishProvider.ProviderName, |
|||
data => data); |
|||
}); |
|||
|
|||
Configure<AbpAspNetCoreSignalRJwtTokenMapPathOptions>(options => |
|||
{ |
|||
options.MapPath("notifications"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; |
|||
using LINGYUN.Abp.RealTime.SignalR; |
|||
using Volo.Abp.AspNetCore.SignalR; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.Notifications.SignalR |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpRealTimeSignalRModule), |
|||
typeof(AbpNotificationModule), |
|||
typeof(AbpAspNetCoreSignalRModule), |
|||
typeof(AbpAspNetCoreSignalRJwtTokenModule))] |
|||
public class AbpNotificationsSignalRModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpNotificationOptions>(options => |
|||
{ |
|||
options.PublishProviders.Add<SignalRNotificationPublishProvider>(); |
|||
options.NotificationDataMappings |
|||
.MappingDefault(SignalRNotificationPublishProvider.ProviderName, |
|||
data => data.ToSignalRData()); |
|||
}); |
|||
|
|||
Configure<AbpAspNetCoreSignalRJwtTokenMapPathOptions>(options => |
|||
{ |
|||
options.MapPath("notifications"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,10 @@ |
|||
namespace LINGYUN.Abp.Notifications.SignalR |
|||
{ |
|||
internal static class NotificationDataExtensions |
|||
{ |
|||
public static NotificationData ToSignalRData(this NotificationData data) |
|||
{ |
|||
return data; |
|||
} |
|||
} |
|||
} |
|||
@ -1,190 +1,165 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.Notifications |
|||
{ |
|||
/// <summary>
|
|||
/// 通知数据
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// TODO: 2020-10-29 针对不同语言的用户,如果在发布时期就本地化语言是错误的设计
|
|||
/// 把通知的标题和内容设计为 <see cref="LocalizableStringInfo"/> 让客户端自行本地化
|
|||
/// </remarks>
|
|||
[Serializable] |
|||
[EventName("notifications")] |
|||
public class NotificationData |
|||
{ |
|||
/// <summary>
|
|||
/// 用来标识是否需要本地化的信息
|
|||
/// </summary>
|
|||
public const string LocalizerKey = "localizer"; |
|||
|
|||
public virtual string Type => GetType().FullName; |
|||
|
|||
public object this[string key] |
|||
{ |
|||
get |
|||
{ |
|||
if(Properties.TryGetValue(key, out object @obj)) |
|||
{ |
|||
return @obj; |
|||
} |
|||
return null; |
|||
} |
|||
set { Properties[key] = value; } |
|||
} |
|||
|
|||
public Dictionary<string, object> Properties |
|||
{ |
|||
get { return _properties; } |
|||
set |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
throw new ArgumentNullException(nameof(value)); |
|||
} |
|||
|
|||
foreach (var keyValue in value) |
|||
{ |
|||
if (!_properties.ContainsKey(keyValue.Key)) |
|||
{ |
|||
_properties[keyValue.Key] = keyValue.Value; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
private readonly Dictionary<string, object> _properties; |
|||
|
|||
public NotificationData() |
|||
{ |
|||
_properties = new Dictionary<string, object>(); |
|||
TrySetData(LocalizerKey, false); |
|||
} |
|||
/// <summary>
|
|||
/// 写入本地化的消息数据
|
|||
/// </summary>
|
|||
/// <param name="title"></param>
|
|||
/// <param name="message"></param>
|
|||
/// <param name="createTime"></param>
|
|||
/// <param name="formUser"></param>
|
|||
/// <param name="description"></param>
|
|||
/// <returns></returns>
|
|||
public NotificationData WriteLocalizedData( |
|||
LocalizableStringInfo title, |
|||
LocalizableStringInfo message, |
|||
DateTime createTime, |
|||
string formUser, |
|||
LocalizableStringInfo description = null) |
|||
{ |
|||
TrySetData("title", title); |
|||
TrySetData("message", message); |
|||
TrySetData("formUser", formUser); |
|||
TrySetData("createTime", createTime); |
|||
TrySetData(LocalizerKey, true); |
|||
if (description != null) |
|||
{ |
|||
TrySetData("description", description); |
|||
} |
|||
return this; |
|||
} |
|||
/// <summary>
|
|||
/// 写入标准数据
|
|||
/// </summary>
|
|||
/// <param name="title">标题</param>
|
|||
/// <param name="message">内容</param>
|
|||
/// <param name="createTime">创建时间</param>
|
|||
/// <param name="formUser">来源用户</param>
|
|||
/// <param name="description">附加说明</param>
|
|||
/// <returns></returns>
|
|||
public NotificationData WriteStandardData(string title, string message, DateTime createTime, string formUser, string description = "") |
|||
{ |
|||
TrySetData("title", title); |
|||
TrySetData("message", message); |
|||
TrySetData("description", description); |
|||
TrySetData("formUser", formUser); |
|||
TrySetData("createTime", createTime); |
|||
TrySetData(LocalizerKey, false); |
|||
return this; |
|||
} |
|||
/// <summary>
|
|||
/// 写入标准数据
|
|||
/// </summary>
|
|||
/// <param name="prefix">数据前缀</param>
|
|||
/// <param name="key">标识</param>
|
|||
/// <param name="value">数据内容</param>
|
|||
/// <returns></returns>
|
|||
public NotificationData WriteStandardData(string prefix, string key, object value) |
|||
{ |
|||
TrySetData(string.Concat(prefix, key), value); |
|||
TrySetData(LocalizerKey, false); |
|||
return this; |
|||
} |
|||
/// <summary>
|
|||
/// 转换为标准数据
|
|||
/// </summary>
|
|||
/// <param name="sourceData">原始数据</param>
|
|||
/// <returns></returns>
|
|||
public static NotificationData ToStandardData(NotificationData sourceData) |
|||
{ |
|||
var data = new NotificationData(); |
|||
data.TrySetData("title", sourceData.TryGetData("title")); |
|||
data.TrySetData("message", sourceData.TryGetData("message")); |
|||
data.TrySetData("description", sourceData.TryGetData("description")); |
|||
data.TrySetData("formUser", sourceData.TryGetData("formUser")); |
|||
data.TrySetData("createTime", sourceData.TryGetData("createTime")); |
|||
data.TrySetData(LocalizerKey, sourceData.TryGetData(LocalizerKey)); |
|||
return data; |
|||
} |
|||
/// <summary>
|
|||
/// 转换为标准数据
|
|||
/// </summary>
|
|||
/// <param name="prefix">数据前缀</param>
|
|||
/// <param name="sourceData">原始数据</param>
|
|||
/// <returns></returns>
|
|||
public static NotificationData ToStandardData(string prefix, NotificationData sourceData) |
|||
{ |
|||
var data = ToStandardData(sourceData); |
|||
|
|||
foreach(var property in sourceData.Properties) |
|||
{ |
|||
if (property.Key.StartsWith(prefix)) |
|||
{ |
|||
var key = property.Key.Replace(prefix, ""); |
|||
data.TrySetData(key, property.Value); |
|||
} |
|||
} |
|||
return data; |
|||
} |
|||
|
|||
public object TryGetData(string key) |
|||
{ |
|||
if (Properties.TryGetValue(key, out object value)) |
|||
{ |
|||
return value; |
|||
} |
|||
return null; |
|||
} |
|||
public void TrySetData(string key, object value) |
|||
{ |
|||
if (value != null && !Properties.ContainsKey(key)) |
|||
{ |
|||
Properties.Add(key, value); |
|||
} |
|||
Properties[key] = value; |
|||
} |
|||
/// <summary>
|
|||
/// 需要本地化
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public bool NeedLocalizer() |
|||
{ |
|||
var localizer = TryGetData(LocalizerKey); |
|||
if (localizer != null && localizer is bool needLocalizer) |
|||
{ |
|||
return needLocalizer; |
|||
} |
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.RealTime.Localization; |
|||
using System; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.Notifications |
|||
{ |
|||
/// <summary>
|
|||
/// 通知数据
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// TODO: 2020-10-29 针对不同语言的用户,如果在发布时期就本地化语言是错误的设计
|
|||
/// 把通知的标题和内容设计为 <see cref="LocalizableStringInfo"/> 让客户端自行本地化
|
|||
/// </remarks>
|
|||
[Serializable] |
|||
[EventName("notifications")] |
|||
public class NotificationData : IHasExtraProperties |
|||
{ |
|||
/// <summary>
|
|||
/// 用来标识是否需要本地化的信息
|
|||
/// </summary>
|
|||
public const string LocalizerKey = "L"; |
|||
|
|||
public virtual string Type => GetType().FullName; |
|||
|
|||
public object this[string key] |
|||
{ |
|||
get |
|||
{ |
|||
return this.GetProperty(key); |
|||
} |
|||
set |
|||
{ |
|||
this.SetProperty(key, value); |
|||
} |
|||
} |
|||
|
|||
public ExtraPropertyDictionary ExtraProperties { get; set; } |
|||
|
|||
public NotificationData() |
|||
{ |
|||
ExtraProperties = new ExtraPropertyDictionary(); |
|||
this.SetDefaultsForExtraProperties(); |
|||
|
|||
TrySetData(LocalizerKey, false); |
|||
} |
|||
/// <summary>
|
|||
/// 写入本地化的消息数据
|
|||
/// </summary>
|
|||
/// <param name="title"></param>
|
|||
/// <param name="message"></param>
|
|||
/// <param name="createTime"></param>
|
|||
/// <param name="formUser"></param>
|
|||
/// <param name="description"></param>
|
|||
/// <returns></returns>
|
|||
public NotificationData WriteLocalizedData( |
|||
LocalizableStringInfo title, |
|||
LocalizableStringInfo message, |
|||
DateTime createTime, |
|||
string formUser, |
|||
LocalizableStringInfo description = null) |
|||
{ |
|||
TrySetData("title", title); |
|||
TrySetData("message", message); |
|||
TrySetData("formUser", formUser); |
|||
TrySetData("createTime", createTime); |
|||
TrySetData(LocalizerKey, true); |
|||
if (description != null) |
|||
{ |
|||
TrySetData("description", description); |
|||
} |
|||
return this; |
|||
} |
|||
/// <summary>
|
|||
/// 写入标准数据
|
|||
/// </summary>
|
|||
/// <param name="title">标题</param>
|
|||
/// <param name="message">内容</param>
|
|||
/// <param name="createTime">创建时间</param>
|
|||
/// <param name="formUser">来源用户</param>
|
|||
/// <param name="description">附加说明</param>
|
|||
/// <returns></returns>
|
|||
public NotificationData WriteStandardData(string title, string message, DateTime createTime, string formUser, string description = "") |
|||
{ |
|||
TrySetData("title", title); |
|||
TrySetData("message", message); |
|||
TrySetData("description", description); |
|||
TrySetData("formUser", formUser); |
|||
TrySetData("createTime", createTime); |
|||
TrySetData(LocalizerKey, false); |
|||
return this; |
|||
} |
|||
/// <summary>
|
|||
/// 写入标准数据
|
|||
/// </summary>
|
|||
/// <param name="prefix">数据前缀</param>
|
|||
/// <param name="key">标识</param>
|
|||
/// <param name="value">数据内容</param>
|
|||
/// <returns></returns>
|
|||
public NotificationData WriteStandardData(string prefix, string key, object value) |
|||
{ |
|||
TrySetData(string.Concat(prefix, key), value); |
|||
TrySetData(LocalizerKey, false); |
|||
return this; |
|||
} |
|||
/// <summary>
|
|||
/// 转换为标准数据
|
|||
/// </summary>
|
|||
/// <param name="sourceData">原始数据</param>
|
|||
/// <returns></returns>
|
|||
public static NotificationData ToStandardData(NotificationData sourceData) |
|||
{ |
|||
var data = new NotificationData(); |
|||
data.TrySetData("title", sourceData.TryGetData("title")); |
|||
data.TrySetData("message", sourceData.TryGetData("message")); |
|||
data.TrySetData("description", sourceData.TryGetData("description")); |
|||
data.TrySetData("formUser", sourceData.TryGetData("formUser")); |
|||
data.TrySetData("createTime", sourceData.TryGetData("createTime")); |
|||
data.TrySetData(LocalizerKey, sourceData.TryGetData(LocalizerKey)); |
|||
return data; |
|||
} |
|||
/// <summary>
|
|||
/// 转换为标准数据
|
|||
/// </summary>
|
|||
/// <param name="prefix">数据前缀</param>
|
|||
/// <param name="sourceData">原始数据</param>
|
|||
/// <returns></returns>
|
|||
public static NotificationData ToStandardData(string prefix, NotificationData sourceData) |
|||
{ |
|||
var data = ToStandardData(sourceData); |
|||
|
|||
foreach (var property in sourceData.ExtraProperties) |
|||
{ |
|||
if (property.Key.StartsWith(prefix)) |
|||
{ |
|||
var key = property.Key.Replace(prefix, ""); |
|||
data.TrySetData(key, property.Value); |
|||
} |
|||
} |
|||
return data; |
|||
} |
|||
|
|||
public object TryGetData(string key) |
|||
{ |
|||
return this.GetProperty(key); |
|||
} |
|||
public void TrySetData(string key, object value) |
|||
{ |
|||
this.SetProperty(key, value); |
|||
} |
|||
/// <summary>
|
|||
/// 需要本地化
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public bool NeedLocalizer() |
|||
{ |
|||
var localizer = TryGetData(LocalizerKey); |
|||
if (localizer != null && localizer is bool needLocalizer) |
|||
{ |
|||
return needLocalizer; |
|||
} |
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,38 +1,39 @@ |
|||
using Newtonsoft.Json; |
|||
|
|||
namespace LINGYUN.Abp.Notifications |
|||
{ |
|||
public class NotificationDataConverter |
|||
{ |
|||
public static NotificationData Convert(NotificationData notificationData) |
|||
{ |
|||
if (notificationData != null) |
|||
{ |
|||
if (notificationData.NeedLocalizer()) |
|||
{ |
|||
// 潜在的空对象引用修复
|
|||
if (notificationData.Properties.TryGetValue("title", out object title) && title != null) |
|||
{ |
|||
var titleObj = JsonConvert.DeserializeObject<LocalizableStringInfo>(title.ToString()); |
|||
notificationData.TrySetData("title", titleObj); |
|||
} |
|||
if (notificationData.Properties.TryGetValue("message", out object message) && message != null) |
|||
{ |
|||
var messageObj = JsonConvert.DeserializeObject<LocalizableStringInfo>(message.ToString()); |
|||
notificationData.TrySetData("message", messageObj); |
|||
} |
|||
|
|||
if (notificationData.Properties.TryGetValue("description", out object description) && description != null) |
|||
{ |
|||
notificationData.TrySetData("description", JsonConvert.DeserializeObject<LocalizableStringInfo>(description.ToString())); |
|||
} |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
notificationData = new NotificationData(); |
|||
} |
|||
return notificationData; |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.RealTime.Localization; |
|||
using Newtonsoft.Json; |
|||
|
|||
namespace LINGYUN.Abp.Notifications |
|||
{ |
|||
public class NotificationDataConverter |
|||
{ |
|||
public static NotificationData Convert(NotificationData notificationData) |
|||
{ |
|||
if (notificationData != null) |
|||
{ |
|||
if (notificationData.NeedLocalizer()) |
|||
{ |
|||
// 潜在的空对象引用修复
|
|||
if (notificationData.ExtraProperties.TryGetValue("title", out object title) && title != null) |
|||
{ |
|||
var titleObj = JsonConvert.DeserializeObject<LocalizableStringInfo>(title.ToString()); |
|||
notificationData.TrySetData("title", titleObj); |
|||
} |
|||
if (notificationData.ExtraProperties.TryGetValue("message", out object message) && message != null) |
|||
{ |
|||
var messageObj = JsonConvert.DeserializeObject<LocalizableStringInfo>(message.ToString()); |
|||
notificationData.TrySetData("message", messageObj); |
|||
} |
|||
|
|||
if (notificationData.ExtraProperties.TryGetValue("description", out object description) && description != null) |
|||
{ |
|||
notificationData.TrySetData("description", JsonConvert.DeserializeObject<LocalizableStringInfo>(description.ToString())); |
|||
} |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
notificationData = new NotificationData(); |
|||
} |
|||
return notificationData; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,38 +1,38 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace LINGYUN.Abp.Notifications |
|||
{ |
|||
/// <summary>
|
|||
/// The notification that needs to be localized
|
|||
/// </summary>
|
|||
public class LocalizableStringInfo |
|||
{ |
|||
/// <summary>
|
|||
/// Resource name
|
|||
/// </summary>
|
|||
public string ResourceName { get; } |
|||
/// <summary>
|
|||
/// Properties
|
|||
/// </summary>
|
|||
public string Name { get; } |
|||
/// <summary>
|
|||
/// Formatted data
|
|||
/// </summary>
|
|||
public Dictionary<object, object> Values { get; } |
|||
/// <summary>
|
|||
/// Instantiate <see cref="LocalizableStringInfo"/>
|
|||
/// </summary>
|
|||
/// <param name="resourceName">Resource name</param>
|
|||
/// <param name="name">Properties</param>
|
|||
/// <param name="values">Formatted data</param>
|
|||
public LocalizableStringInfo( |
|||
string resourceName, |
|||
string name, |
|||
Dictionary<object, object> values = null) |
|||
{ |
|||
ResourceName = resourceName; |
|||
Name = name; |
|||
Values = values; |
|||
} |
|||
} |
|||
} |
|||
using System.Collections.Generic; |
|||
|
|||
namespace LINGYUN.Abp.RealTime.Localization |
|||
{ |
|||
/// <summary>
|
|||
/// The notification that needs to be localized
|
|||
/// </summary>
|
|||
public class LocalizableStringInfo |
|||
{ |
|||
/// <summary>
|
|||
/// Resource name
|
|||
/// </summary>
|
|||
public string ResourceName { get; } |
|||
/// <summary>
|
|||
/// Properties
|
|||
/// </summary>
|
|||
public string Name { get; } |
|||
/// <summary>
|
|||
/// Formatted data
|
|||
/// </summary>
|
|||
public Dictionary<object, object> Values { get; } |
|||
/// <summary>
|
|||
/// Instantiate <see cref="LocalizableStringInfo"/>
|
|||
/// </summary>
|
|||
/// <param name="resourceName">Resource name</param>
|
|||
/// <param name="name">Properties</param>
|
|||
/// <param name="values">Formatted data</param>
|
|||
public LocalizableStringInfo( |
|||
string resourceName, |
|||
string name, |
|||
Dictionary<object, object> values = null) |
|||
{ |
|||
ResourceName = resourceName; |
|||
Name = name; |
|||
Values = values; |
|||
} |
|||
} |
|||
} |
|||
@ -1,11 +1,11 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Chat |
|||
{ |
|||
public interface IChatDataSeeder |
|||
{ |
|||
Task SeedAsync( |
|||
IUserData user); |
|||
} |
|||
} |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Chat |
|||
{ |
|||
public interface IChatDataSeeder |
|||
{ |
|||
Task SeedAsync( |
|||
IUserData user); |
|||
} |
|||
} |
|||
|
|||
@ -1,80 +1,84 @@ |
|||
using LINGYUN.Abp.IM.Contract; |
|||
using System; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Chat |
|||
{ |
|||
public class UserChatFriend : CreationAuditedAggregateRoot<long>, IMultiTenant |
|||
{ |
|||
/// <summary>
|
|||
/// 租户
|
|||
/// </summary>
|
|||
public virtual Guid? TenantId { get; protected set; } |
|||
/// <summary>
|
|||
/// 用户标识
|
|||
/// </summary>
|
|||
public virtual Guid UserId { get; protected set; } |
|||
/// <summary>
|
|||
/// 好友标识
|
|||
/// </summary>
|
|||
public virtual Guid FrientId { get; protected set; } |
|||
/// <summary>
|
|||
/// 已添加黑名单
|
|||
/// </summary>
|
|||
public virtual bool Black { get; set; } |
|||
/// <summary>
|
|||
/// 消息免打扰
|
|||
/// </summary>
|
|||
public virtual bool DontDisturb { get; set; } |
|||
/// <summary>
|
|||
/// 特别关注
|
|||
/// </summary>
|
|||
public virtual bool SpecialFocus { get; set; } |
|||
/// <summary>
|
|||
/// 备注名称
|
|||
/// </summary>
|
|||
public virtual string RemarkName { get; set; } |
|||
/// <summary>
|
|||
/// 附加说明
|
|||
/// </summary>
|
|||
public virtual string Description { get; set; } |
|||
|
|||
public virtual UserFriendStatus Status { get; protected set; } |
|||
|
|||
protected UserChatFriend() |
|||
{ |
|||
} |
|||
|
|||
public UserChatFriend( |
|||
Guid userId, |
|||
Guid friendId, |
|||
string remarkName = "", |
|||
string description = "", |
|||
Guid? tenantId = null) |
|||
{ |
|||
UserId = userId; |
|||
FrientId = friendId; |
|||
RemarkName = remarkName; |
|||
TenantId = tenantId; |
|||
Description = description; |
|||
Status = UserFriendStatus.NeedValidation; |
|||
} |
|||
|
|||
public void SetStatus(UserFriendStatus status = UserFriendStatus.NeedValidation) |
|||
{ |
|||
if (Status == UserFriendStatus.NeedValidation && status == UserFriendStatus.Added) |
|||
{ |
|||
// 如果是后续验证通过的需要单独的事件
|
|||
AddLocalEvent(new UserChatFriendEto |
|||
{ |
|||
TenantId = TenantId, |
|||
UserId = UserId, |
|||
FrientId = FrientId, |
|||
Status = UserFriendStatus.Added |
|||
}); |
|||
} |
|||
Status = status; |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.IM.Contract; |
|||
using System; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Chat |
|||
{ |
|||
public class UserChatFriend : CreationAuditedAggregateRoot<long>, IMultiTenant |
|||
{ |
|||
/// <summary>
|
|||
/// 租户
|
|||
/// </summary>
|
|||
public virtual Guid? TenantId { get; protected set; } |
|||
/// <summary>
|
|||
/// 用户标识
|
|||
/// </summary>
|
|||
public virtual Guid UserId { get; protected set; } |
|||
/// <summary>
|
|||
/// 好友标识
|
|||
/// </summary>
|
|||
public virtual Guid FrientId { get; protected set; } |
|||
/// <summary>
|
|||
/// 系统预置
|
|||
/// </summary>
|
|||
public virtual bool IsStatic { get; set; } |
|||
/// <summary>
|
|||
/// 已添加黑名单
|
|||
/// </summary>
|
|||
public virtual bool Black { get; set; } |
|||
/// <summary>
|
|||
/// 消息免打扰
|
|||
/// </summary>
|
|||
public virtual bool DontDisturb { get; set; } |
|||
/// <summary>
|
|||
/// 特别关注
|
|||
/// </summary>
|
|||
public virtual bool SpecialFocus { get; set; } |
|||
/// <summary>
|
|||
/// 备注名称
|
|||
/// </summary>
|
|||
public virtual string RemarkName { get; set; } |
|||
/// <summary>
|
|||
/// 附加说明
|
|||
/// </summary>
|
|||
public virtual string Description { get; set; } |
|||
|
|||
public virtual UserFriendStatus Status { get; protected set; } |
|||
|
|||
protected UserChatFriend() |
|||
{ |
|||
} |
|||
|
|||
public UserChatFriend( |
|||
Guid userId, |
|||
Guid friendId, |
|||
string remarkName = "", |
|||
string description = "", |
|||
Guid? tenantId = null) |
|||
{ |
|||
UserId = userId; |
|||
FrientId = friendId; |
|||
RemarkName = remarkName; |
|||
TenantId = tenantId; |
|||
Description = description; |
|||
Status = UserFriendStatus.NeedValidation; |
|||
} |
|||
|
|||
public void SetStatus(UserFriendStatus status = UserFriendStatus.NeedValidation) |
|||
{ |
|||
if (Status == UserFriendStatus.NeedValidation && status == UserFriendStatus.Added) |
|||
{ |
|||
// 如果是后续验证通过的需要单独的事件
|
|||
AddLocalEvent(new UserChatFriendEto |
|||
{ |
|||
TenantId = TenantId, |
|||
UserId = UserId, |
|||
FrientId = FrientId, |
|||
Status = UserFriendStatus.Added |
|||
}); |
|||
} |
|||
Status = status; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,25 +1,28 @@ |
|||
using LINGYUN.Abp.IM.Messages; |
|||
using System; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Chat |
|||
{ |
|||
public class UserMessage : Message |
|||
{ |
|||
/// <summary>
|
|||
/// 接收用户标识
|
|||
/// </summary>
|
|||
public virtual Guid ReceiveUserId { get; set; } |
|||
|
|||
protected UserMessage() { } |
|||
public UserMessage(long id, Guid sendUserId, string sendUserName, string content, MessageType type = MessageType.Text) |
|||
: base(id, sendUserId, sendUserName, content, type) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public void SendToUser(Guid receiveUserId) |
|||
{ |
|||
ReceiveUserId = receiveUserId; |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.IM.Messages; |
|||
using System; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Chat |
|||
{ |
|||
public class UserMessage : Message |
|||
{ |
|||
/// <summary>
|
|||
/// 接收用户标识
|
|||
/// </summary>
|
|||
public virtual Guid ReceiveUserId { get; set; } |
|||
|
|||
protected UserMessage() { } |
|||
public UserMessage( |
|||
long id, |
|||
Guid sendUserId, |
|||
string sendUserName, |
|||
Guid receiveUserId, |
|||
string content, |
|||
MessageType type = MessageType.Text, |
|||
MessageSourceTye source = MessageSourceTye.User, |
|||
Guid? tenantId = null) |
|||
: base(id, sendUserId, sendUserName, content, type, source, tenantId) |
|||
{ |
|||
ReceiveUserId = receiveUserId; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,47 @@ |
|||
using LINGYUN.Abp.IM; |
|||
using System; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.Timing; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Chat |
|||
{ |
|||
public class UserOnlineChanger : IUserOnlineChanger, ITransientDependency |
|||
{ |
|||
private readonly IClock _clock; |
|||
private readonly ICurrentTenant _currentTenant; |
|||
private readonly IUnitOfWorkManager _unitOfWorkManager; |
|||
private readonly IUserChatCardRepository _userChatCardRepository; |
|||
|
|||
public UserOnlineChanger( |
|||
IClock clock, |
|||
ICurrentTenant currentTenant, |
|||
IUnitOfWorkManager unitOfWorkManager, |
|||
IUserChatCardRepository userChatCardRepository) |
|||
{ |
|||
_clock = clock; |
|||
_currentTenant = currentTenant; |
|||
_unitOfWorkManager = unitOfWorkManager; |
|||
_userChatCardRepository = userChatCardRepository; |
|||
} |
|||
|
|||
public virtual async Task ChangeAsync( |
|||
Guid? tenantId, |
|||
Guid userId, |
|||
UserOnlineState state, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
using var unitOfWork = _unitOfWorkManager.Begin(); |
|||
using (_currentTenant.Change(tenantId)) |
|||
{ |
|||
var userChatCard = await _userChatCardRepository.FindByUserIdAsync(userId); |
|||
userChatCard?.ChangeState(_clock, state); |
|||
|
|||
await unitOfWork.CompleteAsync(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,131 +1,132 @@ |
|||
using LINGYUN.Abp.IM.Messages; |
|||
using LINGYUN.Abp.MessageService.Chat; |
|||
using LINGYUN.Abp.MessageService.Localization; |
|||
using LINGYUN.Abp.MessageService.Notifications; |
|||
using LINGYUN.Abp.Notifications; |
|||
using Microsoft.Extensions.Localization; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Caching; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.EventBus.Local |
|||
{ |
|||
public class UserChatFriendEventHandler : |
|||
ILocalEventHandler<EntityCreatedEventData<UserChatFriend>>, |
|||
ILocalEventHandler<EntityDeletedEventData<UserChatFriend>>, |
|||
ILocalEventHandler<EntityUpdatedEventData<UserChatFriend>>, |
|||
ILocalEventHandler<UserChatFriendEto>, |
|||
ITransientDependency |
|||
{ |
|||
private IStringLocalizer _stringLocalizer; |
|||
private IMessageSender _messageSender; |
|||
private INotificationSender _notificationSender; |
|||
private IDistributedCache<UserFriendCacheItem> _cache; |
|||
private ICurrentUser _currentUser; |
|||
|
|||
public UserChatFriendEventHandler( |
|||
ICurrentUser currentUser, |
|||
IMessageSender messageSender, |
|||
INotificationSender notificationSender, |
|||
IDistributedCache<UserFriendCacheItem> cache, |
|||
IStringLocalizer<MessageServiceResource> stringLocalizer) |
|||
{ |
|||
_cache = cache; |
|||
_currentUser = currentUser; |
|||
_messageSender = messageSender; |
|||
_stringLocalizer = stringLocalizer; |
|||
_notificationSender = notificationSender; |
|||
} |
|||
|
|||
public virtual async Task HandleEventAsync(EntityCreatedEventData<UserChatFriend> eventData) |
|||
{ |
|||
switch (eventData.Entity.Status) |
|||
{ |
|||
case IM.Contract.UserFriendStatus.NeedValidation: |
|||
await SendFriendValidationNotifierAsync(eventData.Entity); |
|||
break; |
|||
} |
|||
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
|||
} |
|||
|
|||
public virtual async Task HandleEventAsync(EntityDeletedEventData<UserChatFriend> eventData) |
|||
{ |
|||
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
|||
} |
|||
|
|||
public virtual async Task HandleEventAsync(EntityUpdatedEventData<UserChatFriend> eventData) |
|||
{ |
|||
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
|||
} |
|||
|
|||
public virtual async Task HandleEventAsync(UserChatFriendEto eventData) |
|||
{ |
|||
if (eventData.Status == IM.Contract.UserFriendStatus.Added) |
|||
{ |
|||
await SendFriendAddedMessageAsync(eventData.UserId, eventData.FrientId, eventData.TenantId); |
|||
} |
|||
} |
|||
|
|||
protected virtual async Task SendFriendAddedMessageAsync(Guid userId, Guid friendId, Guid? tenantId = null) |
|||
{ |
|||
// 发送添加好友的第一条消息
|
|||
|
|||
var addNewFirendMessage = new ChatMessage |
|||
{ |
|||
TenantId = tenantId, |
|||
FormUserId = _currentUser.GetId(), // 本地事件中可以获取到当前用户信息
|
|||
FormUserName = _currentUser.UserName, |
|||
SendTime = DateTime.Now, |
|||
MessageType = MessageType.Text, |
|||
ToUserId = friendId, |
|||
Content = _stringLocalizer["Messages:NewFriend"] |
|||
}; |
|||
|
|||
await _messageSender.SendMessageAsync(addNewFirendMessage); |
|||
} |
|||
|
|||
protected virtual async Task SendFriendValidationNotifierAsync(UserChatFriend userChatFriend) |
|||
{ |
|||
// 发送好友验证通知
|
|||
var userIdentifer = new UserIdentifier(userChatFriend.FrientId, userChatFriend.RemarkName); |
|||
|
|||
var friendValidationNotifictionData = new NotificationData(); |
|||
friendValidationNotifictionData |
|||
.WriteLocalizedData( |
|||
new LocalizableStringInfo( |
|||
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
|||
"Notifications:FriendValidation"), |
|||
new LocalizableStringInfo( |
|||
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
|||
"Notifications:RequestAddNewFriend", |
|||
new Dictionary<object, object> { { "name", _currentUser.UserName } }), |
|||
DateTime.Now, |
|||
_currentUser.UserName, |
|||
new LocalizableStringInfo( |
|||
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
|||
"Notifications:RequestAddNewFriendDetail", |
|||
new Dictionary<object, object> { { "description", userChatFriend.Description } })); |
|||
friendValidationNotifictionData.TrySetData("userId", userChatFriend.UserId); |
|||
friendValidationNotifictionData.TrySetData("frientId", userChatFriend.FrientId); |
|||
|
|||
await _notificationSender |
|||
.SendNofiterAsync( |
|||
MessageServiceNotificationNames.IM.FriendValidation, |
|||
friendValidationNotifictionData, |
|||
userIdentifer, |
|||
userChatFriend.TenantId); |
|||
} |
|||
|
|||
protected virtual async Task RemoveUserFriendCacheItemAsync(Guid userId) |
|||
{ |
|||
// 移除好友缓存
|
|||
await _cache.RemoveAsync(UserFriendCacheItem.CalculateCacheKey(userId.ToString())); |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.IM.Messages; |
|||
using LINGYUN.Abp.MessageService.Chat; |
|||
using LINGYUN.Abp.MessageService.Localization; |
|||
using LINGYUN.Abp.MessageService.Notifications; |
|||
using LINGYUN.Abp.Notifications; |
|||
using LINGYUN.Abp.RealTime.Localization; |
|||
using Microsoft.Extensions.Localization; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Caching; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.EventBus.Local |
|||
{ |
|||
public class UserChatFriendEventHandler : |
|||
ILocalEventHandler<EntityCreatedEventData<UserChatFriend>>, |
|||
ILocalEventHandler<EntityDeletedEventData<UserChatFriend>>, |
|||
ILocalEventHandler<EntityUpdatedEventData<UserChatFriend>>, |
|||
ILocalEventHandler<UserChatFriendEto>, |
|||
ITransientDependency |
|||
{ |
|||
private IStringLocalizer _stringLocalizer; |
|||
private IMessageSender _messageSender; |
|||
private INotificationSender _notificationSender; |
|||
private IDistributedCache<UserFriendCacheItem> _cache; |
|||
private ICurrentUser _currentUser; |
|||
|
|||
public UserChatFriendEventHandler( |
|||
ICurrentUser currentUser, |
|||
IMessageSender messageSender, |
|||
INotificationSender notificationSender, |
|||
IDistributedCache<UserFriendCacheItem> cache, |
|||
IStringLocalizer<MessageServiceResource> stringLocalizer) |
|||
{ |
|||
_cache = cache; |
|||
_currentUser = currentUser; |
|||
_messageSender = messageSender; |
|||
_stringLocalizer = stringLocalizer; |
|||
_notificationSender = notificationSender; |
|||
} |
|||
|
|||
public virtual async Task HandleEventAsync(EntityCreatedEventData<UserChatFriend> eventData) |
|||
{ |
|||
switch (eventData.Entity.Status) |
|||
{ |
|||
case IM.Contract.UserFriendStatus.NeedValidation: |
|||
await SendFriendValidationNotifierAsync(eventData.Entity); |
|||
break; |
|||
} |
|||
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
|||
} |
|||
|
|||
public virtual async Task HandleEventAsync(EntityDeletedEventData<UserChatFriend> eventData) |
|||
{ |
|||
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
|||
} |
|||
|
|||
public virtual async Task HandleEventAsync(EntityUpdatedEventData<UserChatFriend> eventData) |
|||
{ |
|||
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
|||
} |
|||
|
|||
public virtual async Task HandleEventAsync(UserChatFriendEto eventData) |
|||
{ |
|||
if (eventData.Status == IM.Contract.UserFriendStatus.Added) |
|||
{ |
|||
await SendFriendAddedMessageAsync(eventData.UserId, eventData.FrientId, eventData.TenantId); |
|||
} |
|||
} |
|||
|
|||
protected virtual async Task SendFriendAddedMessageAsync(Guid userId, Guid friendId, Guid? tenantId = null) |
|||
{ |
|||
// 发送添加好友的第一条消息
|
|||
|
|||
var addNewFirendMessage = new ChatMessage |
|||
{ |
|||
TenantId = tenantId, |
|||
FormUserId = _currentUser.GetId(), // 本地事件中可以获取到当前用户信息
|
|||
FormUserName = _currentUser.UserName, |
|||
SendTime = DateTime.Now, |
|||
MessageType = MessageType.Text, |
|||
ToUserId = friendId, |
|||
Content = _stringLocalizer["Messages:NewFriend"] |
|||
}; |
|||
|
|||
await _messageSender.SendMessageAsync(addNewFirendMessage); |
|||
} |
|||
|
|||
protected virtual async Task SendFriendValidationNotifierAsync(UserChatFriend userChatFriend) |
|||
{ |
|||
// 发送好友验证通知
|
|||
var userIdentifer = new UserIdentifier(userChatFriend.FrientId, userChatFriend.RemarkName); |
|||
|
|||
var friendValidationNotifictionData = new NotificationData(); |
|||
friendValidationNotifictionData |
|||
.WriteLocalizedData( |
|||
new LocalizableStringInfo( |
|||
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
|||
"Notifications:FriendValidation"), |
|||
new LocalizableStringInfo( |
|||
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
|||
"Notifications:RequestAddNewFriend", |
|||
new Dictionary<object, object> { { "name", _currentUser.UserName } }), |
|||
DateTime.Now, |
|||
_currentUser.UserName, |
|||
new LocalizableStringInfo( |
|||
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
|||
"Notifications:RequestAddNewFriendDetail", |
|||
new Dictionary<object, object> { { "description", userChatFriend.Description } })); |
|||
friendValidationNotifictionData.TrySetData("userId", userChatFriend.UserId); |
|||
friendValidationNotifictionData.TrySetData("frientId", userChatFriend.FrientId); |
|||
|
|||
await _notificationSender |
|||
.SendNofiterAsync( |
|||
MessageServiceNotificationNames.IM.FriendValidation, |
|||
friendValidationNotifictionData, |
|||
userIdentifer, |
|||
userChatFriend.TenantId); |
|||
} |
|||
|
|||
protected virtual async Task RemoveUserFriendCacheItemAsync(Guid userId) |
|||
{ |
|||
// 移除好友缓存
|
|||
await _cache.RemoveAsync(UserFriendCacheItem.CalculateCacheKey(userId.ToString())); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,41 +1,40 @@ |
|||
using AutoMapper; |
|||
using LINGYUN.Abp.MessageService.Notifications; |
|||
using LINGYUN.Abp.Notifications; |
|||
using Newtonsoft.Json; |
|||
using System; |
|||
using Volo.Abp; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Mapper |
|||
{ |
|||
public class NotificationTypeConverter : ITypeConverter<Notification, NotificationInfo>, ISingletonDependency |
|||
{ |
|||
public NotificationInfo Convert(Notification source, NotificationInfo destination, ResolutionContext context) |
|||
{ |
|||
destination = new NotificationInfo |
|||
{ |
|||
Name = source.NotificationName, |
|||
Type = source.Type, |
|||
Severity = source.Severity, |
|||
CreationTime = source.CreationTime, |
|||
TenantId = source.TenantId |
|||
}; |
|||
destination.SetId(source.NotificationId); |
|||
|
|||
var dataType = Type.GetType(source.NotificationTypeName); |
|||
Check.NotNull(dataType, source.NotificationTypeName); |
|||
|
|||
var data = JsonConvert.DeserializeObject(source.NotificationData, dataType); |
|||
if (data != null && data is NotificationData notificationData) |
|||
{ |
|||
destination.Data = NotificationDataConverter.Convert(notificationData); |
|||
} |
|||
else |
|||
{ |
|||
destination.Data = new NotificationData(); |
|||
destination.Data.TrySetData("data", source.NotificationData); |
|||
} |
|||
return destination; |
|||
} |
|||
} |
|||
} |
|||
using AutoMapper; |
|||
using LINGYUN.Abp.MessageService.Notifications; |
|||
using LINGYUN.Abp.Notifications; |
|||
using System; |
|||
using Volo.Abp; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Mapper |
|||
{ |
|||
public class NotificationTypeConverter : ITypeConverter<Notification, NotificationInfo>, ISingletonDependency |
|||
{ |
|||
public NotificationInfo Convert(Notification source, NotificationInfo destination, ResolutionContext context) |
|||
{ |
|||
destination = new NotificationInfo |
|||
{ |
|||
Name = source.NotificationName, |
|||
Type = source.Type, |
|||
Severity = source.Severity, |
|||
CreationTime = source.CreationTime, |
|||
TenantId = source.TenantId |
|||
}; |
|||
destination.SetId(source.NotificationId); |
|||
|
|||
var dataType = Type.GetType(source.NotificationTypeName); |
|||
Check.NotNull(dataType, source.NotificationTypeName); |
|||
var data = Activator.CreateInstance(dataType); |
|||
if (data != null && data is NotificationData notificationData) |
|||
{ |
|||
notificationData.ExtraProperties = source.ExtraProperties; |
|||
destination.Data = NotificationDataConverter.Convert(notificationData); |
|||
} |
|||
else |
|||
{ |
|||
destination.Data = new NotificationData(); |
|||
destination.Data.ExtraProperties = source.ExtraProperties; |
|||
} |
|||
return destination; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,40 +1,59 @@ |
|||
using LINGYUN.Abp.Notifications; |
|||
using System; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Notifications |
|||
{ |
|||
public class Notification : Entity<long>, IMultiTenant, IHasCreationTime |
|||
{ |
|||
public virtual Guid? TenantId { get; protected set; } |
|||
public virtual NotificationSeverity Severity { get; protected set; } |
|||
public virtual NotificationType Type { get; set; } |
|||
public virtual long NotificationId { get; protected set; } |
|||
public virtual string NotificationName { get; protected set; } |
|||
public virtual string NotificationData { get; protected set; } |
|||
public virtual string NotificationTypeName { get; protected set; } |
|||
public virtual DateTime? ExpirationTime { get; set; } |
|||
public virtual DateTime CreationTime { get; set; } |
|||
protected Notification(){} |
|||
|
|||
public Notification(long id) |
|||
{ |
|||
Id = id; |
|||
} |
|||
|
|||
public Notification(long id, string name, string dataType, string data, |
|||
NotificationSeverity severity = NotificationSeverity.Info, |
|||
Guid? tenantId = null) |
|||
{ |
|||
NotificationId = id; |
|||
Severity = severity; |
|||
NotificationName = name; |
|||
NotificationData = data; |
|||
NotificationTypeName = dataType; |
|||
Type = NotificationType.Application; |
|||
TenantId = tenantId; |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.Notifications; |
|||
using System; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Notifications |
|||
{ |
|||
public class Notification : Entity<long>, IMultiTenant, IHasCreationTime, IHasExtraProperties |
|||
{ |
|||
public virtual Guid? TenantId { get; protected set; } |
|||
public virtual NotificationSeverity Severity { get; protected set; } |
|||
public virtual NotificationType Type { get; set; } |
|||
public virtual long NotificationId { get; protected set; } |
|||
public virtual string NotificationName { get; protected set; } |
|||
public virtual string NotificationTypeName { get; protected set; } |
|||
public virtual DateTime? ExpirationTime { get; set; } |
|||
public virtual DateTime CreationTime { get; set; } |
|||
public virtual ExtraPropertyDictionary ExtraProperties { get; protected set; } |
|||
|
|||
protected Notification() |
|||
{ |
|||
ExtraProperties = new ExtraPropertyDictionary(); |
|||
this.SetDefaultsForExtraProperties(); |
|||
} |
|||
|
|||
public Notification(long id) : this() |
|||
{ |
|||
Id = id; |
|||
} |
|||
|
|||
public Notification( |
|||
long id, |
|||
string name, |
|||
string dataType, |
|||
NotificationData data, |
|||
NotificationSeverity severity = NotificationSeverity.Info, |
|||
Guid? tenantId = null) : this() |
|||
{ |
|||
NotificationId = id; |
|||
Severity = severity; |
|||
NotificationName = name; |
|||
NotificationTypeName = dataType; |
|||
Type = NotificationType.Application; |
|||
TenantId = tenantId; |
|||
|
|||
SetData(data); |
|||
} |
|||
|
|||
public void SetData(NotificationData data) |
|||
{ |
|||
foreach (var property in data.ExtraProperties) |
|||
{ |
|||
this.SetProperty(property.Key, property.Value); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,57 +1,59 @@ |
|||
using LINGYUN.Abp.MessageService.Chat; |
|||
using LINGYUN.Abp.MessageService.Notifications; |
|||
using LINGYUN.Abp.Notifications; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.EventBus.Distributed |
|||
{ |
|||
public class UserCreateJoinIMEventHandler : ILocalEventHandler<EntityCreatedEventData<UserEto>>, ITransientDependency |
|||
{ |
|||
private readonly IChatDataSeeder _chatDataSeeder; |
|||
private readonly INotificationSubscriptionManager _notificationSubscriptionManager; |
|||
public UserCreateJoinIMEventHandler( |
|||
IChatDataSeeder chatDataSeeder, |
|||
INotificationSubscriptionManager notificationSubscriptionManager) |
|||
{ |
|||
_chatDataSeeder = chatDataSeeder; |
|||
_notificationSubscriptionManager = notificationSubscriptionManager; |
|||
} |
|||
/// <summary>
|
|||
/// 接收添加用户事件,初始化IM用户种子
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(EntityCreatedEventData<UserEto> eventData) |
|||
{ |
|||
await SeedChatDataAsync(eventData.Entity); |
|||
} |
|||
|
|||
protected virtual async Task SeedChatDataAsync(IUserData user) |
|||
{ |
|||
await _chatDataSeeder.SeedAsync(user); |
|||
} |
|||
|
|||
protected virtual async Task SeedUserSubscriptionNotifiersAsync(IUserData user) |
|||
{ |
|||
var userIdentifier = new UserIdentifier(user.Id, user.UserName); |
|||
|
|||
await _notificationSubscriptionManager |
|||
.SubscribeAsync( |
|||
user.TenantId, |
|||
userIdentifier, |
|||
MessageServiceNotificationNames.IM.FriendValidation); |
|||
|
|||
await _notificationSubscriptionManager |
|||
.SubscribeAsync( |
|||
user.TenantId, |
|||
userIdentifier, |
|||
MessageServiceNotificationNames.IM.NewFriend); |
|||
} |
|||
} |
|||
} |
|||
using LINGYUN.Abp.MessageService.Chat; |
|||
using LINGYUN.Abp.MessageService.Notifications; |
|||
using LINGYUN.Abp.Notifications; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.EventBus.Distributed |
|||
{ |
|||
public class UserCreateJoinIMEventHandler : ILocalEventHandler<EntityCreatedEventData<UserEto>>, ITransientDependency |
|||
{ |
|||
private readonly IChatDataSeeder _chatDataSeeder; |
|||
private readonly INotificationSubscriptionManager _notificationSubscriptionManager; |
|||
public UserCreateJoinIMEventHandler( |
|||
IChatDataSeeder chatDataSeeder, |
|||
INotificationSubscriptionManager notificationSubscriptionManager) |
|||
{ |
|||
_chatDataSeeder = chatDataSeeder; |
|||
_notificationSubscriptionManager = notificationSubscriptionManager; |
|||
} |
|||
/// <summary>
|
|||
/// 接收添加用户事件,初始化IM用户种子
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(EntityCreatedEventData<UserEto> eventData) |
|||
{ |
|||
await SeedChatDataAsync(eventData.Entity); |
|||
|
|||
await SeedUserSubscriptionNotifiersAsync(eventData.Entity); |
|||
} |
|||
|
|||
protected virtual async Task SeedChatDataAsync(IUserData user) |
|||
{ |
|||
await _chatDataSeeder.SeedAsync(user); |
|||
} |
|||
|
|||
protected virtual async Task SeedUserSubscriptionNotifiersAsync(IUserData user) |
|||
{ |
|||
var userIdentifier = new UserIdentifier(user.Id, user.UserName); |
|||
|
|||
await _notificationSubscriptionManager |
|||
.SubscribeAsync( |
|||
user.TenantId, |
|||
userIdentifier, |
|||
MessageServiceNotificationNames.IM.FriendValidation); |
|||
|
|||
await _notificationSubscriptionManager |
|||
.SubscribeAsync( |
|||
user.TenantId, |
|||
userIdentifier, |
|||
MessageServiceNotificationNames.IM.NewFriend); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,621 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LINGYUN.Abp.MessageService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Migrations |
|||
{ |
|||
[DbContext(typeof(MessageServiceHostMigrationsDbContext))] |
|||
[Migration("20211111014501_Add-Base-Type-ExtraProp-To-Notification")] |
|||
partial class AddBaseTypeExtraPropToNotification |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64) |
|||
.HasAnnotation("ProductVersion", "5.0.12"); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<int>("Age") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("AvatarUrl") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<DateTime?>("Birthday") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<DateTime?>("LastOnlineTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("NickName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<int>("Sex") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Sign") |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)"); |
|||
|
|||
b.Property<int>("State") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatCards"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<bool>("Black") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)"); |
|||
|
|||
b.Property<bool>("DontDisturb") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<Guid>("FrientId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("RemarkName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<bool>("SpecialFocus") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<byte>("Status") |
|||
.HasColumnType("tinyint unsigned"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "FrientId"); |
|||
|
|||
b.ToTable("AppUserChatFriends"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<bool>("AllowAddFriend") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowAnonymous") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowReceiveMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowSendMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("RequireAddFriendValition") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatSettings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Content") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576) |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("MessageId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid>("ReceiveUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<sbyte>("SendState") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<string>("SendUserName") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "ReceiveUserId"); |
|||
|
|||
b.ToTable("AppUserMessages"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.ChatGroup", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("Address") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<Guid>("AdminUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("AllowAnonymous") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowSendMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("AvatarUrl") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<int>("MaxUserCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(20) |
|||
.HasColumnType("varchar(20)"); |
|||
|
|||
b.Property<string>("Notice") |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<string>("Tag") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "Name"); |
|||
|
|||
b.ToTable("AppChatGroups"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupChatBlack", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid>("ShieldUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId"); |
|||
|
|||
b.ToTable("AppGroupChatBlacks"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupMessage", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Content") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576) |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<long>("MessageId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<sbyte>("SendState") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<string>("SendUserName") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId"); |
|||
|
|||
b.ToTable("AppGroupMessages"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserChatGroup", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatGroups"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserGroupCard", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsAdmin") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("NickName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<DateTime?>("SilenceEnd") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserGroupCards"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<DateTime?>("ExpirationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("NotificationId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("NotificationName") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)"); |
|||
|
|||
b.Property<string>("NotificationTypeName") |
|||
.IsRequired() |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<sbyte>("Severity") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "NotificationName"); |
|||
|
|||
b.ToTable("AppNotifications"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<long>("NotificationId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<int>("ReadStatus") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "NotificationId") |
|||
.HasDatabaseName("IX_Tenant_User_Notification_Id"); |
|||
|
|||
b.ToTable("AppUserNotifications"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<string>("NotificationName") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.ValueGeneratedOnAdd() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasDefaultValue("/"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "NotificationName") |
|||
.IsUnique() |
|||
.HasDatabaseName("IX_Tenant_User_Notification_Name"); |
|||
|
|||
b.ToTable("AppUserSubscribes"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Migrations |
|||
{ |
|||
public partial class AddBaseTypeExtraPropToNotification : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "NotificationData", |
|||
table: "AppNotifications"); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ExtraProperties", |
|||
table: "AppNotifications", |
|||
type: "longtext", |
|||
nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "ExtraProperties", |
|||
table: "AppNotifications"); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "NotificationData", |
|||
table: "AppNotifications", |
|||
type: "longtext", |
|||
maxLength: 1048576, |
|||
nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,627 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LINGYUN.Abp.MessageService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Migrations |
|||
{ |
|||
[DbContext(typeof(MessageServiceHostMigrationsDbContext))] |
|||
[Migration("20211111080938_Add-Source-Type-To-Chat-Message")] |
|||
partial class AddSourceTypeToChatMessage |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64) |
|||
.HasAnnotation("ProductVersion", "5.0.12"); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<int>("Age") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("AvatarUrl") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<DateTime?>("Birthday") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<DateTime?>("LastOnlineTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("NickName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<int>("Sex") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Sign") |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)"); |
|||
|
|||
b.Property<int>("State") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatCards"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<bool>("Black") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)"); |
|||
|
|||
b.Property<bool>("DontDisturb") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<Guid>("FrientId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("RemarkName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<bool>("SpecialFocus") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<byte>("Status") |
|||
.HasColumnType("tinyint unsigned"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "FrientId"); |
|||
|
|||
b.ToTable("AppUserChatFriends"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<bool>("AllowAddFriend") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowAnonymous") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowReceiveMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowSendMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("RequireAddFriendValition") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatSettings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Content") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576) |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("MessageId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid>("ReceiveUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<sbyte>("SendState") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<string>("SendUserName") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<int>("Source") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "ReceiveUserId"); |
|||
|
|||
b.ToTable("AppUserMessages"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.ChatGroup", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("Address") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<Guid>("AdminUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("AllowAnonymous") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowSendMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("AvatarUrl") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<int>("MaxUserCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(20) |
|||
.HasColumnType("varchar(20)"); |
|||
|
|||
b.Property<string>("Notice") |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<string>("Tag") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "Name"); |
|||
|
|||
b.ToTable("AppChatGroups"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupChatBlack", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid>("ShieldUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId"); |
|||
|
|||
b.ToTable("AppGroupChatBlacks"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupMessage", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Content") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576) |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<long>("MessageId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<sbyte>("SendState") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<string>("SendUserName") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<int>("Source") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId"); |
|||
|
|||
b.ToTable("AppGroupMessages"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserChatGroup", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatGroups"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserGroupCard", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsAdmin") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("NickName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<DateTime?>("SilenceEnd") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserGroupCards"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<DateTime?>("ExpirationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("NotificationId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("NotificationName") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)"); |
|||
|
|||
b.Property<string>("NotificationTypeName") |
|||
.IsRequired() |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<sbyte>("Severity") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "NotificationName"); |
|||
|
|||
b.ToTable("AppNotifications"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<long>("NotificationId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<int>("ReadStatus") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "NotificationId") |
|||
.HasDatabaseName("IX_Tenant_User_Notification_Id"); |
|||
|
|||
b.ToTable("AppUserNotifications"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<string>("NotificationName") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.ValueGeneratedOnAdd() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasDefaultValue("/"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "NotificationName") |
|||
.IsUnique() |
|||
.HasDatabaseName("IX_Tenant_User_Notification_Name"); |
|||
|
|||
b.ToTable("AppUserSubscribes"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Migrations |
|||
{ |
|||
public partial class AddSourceTypeToChatMessage : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<int>( |
|||
name: "Source", |
|||
table: "AppUserMessages", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "Source", |
|||
table: "AppGroupMessages", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "Source", |
|||
table: "AppUserMessages"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Source", |
|||
table: "AppGroupMessages"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,630 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LINGYUN.Abp.MessageService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Migrations |
|||
{ |
|||
[DbContext(typeof(MessageServiceHostMigrationsDbContext))] |
|||
[Migration("20211111221335_Add-Field-Static-To-Chat-Friend")] |
|||
partial class AddFieldStaticToChatFriend |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64) |
|||
.HasAnnotation("ProductVersion", "5.0.12"); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<int>("Age") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("AvatarUrl") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<DateTime?>("Birthday") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<DateTime?>("LastOnlineTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("NickName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<int>("Sex") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Sign") |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)"); |
|||
|
|||
b.Property<int>("State") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatCards"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<bool>("Black") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)"); |
|||
|
|||
b.Property<bool>("DontDisturb") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<Guid>("FrientId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("RemarkName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<bool>("SpecialFocus") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<byte>("Status") |
|||
.HasColumnType("tinyint unsigned"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "FrientId"); |
|||
|
|||
b.ToTable("AppUserChatFriends"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<bool>("AllowAddFriend") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowAnonymous") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowReceiveMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowSendMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("RequireAddFriendValition") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatSettings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Content") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576) |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("MessageId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid>("ReceiveUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<sbyte>("SendState") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<string>("SendUserName") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<int>("Source") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "ReceiveUserId"); |
|||
|
|||
b.ToTable("AppUserMessages"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.ChatGroup", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("Address") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<Guid>("AdminUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("AllowAnonymous") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowSendMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("AvatarUrl") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<int>("MaxUserCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(20) |
|||
.HasColumnType("varchar(20)"); |
|||
|
|||
b.Property<string>("Notice") |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<string>("Tag") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "Name"); |
|||
|
|||
b.ToTable("AppChatGroups"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupChatBlack", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid>("ShieldUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId"); |
|||
|
|||
b.ToTable("AppGroupChatBlacks"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupMessage", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Content") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576) |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<long>("MessageId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<sbyte>("SendState") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<string>("SendUserName") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<int>("Source") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId"); |
|||
|
|||
b.ToTable("AppGroupMessages"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserChatGroup", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatGroups"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserGroupCard", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsAdmin") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("NickName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<DateTime?>("SilenceEnd") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserGroupCards"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<DateTime?>("ExpirationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("NotificationId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("NotificationName") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)"); |
|||
|
|||
b.Property<string>("NotificationTypeName") |
|||
.IsRequired() |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<sbyte>("Severity") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "NotificationName"); |
|||
|
|||
b.ToTable("AppNotifications"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<long>("NotificationId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<int>("ReadStatus") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "NotificationId") |
|||
.HasDatabaseName("IX_Tenant_User_Notification_Id"); |
|||
|
|||
b.ToTable("AppUserNotifications"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<string>("NotificationName") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.ValueGeneratedOnAdd() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasDefaultValue("/"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "NotificationName") |
|||
.IsUnique() |
|||
.HasDatabaseName("IX_Tenant_User_Notification_Name"); |
|||
|
|||
b.ToTable("AppUserSubscribes"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Migrations |
|||
{ |
|||
public partial class AddFieldStaticToChatFriend : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<bool>( |
|||
name: "IsStatic", |
|||
table: "AppUserChatFriends", |
|||
type: "tinyint(1)", |
|||
nullable: false, |
|||
defaultValue: false); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "IsStatic", |
|||
table: "AppUserChatFriends"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,630 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LINGYUN.Abp.MessageService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Migrations |
|||
{ |
|||
[DbContext(typeof(MessageServiceHostMigrationsDbContext))] |
|||
[Migration("20211112083050_Rename-Field-SendState-To-State")] |
|||
partial class RenameFieldSendStateToState |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64) |
|||
.HasAnnotation("ProductVersion", "5.0.12"); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<int>("Age") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("AvatarUrl") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<DateTime?>("Birthday") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<DateTime?>("LastOnlineTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("NickName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<int>("Sex") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Sign") |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)"); |
|||
|
|||
b.Property<int>("State") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatCards"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<bool>("Black") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)"); |
|||
|
|||
b.Property<bool>("DontDisturb") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<Guid>("FrientId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("RemarkName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<bool>("SpecialFocus") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<byte>("Status") |
|||
.HasColumnType("tinyint unsigned"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "FrientId"); |
|||
|
|||
b.ToTable("AppUserChatFriends"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<bool>("AllowAddFriend") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowAnonymous") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowReceiveMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowSendMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("RequireAddFriendValition") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatSettings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Content") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576) |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("MessageId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid>("ReceiveUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("SendUserName") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<int>("Source") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<sbyte>("State") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "ReceiveUserId"); |
|||
|
|||
b.ToTable("AppUserMessages"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.ChatGroup", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("Address") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<Guid>("AdminUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("AllowAnonymous") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("AllowSendMessage") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<string>("AvatarUrl") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<int>("MaxUserCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(20) |
|||
.HasColumnType("varchar(20)"); |
|||
|
|||
b.Property<string>("Notice") |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<string>("Tag") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "Name"); |
|||
|
|||
b.ToTable("AppChatGroups"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupChatBlack", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid>("ShieldUserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId"); |
|||
|
|||
b.ToTable("AppGroupChatBlacks"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupMessage", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Content") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576) |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<long>("MessageId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("SendUserName") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)"); |
|||
|
|||
b.Property<int>("Source") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<sbyte>("State") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId"); |
|||
|
|||
b.ToTable("AppGroupMessages"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserChatGroup", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<long>("GroupId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "GroupId", "UserId"); |
|||
|
|||
b.ToTable("AppUserChatGroups"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserGroupCard", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsAdmin") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("NickName") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)"); |
|||
|
|||
b.Property<DateTime?>("SilenceEnd") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId"); |
|||
|
|||
b.ToTable("AppUserGroupCards"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<DateTime?>("ExpirationTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<long>("NotificationId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("NotificationName") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)"); |
|||
|
|||
b.Property<string>("NotificationTypeName") |
|||
.IsRequired() |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)"); |
|||
|
|||
b.Property<sbyte>("Severity") |
|||
.HasColumnType("tinyint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("Type") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "NotificationName"); |
|||
|
|||
b.ToTable("AppNotifications"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<long>("NotificationId") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<int>("ReadStatus") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "NotificationId") |
|||
.HasDatabaseName("IX_Tenant_User_Notification_Id"); |
|||
|
|||
b.ToTable("AppUserNotifications"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<string>("NotificationName") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.ValueGeneratedOnAdd() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasDefaultValue("/"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "NotificationName") |
|||
.IsUnique() |
|||
.HasDatabaseName("IX_Tenant_User_Notification_Name"); |
|||
|
|||
b.ToTable("AppUserSubscribes"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Migrations |
|||
{ |
|||
public partial class RenameFieldSendStateToState : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.RenameColumn( |
|||
name: "SendState", |
|||
table: "AppUserMessages", |
|||
newName: "State"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "SendState", |
|||
table: "AppGroupMessages", |
|||
newName: "State"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.RenameColumn( |
|||
name: "State", |
|||
table: "AppUserMessages", |
|||
newName: "SendState"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "State", |
|||
table: "AppGroupMessages", |
|||
newName: "SendState"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -1,82 +1,82 @@ |
|||
using Microsoft.Extensions.Options; |
|||
using Shouldly; |
|||
using System; |
|||
using Xunit; |
|||
|
|||
namespace LINGYUN.Abp.Notifications.Sms |
|||
{ |
|||
public class SmsNotificationDataMapping_Tests : AbpNotificationsSmsTestsBase |
|||
{ |
|||
private readonly NotificationData _notificationData; |
|||
protected AbpNotificationOptions NotificationOptions { get; } |
|||
protected AbpNotificationsSmsOptions NotificationSmsOptions { get; } |
|||
public SmsNotificationDataMapping_Tests() |
|||
{ |
|||
NotificationOptions = GetRequiredService<IOptions<AbpNotificationOptions>>().Value; |
|||
NotificationSmsOptions = GetRequiredService<IOptions<AbpNotificationsSmsOptions>>().Value; |
|||
|
|||
_notificationData = new NotificationData(); |
|||
InitNotificationData(_notificationData); |
|||
} |
|||
|
|||
private void InitNotificationData(NotificationData data) |
|||
{ |
|||
data.WriteStandardData("title", "message", DateTime.Now, "formUser", "description"); |
|||
data.WriteStandardData(NotificationSmsOptions.TemplateParamsPrefix, "phoneNumber", "13800138000"); |
|||
data.WriteStandardData(NotificationSmsOptions.TemplateParamsPrefix, "template", "SM_202011250901"); |
|||
data.TrySetData("otherDataKey", "otherDataValue"); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Sms_Notification_Data_Test() |
|||
{ |
|||
var mappingSmsItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test1); |
|||
|
|||
mappingSmsItem.ShouldNotBeNull(); |
|||
|
|||
var mappingSmsData = mappingSmsItem.MappingFunc(_notificationData); |
|||
mappingSmsData.TryGetData("phoneNumber").ShouldNotBeNull(); |
|||
mappingSmsData.TryGetData("phoneNumber").ToString().ShouldBe("13800138000"); |
|||
|
|||
mappingSmsData.TryGetData("template").ShouldNotBeNull(); |
|||
mappingSmsData.TryGetData("template").ToString().ShouldBe("SM_202011250901"); |
|||
|
|||
// 按照预定义规则,这条数据被丢弃
|
|||
mappingSmsData.TryGetData("otherDataKey").ShouldBeNull(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Standard_Notification_Data_Test() |
|||
{ |
|||
var mappingStandardItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test2); |
|||
|
|||
var mappingStandardData = mappingStandardItem.MappingFunc(_notificationData); |
|||
|
|||
// 按照自定义规则,其他数据被丢弃
|
|||
mappingStandardData.TryGetData("phoneNumber").ShouldBeNull(); |
|||
mappingStandardData.TryGetData("template").ShouldBeNull(); |
|||
mappingStandardData.TryGetData("otherDataKey").ShouldBeNull(); |
|||
mappingStandardData.Properties.Count.ShouldBe(6); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Origin_Notification_Data_Test() |
|||
{ |
|||
var mappingOriginItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test3); |
|||
|
|||
var mappingOriginData = mappingOriginItem.MappingFunc(_notificationData); |
|||
|
|||
// 按照自定义规则,所有数据被保留
|
|||
mappingOriginData.TryGetData(NotificationSmsOptions.TemplateParamsPrefix + "phoneNumber").ShouldNotBeNull(); |
|||
mappingOriginData.TryGetData(NotificationSmsOptions.TemplateParamsPrefix + "template").ShouldNotBeNull(); |
|||
mappingOriginData.TryGetData("otherDataKey").ShouldNotBeNull(); |
|||
mappingOriginData.Properties.Count.ShouldBe(9); |
|||
} |
|||
} |
|||
} |
|||
using Microsoft.Extensions.Options; |
|||
using Shouldly; |
|||
using System; |
|||
using Xunit; |
|||
|
|||
namespace LINGYUN.Abp.Notifications.Sms |
|||
{ |
|||
public class SmsNotificationDataMapping_Tests : AbpNotificationsSmsTestsBase |
|||
{ |
|||
private readonly NotificationData _notificationData; |
|||
protected AbpNotificationOptions NotificationOptions { get; } |
|||
protected AbpNotificationsSmsOptions NotificationSmsOptions { get; } |
|||
public SmsNotificationDataMapping_Tests() |
|||
{ |
|||
NotificationOptions = GetRequiredService<IOptions<AbpNotificationOptions>>().Value; |
|||
NotificationSmsOptions = GetRequiredService<IOptions<AbpNotificationsSmsOptions>>().Value; |
|||
|
|||
_notificationData = new NotificationData(); |
|||
InitNotificationData(_notificationData); |
|||
} |
|||
|
|||
private void InitNotificationData(NotificationData data) |
|||
{ |
|||
data.WriteStandardData("title", "message", DateTime.Now, "formUser", "description"); |
|||
data.WriteStandardData(NotificationSmsOptions.TemplateParamsPrefix, "phoneNumber", "13800138000"); |
|||
data.WriteStandardData(NotificationSmsOptions.TemplateParamsPrefix, "template", "SM_202011250901"); |
|||
data.TrySetData("otherDataKey", "otherDataValue"); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Sms_Notification_Data_Test() |
|||
{ |
|||
var mappingSmsItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test1); |
|||
|
|||
mappingSmsItem.ShouldNotBeNull(); |
|||
|
|||
var mappingSmsData = mappingSmsItem.MappingFunc(_notificationData); |
|||
mappingSmsData.TryGetData("phoneNumber").ShouldNotBeNull(); |
|||
mappingSmsData.TryGetData("phoneNumber").ToString().ShouldBe("13800138000"); |
|||
|
|||
mappingSmsData.TryGetData("template").ShouldNotBeNull(); |
|||
mappingSmsData.TryGetData("template").ToString().ShouldBe("SM_202011250901"); |
|||
|
|||
// 按照预定义规则,这条数据被丢弃
|
|||
mappingSmsData.TryGetData("otherDataKey").ShouldBeNull(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Standard_Notification_Data_Test() |
|||
{ |
|||
var mappingStandardItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test2); |
|||
|
|||
var mappingStandardData = mappingStandardItem.MappingFunc(_notificationData); |
|||
|
|||
// 按照自定义规则,其他数据被丢弃
|
|||
mappingStandardData.TryGetData("phoneNumber").ShouldBeNull(); |
|||
mappingStandardData.TryGetData("template").ShouldBeNull(); |
|||
mappingStandardData.TryGetData("otherDataKey").ShouldBeNull(); |
|||
mappingStandardData.ExtraProperties.Count.ShouldBe(6); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Origin_Notification_Data_Test() |
|||
{ |
|||
var mappingOriginItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test3); |
|||
|
|||
var mappingOriginData = mappingOriginItem.MappingFunc(_notificationData); |
|||
|
|||
// 按照自定义规则,所有数据被保留
|
|||
mappingOriginData.TryGetData(NotificationSmsOptions.TemplateParamsPrefix + "phoneNumber").ShouldNotBeNull(); |
|||
mappingOriginData.TryGetData(NotificationSmsOptions.TemplateParamsPrefix + "template").ShouldNotBeNull(); |
|||
mappingOriginData.TryGetData("otherDataKey").ShouldNotBeNull(); |
|||
mappingOriginData.ExtraProperties.Count.ShouldBe(9); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,77 +1,77 @@ |
|||
using Microsoft.Extensions.Options; |
|||
using Shouldly; |
|||
using System; |
|||
using Xunit; |
|||
|
|||
namespace LINGYUN.Abp.Notifications.WeChat.MiniProgram |
|||
{ |
|||
public class WeChatMiniProgramNotificationDataMapping_Tests : AbpNotificationsWeChatMiniProgramTestsBase |
|||
{ |
|||
private readonly NotificationData _notificationData; |
|||
protected AbpNotificationOptions NotificationOptions { get; } |
|||
protected AbpNotificationsWeChatMiniProgramOptions NotificationWeChatMiniProgramOptions { get; } |
|||
public WeChatMiniProgramNotificationDataMapping_Tests() |
|||
{ |
|||
NotificationOptions = GetRequiredService<IOptions<AbpNotificationOptions>>().Value; |
|||
NotificationWeChatMiniProgramOptions = GetRequiredService<IOptions<AbpNotificationsWeChatMiniProgramOptions>>().Value; |
|||
|
|||
_notificationData = new NotificationData(); |
|||
InitNotificationData(_notificationData); |
|||
} |
|||
|
|||
private void InitNotificationData(NotificationData data) |
|||
{ |
|||
data.WriteStandardData("title", "message", DateTime.Now, "formUser", "description"); |
|||
data.WriteStandardData(NotificationWeChatMiniProgramOptions.DefaultMsgPrefix, "openid", "TEST"); |
|||
data.TrySetData("otherDataKey", "otherDataValue"); |
|||
} |
|||
|
|||
|
|||
[Fact] |
|||
public void Mapping_WeChatMiniProgram_Notification_Data_Test() |
|||
{ |
|||
var mappingOpenIdItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test1); |
|||
|
|||
mappingOpenIdItem.ShouldNotBeNull(); |
|||
|
|||
var mappingOpenIdData = mappingOpenIdItem.MappingFunc(_notificationData); |
|||
mappingOpenIdData.TryGetData("openid").ShouldNotBeNull(); |
|||
mappingOpenIdData.TryGetData("openid").ToString().ShouldBe("TEST"); |
|||
|
|||
// 按照预定义规则,这条数据被丢弃
|
|||
mappingOpenIdData.TryGetData("otherDataKey").ShouldBeNull(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Standard_Notification_Data_Test() |
|||
{ |
|||
var mappingStandardItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test2); |
|||
|
|||
var mappingStandardData = mappingStandardItem.MappingFunc(_notificationData); |
|||
|
|||
// 按照自定义规则,其他数据被丢弃
|
|||
mappingStandardData.TryGetData("openid").ShouldBeNull(); |
|||
mappingStandardData.TryGetData("otherDataKey").ShouldBeNull(); |
|||
mappingStandardData.Properties.Count.ShouldBe(6); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Origin_Notification_Data_Test() |
|||
{ |
|||
var mappingOriginItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test3); |
|||
|
|||
var mappingOriginData = mappingOriginItem.MappingFunc(_notificationData); |
|||
|
|||
// 按照自定义规则,所有数据被保留
|
|||
mappingOriginData.TryGetData(NotificationWeChatMiniProgramOptions.DefaultMsgPrefix + "openid").ShouldNotBeNull(); |
|||
mappingOriginData.TryGetData("otherDataKey").ShouldNotBeNull(); |
|||
mappingOriginData.Properties.Count.ShouldBe(8); |
|||
} |
|||
} |
|||
} |
|||
using Microsoft.Extensions.Options; |
|||
using Shouldly; |
|||
using System; |
|||
using Xunit; |
|||
|
|||
namespace LINGYUN.Abp.Notifications.WeChat.MiniProgram |
|||
{ |
|||
public class WeChatMiniProgramNotificationDataMapping_Tests : AbpNotificationsWeChatMiniProgramTestsBase |
|||
{ |
|||
private readonly NotificationData _notificationData; |
|||
protected AbpNotificationOptions NotificationOptions { get; } |
|||
protected AbpNotificationsWeChatMiniProgramOptions NotificationWeChatMiniProgramOptions { get; } |
|||
public WeChatMiniProgramNotificationDataMapping_Tests() |
|||
{ |
|||
NotificationOptions = GetRequiredService<IOptions<AbpNotificationOptions>>().Value; |
|||
NotificationWeChatMiniProgramOptions = GetRequiredService<IOptions<AbpNotificationsWeChatMiniProgramOptions>>().Value; |
|||
|
|||
_notificationData = new NotificationData(); |
|||
InitNotificationData(_notificationData); |
|||
} |
|||
|
|||
private void InitNotificationData(NotificationData data) |
|||
{ |
|||
data.WriteStandardData("title", "message", DateTime.Now, "formUser", "description"); |
|||
data.WriteStandardData(NotificationWeChatMiniProgramOptions.DefaultMsgPrefix, "openid", "TEST"); |
|||
data.TrySetData("otherDataKey", "otherDataValue"); |
|||
} |
|||
|
|||
|
|||
[Fact] |
|||
public void Mapping_WeChatMiniProgram_Notification_Data_Test() |
|||
{ |
|||
var mappingOpenIdItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test1); |
|||
|
|||
mappingOpenIdItem.ShouldNotBeNull(); |
|||
|
|||
var mappingOpenIdData = mappingOpenIdItem.MappingFunc(_notificationData); |
|||
mappingOpenIdData.TryGetData("openid").ShouldNotBeNull(); |
|||
mappingOpenIdData.TryGetData("openid").ToString().ShouldBe("TEST"); |
|||
|
|||
// 按照预定义规则,这条数据被丢弃
|
|||
mappingOpenIdData.TryGetData("otherDataKey").ShouldBeNull(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Standard_Notification_Data_Test() |
|||
{ |
|||
var mappingStandardItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test2); |
|||
|
|||
var mappingStandardData = mappingStandardItem.MappingFunc(_notificationData); |
|||
|
|||
// 按照自定义规则,其他数据被丢弃
|
|||
mappingStandardData.TryGetData("openid").ShouldBeNull(); |
|||
mappingStandardData.TryGetData("otherDataKey").ShouldBeNull(); |
|||
mappingStandardData.ExtraProperties.Count.ShouldBe(6); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Mapping_Origin_Notification_Data_Test() |
|||
{ |
|||
var mappingOriginItem = NotificationOptions |
|||
.NotificationDataMappings |
|||
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test3); |
|||
|
|||
var mappingOriginData = mappingOriginItem.MappingFunc(_notificationData); |
|||
|
|||
// 按照自定义规则,所有数据被保留
|
|||
mappingOriginData.TryGetData(NotificationWeChatMiniProgramOptions.DefaultMsgPrefix + "openid").ShouldNotBeNull(); |
|||
mappingOriginData.TryGetData("otherDataKey").ShouldNotBeNull(); |
|||
mappingOriginData.ExtraProperties.Count.ShouldBe(8); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue