committed by
GitHub
54 changed files with 4983 additions and 1559 deletions
@ -1,27 +1,42 @@ |
|||||
using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; |
using LINGYUN.Abp.AspNetCore.SignalR.JwtToken; |
||||
using LINGYUN.Abp.IM.SignalR.Messages; |
using LINGYUN.Abp.IM.Localization; |
||||
using LINGYUN.Abp.RealTime.SignalR; |
using LINGYUN.Abp.IM.SignalR.Messages; |
||||
using Volo.Abp.Modularity; |
using LINGYUN.Abp.RealTime.SignalR; |
||||
|
using Volo.Abp.Localization; |
||||
namespace LINGYUN.Abp.IM.SignalR |
using Volo.Abp.Modularity; |
||||
{ |
using Volo.Abp.VirtualFileSystem; |
||||
[DependsOn( |
|
||||
typeof(AbpIMModule), |
namespace LINGYUN.Abp.IM.SignalR |
||||
typeof(AbpRealTimeSignalRModule), |
{ |
||||
typeof(AbpAspNetCoreSignalRJwtTokenModule))] |
[DependsOn( |
||||
public class AbpIMSignalRModule : AbpModule |
typeof(AbpIMModule), |
||||
{ |
typeof(AbpRealTimeSignalRModule), |
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
typeof(AbpAspNetCoreSignalRJwtTokenModule))] |
||||
{ |
public class AbpIMSignalRModule : AbpModule |
||||
Configure<AbpIMOptions>(options => |
{ |
||||
{ |
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
options.Providers.Add<SignalRMessageSenderProvider>(); |
{ |
||||
}); |
Configure<AbpIMOptions>(options => |
||||
|
{ |
||||
Configure<AbpAspNetCoreSignalRJwtTokenMapPathOptions>(options => |
options.Providers.Add<SignalRMessageSenderProvider>(); |
||||
{ |
}); |
||||
options.MapPath("messages"); |
|
||||
}); |
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.EventBus; |
||||
|
using Volo.Abp.Localization; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
namespace LINGYUN.Abp.IM |
namespace LINGYUN.Abp.IM |
||||
{ |
{ |
||||
[DependsOn( |
[DependsOn( |
||||
typeof(AbpEventBusModule), |
typeof(AbpEventBusModule), |
||||
typeof(AbpRealTimeModule))] |
typeof(AbpRealTimeModule), |
||||
|
typeof(AbpLocalizationModule))] |
||||
public class AbpIMModule : AbpModule |
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 LINGYUN.Abp.RealTime.Localization; |
||||
using System.Collections.Generic; |
using System; |
||||
using System.ComponentModel.DataAnnotations; |
using Volo.Abp.Auditing; |
||||
using Volo.Abp.Auditing; |
using Volo.Abp.Data; |
||||
using Volo.Abp.EventBus; |
using Volo.Abp.EventBus; |
||||
using Volo.Abp.ObjectExtending; |
using Volo.Abp.Timing; |
||||
|
|
||||
namespace LINGYUN.Abp.IM.Messages |
namespace LINGYUN.Abp.IM.Messages |
||||
{ |
{ |
||||
[Serializable] |
[Serializable] |
||||
[EventName("im.message")] |
[EventName("im.message")] |
||||
public class ChatMessage : ExtensibleObject |
public class ChatMessage : IHasExtraProperties |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// 租户
|
/// 租户
|
||||
/// </summary>
|
/// </summary>
|
||||
public Guid? TenantId { get; set; } |
public Guid? TenantId { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 群组标识
|
/// 群组标识
|
||||
/// </summary>
|
/// </summary>
|
||||
public string GroupId { get; set; } |
public string GroupId { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 消息标识
|
/// 消息标识
|
||||
/// </summary>
|
/// </summary>
|
||||
/// <remarks>
|
/// <remarks>
|
||||
/// 调用者无需关注此字段,将由服务自动生成
|
/// 调用者无需关注此字段,将由服务自动生成
|
||||
/// </remarks>
|
/// </remarks>
|
||||
public string MessageId { get; set; } |
public string MessageId { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 发送者标识
|
/// 发送者标识
|
||||
/// </summary>
|
/// </summary>
|
||||
public Guid FormUserId { get; set; } |
public Guid FormUserId { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 发送者名称
|
/// 发送者名称
|
||||
/// </summary>
|
/// </summary>
|
||||
public string FormUserName { get; set; } |
public string FormUserName { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 接收用户标识
|
/// 接收用户标识
|
||||
/// </summary>
|
/// </summary>
|
||||
/// <remarks>
|
/// <remarks>
|
||||
/// 设计为可空是为了兼容群聊消息
|
/// 设计为可空是为了兼容群聊消息
|
||||
/// /remarks>
|
/// /remarks>
|
||||
public Guid? ToUserId { get; set; } |
public Guid? ToUserId { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 消息内容
|
/// 消息内容
|
||||
/// </summary>
|
/// </summary>
|
||||
[DisableAuditing] |
[DisableAuditing] |
||||
public string Content { get; set; } |
public string Content { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 发送时间
|
/// 发送时间
|
||||
/// </summary>
|
/// </summary>
|
||||
public DateTime SendTime { get; set; } |
public DateTime SendTime { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 是否匿名发送(存储在扩展字段)
|
/// 是否匿名发送(存储在扩展字段)
|
||||
/// </summary>
|
/// </summary>
|
||||
public bool IsAnonymous { get; set; } |
public bool IsAnonymous { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 消息类型
|
/// 消息类型
|
||||
/// </summary>
|
/// </summary>
|
||||
public MessageType MessageType { get; set; } = MessageType.Text; |
public MessageType MessageType { get; set; } = MessageType.Text; |
||||
|
|
||||
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
public MessageSourceTye Source { get; set; } = MessageSourceTye.User; |
||||
{ |
|
||||
var results = ExtensibleObjectValidator.GetValidationErrors(this, validationContext); |
public ExtraPropertyDictionary ExtraProperties { get; set; } |
||||
|
|
||||
foreach (var result in ValidateReceiver(validationContext)) |
public ChatMessage() |
||||
{ |
{ |
||||
results.Add(result); |
ExtraProperties = new ExtraPropertyDictionary(); |
||||
} |
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
return results; |
|
||||
} |
public static ChatMessage User( |
||||
|
Guid formUserId, |
||||
protected virtual IEnumerable<ValidationResult> ValidateReceiver(ValidationContext validationContext) |
string formUserName, |
||||
{ |
Guid toUserId, |
||||
if (GroupId.IsNullOrWhiteSpace() && !ToUserId.HasValue) |
string content, |
||||
{ |
IClock clock, |
||||
yield return new ValidationResult(""); |
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 |
using System; |
||||
{ |
using Volo.Abp.Auditing; |
||||
/// <summary>
|
using Volo.Abp.Data; |
||||
/// 上一次通讯消息
|
|
||||
/// </summary>
|
namespace LINGYUN.Abp.IM.Messages |
||||
public class LastChatMessage : ChatMessage |
{ |
||||
{ |
/// <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.AspNetCore.SignalR.JwtToken; |
||||
using LINGYUN.Abp.RealTime.SignalR; |
using LINGYUN.Abp.RealTime.SignalR; |
||||
using Volo.Abp.AspNetCore.SignalR; |
using Volo.Abp.AspNetCore.SignalR; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
|
|
||||
namespace LINGYUN.Abp.Notifications.SignalR |
namespace LINGYUN.Abp.Notifications.SignalR |
||||
{ |
{ |
||||
[DependsOn( |
[DependsOn( |
||||
typeof(AbpRealTimeSignalRModule), |
typeof(AbpRealTimeSignalRModule), |
||||
typeof(AbpNotificationModule), |
typeof(AbpNotificationModule), |
||||
typeof(AbpAspNetCoreSignalRModule), |
typeof(AbpAspNetCoreSignalRModule), |
||||
typeof(AbpAspNetCoreSignalRJwtTokenModule))] |
typeof(AbpAspNetCoreSignalRJwtTokenModule))] |
||||
public class AbpNotificationsSignalRModule : AbpModule |
public class AbpNotificationsSignalRModule : AbpModule |
||||
{ |
{ |
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
{ |
{ |
||||
Configure<AbpNotificationOptions>(options => |
Configure<AbpNotificationOptions>(options => |
||||
{ |
{ |
||||
options.PublishProviders.Add<SignalRNotificationPublishProvider>(); |
options.PublishProviders.Add<SignalRNotificationPublishProvider>(); |
||||
options.NotificationDataMappings |
options.NotificationDataMappings |
||||
.MappingDefault(SignalRNotificationPublishProvider.ProviderName, |
.MappingDefault(SignalRNotificationPublishProvider.ProviderName, |
||||
data => data); |
data => data.ToSignalRData()); |
||||
}); |
}); |
||||
|
|
||||
Configure<AbpAspNetCoreSignalRJwtTokenMapPathOptions>(options => |
Configure<AbpAspNetCoreSignalRJwtTokenMapPathOptions>(options => |
||||
{ |
{ |
||||
options.MapPath("notifications"); |
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 LINGYUN.Abp.RealTime.Localization; |
||||
using System.Collections.Generic; |
using System; |
||||
using Volo.Abp.EventBus; |
using Volo.Abp.Data; |
||||
|
using Volo.Abp.EventBus; |
||||
namespace LINGYUN.Abp.Notifications |
|
||||
{ |
namespace LINGYUN.Abp.Notifications |
||||
/// <summary>
|
{ |
||||
/// 通知数据
|
/// <summary>
|
||||
/// </summary>
|
/// 通知数据
|
||||
/// <remarks>
|
/// </summary>
|
||||
/// TODO: 2020-10-29 针对不同语言的用户,如果在发布时期就本地化语言是错误的设计
|
/// <remarks>
|
||||
/// 把通知的标题和内容设计为 <see cref="LocalizableStringInfo"/> 让客户端自行本地化
|
/// TODO: 2020-10-29 针对不同语言的用户,如果在发布时期就本地化语言是错误的设计
|
||||
/// </remarks>
|
/// 把通知的标题和内容设计为 <see cref="LocalizableStringInfo"/> 让客户端自行本地化
|
||||
[Serializable] |
/// </remarks>
|
||||
[EventName("notifications")] |
[Serializable] |
||||
public class NotificationData |
[EventName("notifications")] |
||||
{ |
public class NotificationData : IHasExtraProperties |
||||
/// <summary>
|
{ |
||||
/// 用来标识是否需要本地化的信息
|
/// <summary>
|
||||
/// </summary>
|
/// 用来标识是否需要本地化的信息
|
||||
public const string LocalizerKey = "localizer"; |
/// </summary>
|
||||
|
public const string LocalizerKey = "L"; |
||||
public virtual string Type => GetType().FullName; |
|
||||
|
public virtual string Type => GetType().FullName; |
||||
public object this[string key] |
|
||||
{ |
public object this[string key] |
||||
get |
{ |
||||
{ |
get |
||||
if(Properties.TryGetValue(key, out object @obj)) |
{ |
||||
{ |
return this.GetProperty(key); |
||||
return @obj; |
} |
||||
} |
set |
||||
return null; |
{ |
||||
} |
this.SetProperty(key, value); |
||||
set { Properties[key] = value; } |
} |
||||
} |
} |
||||
|
|
||||
public Dictionary<string, object> Properties |
public ExtraPropertyDictionary ExtraProperties { get; set; } |
||||
{ |
|
||||
get { return _properties; } |
public NotificationData() |
||||
set |
{ |
||||
{ |
ExtraProperties = new ExtraPropertyDictionary(); |
||||
if (value == null) |
this.SetDefaultsForExtraProperties(); |
||||
{ |
|
||||
throw new ArgumentNullException(nameof(value)); |
TrySetData(LocalizerKey, false); |
||||
} |
} |
||||
|
/// <summary>
|
||||
foreach (var keyValue in value) |
/// 写入本地化的消息数据
|
||||
{ |
/// </summary>
|
||||
if (!_properties.ContainsKey(keyValue.Key)) |
/// <param name="title"></param>
|
||||
{ |
/// <param name="message"></param>
|
||||
_properties[keyValue.Key] = keyValue.Value; |
/// <param name="createTime"></param>
|
||||
} |
/// <param name="formUser"></param>
|
||||
} |
/// <param name="description"></param>
|
||||
} |
/// <returns></returns>
|
||||
} |
public NotificationData WriteLocalizedData( |
||||
private readonly Dictionary<string, object> _properties; |
LocalizableStringInfo title, |
||||
|
LocalizableStringInfo message, |
||||
public NotificationData() |
DateTime createTime, |
||||
{ |
string formUser, |
||||
_properties = new Dictionary<string, object>(); |
LocalizableStringInfo description = null) |
||||
TrySetData(LocalizerKey, false); |
{ |
||||
} |
TrySetData("title", title); |
||||
/// <summary>
|
TrySetData("message", message); |
||||
/// 写入本地化的消息数据
|
TrySetData("formUser", formUser); |
||||
/// </summary>
|
TrySetData("createTime", createTime); |
||||
/// <param name="title"></param>
|
TrySetData(LocalizerKey, true); |
||||
/// <param name="message"></param>
|
if (description != null) |
||||
/// <param name="createTime"></param>
|
{ |
||||
/// <param name="formUser"></param>
|
TrySetData("description", description); |
||||
/// <param name="description"></param>
|
} |
||||
/// <returns></returns>
|
return this; |
||||
public NotificationData WriteLocalizedData( |
} |
||||
LocalizableStringInfo title, |
/// <summary>
|
||||
LocalizableStringInfo message, |
/// 写入标准数据
|
||||
DateTime createTime, |
/// </summary>
|
||||
string formUser, |
/// <param name="title">标题</param>
|
||||
LocalizableStringInfo description = null) |
/// <param name="message">内容</param>
|
||||
{ |
/// <param name="createTime">创建时间</param>
|
||||
TrySetData("title", title); |
/// <param name="formUser">来源用户</param>
|
||||
TrySetData("message", message); |
/// <param name="description">附加说明</param>
|
||||
TrySetData("formUser", formUser); |
/// <returns></returns>
|
||||
TrySetData("createTime", createTime); |
public NotificationData WriteStandardData(string title, string message, DateTime createTime, string formUser, string description = "") |
||||
TrySetData(LocalizerKey, true); |
{ |
||||
if (description != null) |
TrySetData("title", title); |
||||
{ |
TrySetData("message", message); |
||||
TrySetData("description", description); |
TrySetData("description", description); |
||||
} |
TrySetData("formUser", formUser); |
||||
return this; |
TrySetData("createTime", createTime); |
||||
} |
TrySetData(LocalizerKey, false); |
||||
/// <summary>
|
return this; |
||||
/// 写入标准数据
|
} |
||||
/// </summary>
|
/// <summary>
|
||||
/// <param name="title">标题</param>
|
/// 写入标准数据
|
||||
/// <param name="message">内容</param>
|
/// </summary>
|
||||
/// <param name="createTime">创建时间</param>
|
/// <param name="prefix">数据前缀</param>
|
||||
/// <param name="formUser">来源用户</param>
|
/// <param name="key">标识</param>
|
||||
/// <param name="description">附加说明</param>
|
/// <param name="value">数据内容</param>
|
||||
/// <returns></returns>
|
/// <returns></returns>
|
||||
public NotificationData WriteStandardData(string title, string message, DateTime createTime, string formUser, string description = "") |
public NotificationData WriteStandardData(string prefix, string key, object value) |
||||
{ |
{ |
||||
TrySetData("title", title); |
TrySetData(string.Concat(prefix, key), value); |
||||
TrySetData("message", message); |
TrySetData(LocalizerKey, false); |
||||
TrySetData("description", description); |
return this; |
||||
TrySetData("formUser", formUser); |
} |
||||
TrySetData("createTime", createTime); |
/// <summary>
|
||||
TrySetData(LocalizerKey, false); |
/// 转换为标准数据
|
||||
return this; |
/// </summary>
|
||||
} |
/// <param name="sourceData">原始数据</param>
|
||||
/// <summary>
|
/// <returns></returns>
|
||||
/// 写入标准数据
|
public static NotificationData ToStandardData(NotificationData sourceData) |
||||
/// </summary>
|
{ |
||||
/// <param name="prefix">数据前缀</param>
|
var data = new NotificationData(); |
||||
/// <param name="key">标识</param>
|
data.TrySetData("title", sourceData.TryGetData("title")); |
||||
/// <param name="value">数据内容</param>
|
data.TrySetData("message", sourceData.TryGetData("message")); |
||||
/// <returns></returns>
|
data.TrySetData("description", sourceData.TryGetData("description")); |
||||
public NotificationData WriteStandardData(string prefix, string key, object value) |
data.TrySetData("formUser", sourceData.TryGetData("formUser")); |
||||
{ |
data.TrySetData("createTime", sourceData.TryGetData("createTime")); |
||||
TrySetData(string.Concat(prefix, key), value); |
data.TrySetData(LocalizerKey, sourceData.TryGetData(LocalizerKey)); |
||||
TrySetData(LocalizerKey, false); |
return data; |
||||
return this; |
} |
||||
} |
/// <summary>
|
||||
/// <summary>
|
/// 转换为标准数据
|
||||
/// 转换为标准数据
|
/// </summary>
|
||||
/// </summary>
|
/// <param name="prefix">数据前缀</param>
|
||||
/// <param name="sourceData">原始数据</param>
|
/// <param name="sourceData">原始数据</param>
|
||||
/// <returns></returns>
|
/// <returns></returns>
|
||||
public static NotificationData ToStandardData(NotificationData sourceData) |
public static NotificationData ToStandardData(string prefix, NotificationData sourceData) |
||||
{ |
{ |
||||
var data = new NotificationData(); |
var data = ToStandardData(sourceData); |
||||
data.TrySetData("title", sourceData.TryGetData("title")); |
|
||||
data.TrySetData("message", sourceData.TryGetData("message")); |
foreach (var property in sourceData.ExtraProperties) |
||||
data.TrySetData("description", sourceData.TryGetData("description")); |
{ |
||||
data.TrySetData("formUser", sourceData.TryGetData("formUser")); |
if (property.Key.StartsWith(prefix)) |
||||
data.TrySetData("createTime", sourceData.TryGetData("createTime")); |
{ |
||||
data.TrySetData(LocalizerKey, sourceData.TryGetData(LocalizerKey)); |
var key = property.Key.Replace(prefix, ""); |
||||
return data; |
data.TrySetData(key, property.Value); |
||||
} |
} |
||||
/// <summary>
|
} |
||||
/// 转换为标准数据
|
return data; |
||||
/// </summary>
|
} |
||||
/// <param name="prefix">数据前缀</param>
|
|
||||
/// <param name="sourceData">原始数据</param>
|
public object TryGetData(string key) |
||||
/// <returns></returns>
|
{ |
||||
public static NotificationData ToStandardData(string prefix, NotificationData sourceData) |
return this.GetProperty(key); |
||||
{ |
} |
||||
var data = ToStandardData(sourceData); |
public void TrySetData(string key, object value) |
||||
|
{ |
||||
foreach(var property in sourceData.Properties) |
this.SetProperty(key, value); |
||||
{ |
} |
||||
if (property.Key.StartsWith(prefix)) |
/// <summary>
|
||||
{ |
/// 需要本地化
|
||||
var key = property.Key.Replace(prefix, ""); |
/// </summary>
|
||||
data.TrySetData(key, property.Value); |
/// <returns></returns>
|
||||
} |
public bool NeedLocalizer() |
||||
} |
{ |
||||
return data; |
var localizer = TryGetData(LocalizerKey); |
||||
} |
if (localizer != null && localizer is bool needLocalizer) |
||||
|
{ |
||||
public object TryGetData(string key) |
return needLocalizer; |
||||
{ |
} |
||||
if (Properties.TryGetValue(key, out object value)) |
return false; |
||||
{ |
} |
||||
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; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|||||
@ -1,38 +1,39 @@ |
|||||
using Newtonsoft.Json; |
using LINGYUN.Abp.RealTime.Localization; |
||||
|
using Newtonsoft.Json; |
||||
namespace LINGYUN.Abp.Notifications |
|
||||
{ |
namespace LINGYUN.Abp.Notifications |
||||
public class NotificationDataConverter |
{ |
||||
{ |
public class NotificationDataConverter |
||||
public static NotificationData Convert(NotificationData notificationData) |
{ |
||||
{ |
public static NotificationData Convert(NotificationData notificationData) |
||||
if (notificationData != null) |
{ |
||||
{ |
if (notificationData != null) |
||||
if (notificationData.NeedLocalizer()) |
{ |
||||
{ |
if (notificationData.NeedLocalizer()) |
||||
// 潜在的空对象引用修复
|
{ |
||||
if (notificationData.Properties.TryGetValue("title", out object title) && title != null) |
// 潜在的空对象引用修复
|
||||
{ |
if (notificationData.ExtraProperties.TryGetValue("title", out object title) && title != null) |
||||
var titleObj = JsonConvert.DeserializeObject<LocalizableStringInfo>(title.ToString()); |
{ |
||||
notificationData.TrySetData("title", titleObj); |
var titleObj = JsonConvert.DeserializeObject<LocalizableStringInfo>(title.ToString()); |
||||
} |
notificationData.TrySetData("title", titleObj); |
||||
if (notificationData.Properties.TryGetValue("message", out object message) && message != null) |
} |
||||
{ |
if (notificationData.ExtraProperties.TryGetValue("message", out object message) && message != null) |
||||
var messageObj = JsonConvert.DeserializeObject<LocalizableStringInfo>(message.ToString()); |
{ |
||||
notificationData.TrySetData("message", messageObj); |
var messageObj = JsonConvert.DeserializeObject<LocalizableStringInfo>(message.ToString()); |
||||
} |
notificationData.TrySetData("message", messageObj); |
||||
|
} |
||||
if (notificationData.Properties.TryGetValue("description", out object description) && description != null) |
|
||||
{ |
if (notificationData.ExtraProperties.TryGetValue("description", out object description) && description != null) |
||||
notificationData.TrySetData("description", JsonConvert.DeserializeObject<LocalizableStringInfo>(description.ToString())); |
{ |
||||
} |
notificationData.TrySetData("description", JsonConvert.DeserializeObject<LocalizableStringInfo>(description.ToString())); |
||||
} |
} |
||||
} |
} |
||||
else |
} |
||||
{ |
else |
||||
notificationData = new NotificationData(); |
{ |
||||
} |
notificationData = new NotificationData(); |
||||
return notificationData; |
} |
||||
} |
return notificationData; |
||||
} |
} |
||||
} |
} |
||||
|
} |
||||
|
|||||
@ -1,38 +1,38 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.Notifications |
namespace LINGYUN.Abp.RealTime.Localization |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// The notification that needs to be localized
|
/// The notification that needs to be localized
|
||||
/// </summary>
|
/// </summary>
|
||||
public class LocalizableStringInfo |
public class LocalizableStringInfo |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Resource name
|
/// Resource name
|
||||
/// </summary>
|
/// </summary>
|
||||
public string ResourceName { get; } |
public string ResourceName { get; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// Properties
|
/// Properties
|
||||
/// </summary>
|
/// </summary>
|
||||
public string Name { get; } |
public string Name { get; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// Formatted data
|
/// Formatted data
|
||||
/// </summary>
|
/// </summary>
|
||||
public Dictionary<object, object> Values { get; } |
public Dictionary<object, object> Values { get; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// Instantiate <see cref="LocalizableStringInfo"/>
|
/// Instantiate <see cref="LocalizableStringInfo"/>
|
||||
/// </summary>
|
/// </summary>
|
||||
/// <param name="resourceName">Resource name</param>
|
/// <param name="resourceName">Resource name</param>
|
||||
/// <param name="name">Properties</param>
|
/// <param name="name">Properties</param>
|
||||
/// <param name="values">Formatted data</param>
|
/// <param name="values">Formatted data</param>
|
||||
public LocalizableStringInfo( |
public LocalizableStringInfo( |
||||
string resourceName, |
string resourceName, |
||||
string name, |
string name, |
||||
Dictionary<object, object> values = null) |
Dictionary<object, object> values = null) |
||||
{ |
{ |
||||
ResourceName = resourceName; |
ResourceName = resourceName; |
||||
Name = name; |
Name = name; |
||||
Values = values; |
Values = values; |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,11 +1,11 @@ |
|||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using Volo.Abp.Users; |
using Volo.Abp.Users; |
||||
|
|
||||
namespace LINGYUN.Abp.MessageService.Chat |
namespace LINGYUN.Abp.MessageService.Chat |
||||
{ |
{ |
||||
public interface IChatDataSeeder |
public interface IChatDataSeeder |
||||
{ |
{ |
||||
Task SeedAsync( |
Task SeedAsync( |
||||
IUserData user); |
IUserData user); |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,80 +1,84 @@ |
|||||
using LINGYUN.Abp.IM.Contract; |
using LINGYUN.Abp.IM.Contract; |
||||
using System; |
using System; |
||||
using Volo.Abp.Domain.Entities.Auditing; |
using Volo.Abp.Domain.Entities.Auditing; |
||||
using Volo.Abp.MultiTenancy; |
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
namespace LINGYUN.Abp.MessageService.Chat |
namespace LINGYUN.Abp.MessageService.Chat |
||||
{ |
{ |
||||
public class UserChatFriend : CreationAuditedAggregateRoot<long>, IMultiTenant |
public class UserChatFriend : CreationAuditedAggregateRoot<long>, IMultiTenant |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// 租户
|
/// 租户
|
||||
/// </summary>
|
/// </summary>
|
||||
public virtual Guid? TenantId { get; protected set; } |
public virtual Guid? TenantId { get; protected set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 用户标识
|
/// 用户标识
|
||||
/// </summary>
|
/// </summary>
|
||||
public virtual Guid UserId { get; protected set; } |
public virtual Guid UserId { get; protected set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 好友标识
|
/// 好友标识
|
||||
/// </summary>
|
/// </summary>
|
||||
public virtual Guid FrientId { get; protected set; } |
public virtual Guid FrientId { get; protected set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 已添加黑名单
|
/// 系统预置
|
||||
/// </summary>
|
/// </summary>
|
||||
public virtual bool Black { get; set; } |
public virtual bool IsStatic { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 消息免打扰
|
/// 已添加黑名单
|
||||
/// </summary>
|
/// </summary>
|
||||
public virtual bool DontDisturb { get; set; } |
public virtual bool Black { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 特别关注
|
/// 消息免打扰
|
||||
/// </summary>
|
/// </summary>
|
||||
public virtual bool SpecialFocus { get; set; } |
public virtual bool DontDisturb { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 备注名称
|
/// 特别关注
|
||||
/// </summary>
|
/// </summary>
|
||||
public virtual string RemarkName { get; set; } |
public virtual bool SpecialFocus { get; set; } |
||||
/// <summary>
|
/// <summary>
|
||||
/// 附加说明
|
/// 备注名称
|
||||
/// </summary>
|
/// </summary>
|
||||
public virtual string Description { get; set; } |
public virtual string RemarkName { get; set; } |
||||
|
/// <summary>
|
||||
public virtual UserFriendStatus Status { get; protected set; } |
/// 附加说明
|
||||
|
/// </summary>
|
||||
protected UserChatFriend() |
public virtual string Description { get; set; } |
||||
{ |
|
||||
} |
public virtual UserFriendStatus Status { get; protected set; } |
||||
|
|
||||
public UserChatFriend( |
protected UserChatFriend() |
||||
Guid userId, |
{ |
||||
Guid friendId, |
} |
||||
string remarkName = "", |
|
||||
string description = "", |
public UserChatFriend( |
||||
Guid? tenantId = null) |
Guid userId, |
||||
{ |
Guid friendId, |
||||
UserId = userId; |
string remarkName = "", |
||||
FrientId = friendId; |
string description = "", |
||||
RemarkName = remarkName; |
Guid? tenantId = null) |
||||
TenantId = tenantId; |
{ |
||||
Description = description; |
UserId = userId; |
||||
Status = UserFriendStatus.NeedValidation; |
FrientId = friendId; |
||||
} |
RemarkName = remarkName; |
||||
|
TenantId = tenantId; |
||||
public void SetStatus(UserFriendStatus status = UserFriendStatus.NeedValidation) |
Description = description; |
||||
{ |
Status = UserFriendStatus.NeedValidation; |
||||
if (Status == UserFriendStatus.NeedValidation && status == UserFriendStatus.Added) |
} |
||||
{ |
|
||||
// 如果是后续验证通过的需要单独的事件
|
public void SetStatus(UserFriendStatus status = UserFriendStatus.NeedValidation) |
||||
AddLocalEvent(new UserChatFriendEto |
{ |
||||
{ |
if (Status == UserFriendStatus.NeedValidation && status == UserFriendStatus.Added) |
||||
TenantId = TenantId, |
{ |
||||
UserId = UserId, |
// 如果是后续验证通过的需要单独的事件
|
||||
FrientId = FrientId, |
AddLocalEvent(new UserChatFriendEto |
||||
Status = UserFriendStatus.Added |
{ |
||||
}); |
TenantId = TenantId, |
||||
} |
UserId = UserId, |
||||
Status = status; |
FrientId = FrientId, |
||||
} |
Status = UserFriendStatus.Added |
||||
} |
}); |
||||
} |
} |
||||
|
Status = status; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|||||
@ -1,25 +1,28 @@ |
|||||
using LINGYUN.Abp.IM.Messages; |
using LINGYUN.Abp.IM.Messages; |
||||
using System; |
using System; |
||||
|
|
||||
namespace LINGYUN.Abp.MessageService.Chat |
namespace LINGYUN.Abp.MessageService.Chat |
||||
{ |
{ |
||||
public class UserMessage : Message |
public class UserMessage : Message |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// 接收用户标识
|
/// 接收用户标识
|
||||
/// </summary>
|
/// </summary>
|
||||
public virtual Guid ReceiveUserId { get; set; } |
public virtual Guid ReceiveUserId { get; set; } |
||||
|
|
||||
protected UserMessage() { } |
protected UserMessage() { } |
||||
public UserMessage(long id, Guid sendUserId, string sendUserName, string content, MessageType type = MessageType.Text) |
public UserMessage( |
||||
: base(id, sendUserId, sendUserName, content, type) |
long id, |
||||
{ |
Guid sendUserId, |
||||
|
string sendUserName, |
||||
} |
Guid receiveUserId, |
||||
|
string content, |
||||
public void SendToUser(Guid receiveUserId) |
MessageType type = MessageType.Text, |
||||
{ |
MessageSourceTye source = MessageSourceTye.User, |
||||
ReceiveUserId = receiveUserId; |
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.IM.Messages; |
||||
using LINGYUN.Abp.MessageService.Chat; |
using LINGYUN.Abp.MessageService.Chat; |
||||
using LINGYUN.Abp.MessageService.Localization; |
using LINGYUN.Abp.MessageService.Localization; |
||||
using LINGYUN.Abp.MessageService.Notifications; |
using LINGYUN.Abp.MessageService.Notifications; |
||||
using LINGYUN.Abp.Notifications; |
using LINGYUN.Abp.Notifications; |
||||
using Microsoft.Extensions.Localization; |
using LINGYUN.Abp.RealTime.Localization; |
||||
using System; |
using Microsoft.Extensions.Localization; |
||||
using System.Collections.Generic; |
using System; |
||||
using System.Threading.Tasks; |
using System.Collections.Generic; |
||||
using Volo.Abp.Caching; |
using System.Threading.Tasks; |
||||
using Volo.Abp.DependencyInjection; |
using Volo.Abp.Caching; |
||||
using Volo.Abp.Domain.Entities.Events; |
using Volo.Abp.DependencyInjection; |
||||
using Volo.Abp.EventBus; |
using Volo.Abp.Domain.Entities.Events; |
||||
using Volo.Abp.Localization; |
using Volo.Abp.EventBus; |
||||
using Volo.Abp.Users; |
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Users; |
||||
namespace LINGYUN.Abp.MessageService.EventBus.Local |
|
||||
{ |
namespace LINGYUN.Abp.MessageService.EventBus.Local |
||||
public class UserChatFriendEventHandler : |
{ |
||||
ILocalEventHandler<EntityCreatedEventData<UserChatFriend>>, |
public class UserChatFriendEventHandler : |
||||
ILocalEventHandler<EntityDeletedEventData<UserChatFriend>>, |
ILocalEventHandler<EntityCreatedEventData<UserChatFriend>>, |
||||
ILocalEventHandler<EntityUpdatedEventData<UserChatFriend>>, |
ILocalEventHandler<EntityDeletedEventData<UserChatFriend>>, |
||||
ILocalEventHandler<UserChatFriendEto>, |
ILocalEventHandler<EntityUpdatedEventData<UserChatFriend>>, |
||||
ITransientDependency |
ILocalEventHandler<UserChatFriendEto>, |
||||
{ |
ITransientDependency |
||||
private IStringLocalizer _stringLocalizer; |
{ |
||||
private IMessageSender _messageSender; |
private IStringLocalizer _stringLocalizer; |
||||
private INotificationSender _notificationSender; |
private IMessageSender _messageSender; |
||||
private IDistributedCache<UserFriendCacheItem> _cache; |
private INotificationSender _notificationSender; |
||||
private ICurrentUser _currentUser; |
private IDistributedCache<UserFriendCacheItem> _cache; |
||||
|
private ICurrentUser _currentUser; |
||||
public UserChatFriendEventHandler( |
|
||||
ICurrentUser currentUser, |
public UserChatFriendEventHandler( |
||||
IMessageSender messageSender, |
ICurrentUser currentUser, |
||||
INotificationSender notificationSender, |
IMessageSender messageSender, |
||||
IDistributedCache<UserFriendCacheItem> cache, |
INotificationSender notificationSender, |
||||
IStringLocalizer<MessageServiceResource> stringLocalizer) |
IDistributedCache<UserFriendCacheItem> cache, |
||||
{ |
IStringLocalizer<MessageServiceResource> stringLocalizer) |
||||
_cache = cache; |
{ |
||||
_currentUser = currentUser; |
_cache = cache; |
||||
_messageSender = messageSender; |
_currentUser = currentUser; |
||||
_stringLocalizer = stringLocalizer; |
_messageSender = messageSender; |
||||
_notificationSender = notificationSender; |
_stringLocalizer = stringLocalizer; |
||||
} |
_notificationSender = notificationSender; |
||||
|
} |
||||
public virtual async Task HandleEventAsync(EntityCreatedEventData<UserChatFriend> eventData) |
|
||||
{ |
public virtual async Task HandleEventAsync(EntityCreatedEventData<UserChatFriend> eventData) |
||||
switch (eventData.Entity.Status) |
{ |
||||
{ |
switch (eventData.Entity.Status) |
||||
case IM.Contract.UserFriendStatus.NeedValidation: |
{ |
||||
await SendFriendValidationNotifierAsync(eventData.Entity); |
case IM.Contract.UserFriendStatus.NeedValidation: |
||||
break; |
await SendFriendValidationNotifierAsync(eventData.Entity); |
||||
} |
break; |
||||
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
} |
||||
} |
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
||||
|
} |
||||
public virtual async Task HandleEventAsync(EntityDeletedEventData<UserChatFriend> eventData) |
|
||||
{ |
public virtual async Task HandleEventAsync(EntityDeletedEventData<UserChatFriend> eventData) |
||||
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
{ |
||||
} |
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
||||
|
} |
||||
public virtual async Task HandleEventAsync(EntityUpdatedEventData<UserChatFriend> eventData) |
|
||||
{ |
public virtual async Task HandleEventAsync(EntityUpdatedEventData<UserChatFriend> eventData) |
||||
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
{ |
||||
} |
await RemoveUserFriendCacheItemAsync(eventData.Entity.UserId); |
||||
|
} |
||||
public virtual async Task HandleEventAsync(UserChatFriendEto eventData) |
|
||||
{ |
public virtual async Task HandleEventAsync(UserChatFriendEto eventData) |
||||
if (eventData.Status == IM.Contract.UserFriendStatus.Added) |
{ |
||||
{ |
if (eventData.Status == IM.Contract.UserFriendStatus.Added) |
||||
await SendFriendAddedMessageAsync(eventData.UserId, eventData.FrientId, eventData.TenantId); |
{ |
||||
} |
await SendFriendAddedMessageAsync(eventData.UserId, eventData.FrientId, eventData.TenantId); |
||||
} |
} |
||||
|
} |
||||
protected virtual async Task SendFriendAddedMessageAsync(Guid userId, Guid friendId, Guid? tenantId = null) |
|
||||
{ |
protected virtual async Task SendFriendAddedMessageAsync(Guid userId, Guid friendId, Guid? tenantId = null) |
||||
// 发送添加好友的第一条消息
|
{ |
||||
|
// 发送添加好友的第一条消息
|
||||
var addNewFirendMessage = new ChatMessage |
|
||||
{ |
var addNewFirendMessage = new ChatMessage |
||||
TenantId = tenantId, |
{ |
||||
FormUserId = _currentUser.GetId(), // 本地事件中可以获取到当前用户信息
|
TenantId = tenantId, |
||||
FormUserName = _currentUser.UserName, |
FormUserId = _currentUser.GetId(), // 本地事件中可以获取到当前用户信息
|
||||
SendTime = DateTime.Now, |
FormUserName = _currentUser.UserName, |
||||
MessageType = MessageType.Text, |
SendTime = DateTime.Now, |
||||
ToUserId = friendId, |
MessageType = MessageType.Text, |
||||
Content = _stringLocalizer["Messages:NewFriend"] |
ToUserId = friendId, |
||||
}; |
Content = _stringLocalizer["Messages:NewFriend"] |
||||
|
}; |
||||
await _messageSender.SendMessageAsync(addNewFirendMessage); |
|
||||
} |
await _messageSender.SendMessageAsync(addNewFirendMessage); |
||||
|
} |
||||
protected virtual async Task SendFriendValidationNotifierAsync(UserChatFriend userChatFriend) |
|
||||
{ |
protected virtual async Task SendFriendValidationNotifierAsync(UserChatFriend userChatFriend) |
||||
// 发送好友验证通知
|
{ |
||||
var userIdentifer = new UserIdentifier(userChatFriend.FrientId, userChatFriend.RemarkName); |
// 发送好友验证通知
|
||||
|
var userIdentifer = new UserIdentifier(userChatFriend.FrientId, userChatFriend.RemarkName); |
||||
var friendValidationNotifictionData = new NotificationData(); |
|
||||
friendValidationNotifictionData |
var friendValidationNotifictionData = new NotificationData(); |
||||
.WriteLocalizedData( |
friendValidationNotifictionData |
||||
new LocalizableStringInfo( |
.WriteLocalizedData( |
||||
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
new LocalizableStringInfo( |
||||
"Notifications:FriendValidation"), |
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
||||
new LocalizableStringInfo( |
"Notifications:FriendValidation"), |
||||
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
new LocalizableStringInfo( |
||||
"Notifications:RequestAddNewFriend", |
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
||||
new Dictionary<object, object> { { "name", _currentUser.UserName } }), |
"Notifications:RequestAddNewFriend", |
||||
DateTime.Now, |
new Dictionary<object, object> { { "name", _currentUser.UserName } }), |
||||
_currentUser.UserName, |
DateTime.Now, |
||||
new LocalizableStringInfo( |
_currentUser.UserName, |
||||
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
new LocalizableStringInfo( |
||||
"Notifications:RequestAddNewFriendDetail", |
LocalizationResourceNameAttribute.GetName(typeof(MessageServiceResource)), |
||||
new Dictionary<object, object> { { "description", userChatFriend.Description } })); |
"Notifications:RequestAddNewFriendDetail", |
||||
friendValidationNotifictionData.TrySetData("userId", userChatFriend.UserId); |
new Dictionary<object, object> { { "description", userChatFriend.Description } })); |
||||
friendValidationNotifictionData.TrySetData("frientId", userChatFriend.FrientId); |
friendValidationNotifictionData.TrySetData("userId", userChatFriend.UserId); |
||||
|
friendValidationNotifictionData.TrySetData("frientId", userChatFriend.FrientId); |
||||
await _notificationSender |
|
||||
.SendNofiterAsync( |
await _notificationSender |
||||
MessageServiceNotificationNames.IM.FriendValidation, |
.SendNofiterAsync( |
||||
friendValidationNotifictionData, |
MessageServiceNotificationNames.IM.FriendValidation, |
||||
userIdentifer, |
friendValidationNotifictionData, |
||||
userChatFriend.TenantId); |
userIdentifer, |
||||
} |
userChatFriend.TenantId); |
||||
|
} |
||||
protected virtual async Task RemoveUserFriendCacheItemAsync(Guid userId) |
|
||||
{ |
protected virtual async Task RemoveUserFriendCacheItemAsync(Guid userId) |
||||
// 移除好友缓存
|
{ |
||||
await _cache.RemoveAsync(UserFriendCacheItem.CalculateCacheKey(userId.ToString())); |
// 移除好友缓存
|
||||
} |
await _cache.RemoveAsync(UserFriendCacheItem.CalculateCacheKey(userId.ToString())); |
||||
} |
} |
||||
} |
} |
||||
|
} |
||||
|
|||||
@ -1,41 +1,40 @@ |
|||||
using AutoMapper; |
using AutoMapper; |
||||
using LINGYUN.Abp.MessageService.Notifications; |
using LINGYUN.Abp.MessageService.Notifications; |
||||
using LINGYUN.Abp.Notifications; |
using LINGYUN.Abp.Notifications; |
||||
using Newtonsoft.Json; |
using System; |
||||
using System; |
using Volo.Abp; |
||||
using Volo.Abp; |
using Volo.Abp.DependencyInjection; |
||||
using Volo.Abp.DependencyInjection; |
|
||||
|
namespace LINGYUN.Abp.MessageService.Mapper |
||||
namespace LINGYUN.Abp.MessageService.Mapper |
{ |
||||
{ |
public class NotificationTypeConverter : ITypeConverter<Notification, NotificationInfo>, ISingletonDependency |
||||
public class NotificationTypeConverter : ITypeConverter<Notification, NotificationInfo>, ISingletonDependency |
{ |
||||
{ |
public NotificationInfo Convert(Notification source, NotificationInfo destination, ResolutionContext context) |
||||
public NotificationInfo Convert(Notification source, NotificationInfo destination, ResolutionContext context) |
{ |
||||
{ |
destination = new NotificationInfo |
||||
destination = new NotificationInfo |
{ |
||||
{ |
Name = source.NotificationName, |
||||
Name = source.NotificationName, |
Type = source.Type, |
||||
Type = source.Type, |
Severity = source.Severity, |
||||
Severity = source.Severity, |
CreationTime = source.CreationTime, |
||||
CreationTime = source.CreationTime, |
TenantId = source.TenantId |
||||
TenantId = source.TenantId |
}; |
||||
}; |
destination.SetId(source.NotificationId); |
||||
destination.SetId(source.NotificationId); |
|
||||
|
var dataType = Type.GetType(source.NotificationTypeName); |
||||
var dataType = Type.GetType(source.NotificationTypeName); |
Check.NotNull(dataType, source.NotificationTypeName); |
||||
Check.NotNull(dataType, source.NotificationTypeName); |
var data = Activator.CreateInstance(dataType); |
||||
|
if (data != null && data is NotificationData notificationData) |
||||
var data = JsonConvert.DeserializeObject(source.NotificationData, dataType); |
{ |
||||
if (data != null && data is NotificationData notificationData) |
notificationData.ExtraProperties = source.ExtraProperties; |
||||
{ |
destination.Data = NotificationDataConverter.Convert(notificationData); |
||||
destination.Data = NotificationDataConverter.Convert(notificationData); |
} |
||||
} |
else |
||||
else |
{ |
||||
{ |
destination.Data = new NotificationData(); |
||||
destination.Data = new NotificationData(); |
destination.Data.ExtraProperties = source.ExtraProperties; |
||||
destination.Data.TrySetData("data", source.NotificationData); |
} |
||||
} |
return destination; |
||||
return destination; |
} |
||||
} |
} |
||||
} |
} |
||||
} |
|
||||
|
|||||
@ -1,40 +1,59 @@ |
|||||
using LINGYUN.Abp.Notifications; |
using LINGYUN.Abp.Notifications; |
||||
using System; |
using System; |
||||
using Volo.Abp.Auditing; |
using Volo.Abp.Auditing; |
||||
using Volo.Abp.Domain.Entities; |
using Volo.Abp.Data; |
||||
using Volo.Abp.MultiTenancy; |
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
namespace LINGYUN.Abp.MessageService.Notifications |
|
||||
{ |
namespace LINGYUN.Abp.MessageService.Notifications |
||||
public class Notification : Entity<long>, IMultiTenant, IHasCreationTime |
{ |
||||
{ |
public class Notification : Entity<long>, IMultiTenant, IHasCreationTime, IHasExtraProperties |
||||
public virtual Guid? TenantId { get; protected set; } |
{ |
||||
public virtual NotificationSeverity Severity { get; protected set; } |
public virtual Guid? TenantId { get; protected set; } |
||||
public virtual NotificationType Type { get; set; } |
public virtual NotificationSeverity Severity { get; protected set; } |
||||
public virtual long NotificationId { get; protected set; } |
public virtual NotificationType Type { get; set; } |
||||
public virtual string NotificationName { get; protected set; } |
public virtual long NotificationId { get; protected set; } |
||||
public virtual string NotificationData { get; protected set; } |
public virtual string NotificationName { get; protected set; } |
||||
public virtual string NotificationTypeName { get; protected set; } |
public virtual string NotificationTypeName { get; protected set; } |
||||
public virtual DateTime? ExpirationTime { get; set; } |
public virtual DateTime? ExpirationTime { get; set; } |
||||
public virtual DateTime CreationTime { get; set; } |
public virtual DateTime CreationTime { get; set; } |
||||
protected Notification(){} |
public virtual ExtraPropertyDictionary ExtraProperties { get; protected set; } |
||||
|
|
||||
public Notification(long id) |
protected Notification() |
||||
{ |
{ |
||||
Id = id; |
ExtraProperties = new ExtraPropertyDictionary(); |
||||
} |
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
public Notification(long id, string name, string dataType, string data, |
|
||||
NotificationSeverity severity = NotificationSeverity.Info, |
public Notification(long id) : this() |
||||
Guid? tenantId = null) |
{ |
||||
{ |
Id = id; |
||||
NotificationId = id; |
} |
||||
Severity = severity; |
|
||||
NotificationName = name; |
public Notification( |
||||
NotificationData = data; |
long id, |
||||
NotificationTypeName = dataType; |
string name, |
||||
Type = NotificationType.Application; |
string dataType, |
||||
TenantId = tenantId; |
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.Chat; |
||||
using LINGYUN.Abp.MessageService.Notifications; |
using LINGYUN.Abp.MessageService.Notifications; |
||||
using LINGYUN.Abp.Notifications; |
using LINGYUN.Abp.Notifications; |
||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using Volo.Abp.DependencyInjection; |
using Volo.Abp.DependencyInjection; |
||||
using Volo.Abp.Domain.Entities.Events; |
using Volo.Abp.Domain.Entities.Events; |
||||
using Volo.Abp.EventBus; |
using Volo.Abp.EventBus; |
||||
using Volo.Abp.Uow; |
using Volo.Abp.Uow; |
||||
using Volo.Abp.Users; |
using Volo.Abp.Users; |
||||
|
|
||||
namespace LINGYUN.Abp.MessageService.EventBus.Distributed |
namespace LINGYUN.Abp.MessageService.EventBus.Distributed |
||||
{ |
{ |
||||
public class UserCreateJoinIMEventHandler : ILocalEventHandler<EntityCreatedEventData<UserEto>>, ITransientDependency |
public class UserCreateJoinIMEventHandler : ILocalEventHandler<EntityCreatedEventData<UserEto>>, ITransientDependency |
||||
{ |
{ |
||||
private readonly IChatDataSeeder _chatDataSeeder; |
private readonly IChatDataSeeder _chatDataSeeder; |
||||
private readonly INotificationSubscriptionManager _notificationSubscriptionManager; |
private readonly INotificationSubscriptionManager _notificationSubscriptionManager; |
||||
public UserCreateJoinIMEventHandler( |
public UserCreateJoinIMEventHandler( |
||||
IChatDataSeeder chatDataSeeder, |
IChatDataSeeder chatDataSeeder, |
||||
INotificationSubscriptionManager notificationSubscriptionManager) |
INotificationSubscriptionManager notificationSubscriptionManager) |
||||
{ |
{ |
||||
_chatDataSeeder = chatDataSeeder; |
_chatDataSeeder = chatDataSeeder; |
||||
_notificationSubscriptionManager = notificationSubscriptionManager; |
_notificationSubscriptionManager = notificationSubscriptionManager; |
||||
} |
} |
||||
/// <summary>
|
/// <summary>
|
||||
/// 接收添加用户事件,初始化IM用户种子
|
/// 接收添加用户事件,初始化IM用户种子
|
||||
/// </summary>
|
/// </summary>
|
||||
/// <param name="eventData"></param>
|
/// <param name="eventData"></param>
|
||||
/// <returns></returns>
|
/// <returns></returns>
|
||||
[UnitOfWork] |
[UnitOfWork] |
||||
public virtual async Task HandleEventAsync(EntityCreatedEventData<UserEto> eventData) |
public virtual async Task HandleEventAsync(EntityCreatedEventData<UserEto> eventData) |
||||
{ |
{ |
||||
await SeedChatDataAsync(eventData.Entity); |
await SeedChatDataAsync(eventData.Entity); |
||||
} |
|
||||
|
await SeedUserSubscriptionNotifiersAsync(eventData.Entity); |
||||
protected virtual async Task SeedChatDataAsync(IUserData user) |
} |
||||
{ |
|
||||
await _chatDataSeeder.SeedAsync(user); |
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); |
protected virtual async Task SeedUserSubscriptionNotifiersAsync(IUserData user) |
||||
|
{ |
||||
await _notificationSubscriptionManager |
var userIdentifier = new UserIdentifier(user.Id, user.UserName); |
||||
.SubscribeAsync( |
|
||||
user.TenantId, |
await _notificationSubscriptionManager |
||||
userIdentifier, |
.SubscribeAsync( |
||||
MessageServiceNotificationNames.IM.FriendValidation); |
user.TenantId, |
||||
|
userIdentifier, |
||||
await _notificationSubscriptionManager |
MessageServiceNotificationNames.IM.FriendValidation); |
||||
.SubscribeAsync( |
|
||||
user.TenantId, |
await _notificationSubscriptionManager |
||||
userIdentifier, |
.SubscribeAsync( |
||||
MessageServiceNotificationNames.IM.NewFriend); |
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 Microsoft.Extensions.Options; |
||||
using Shouldly; |
using Shouldly; |
||||
using System; |
using System; |
||||
using Xunit; |
using Xunit; |
||||
|
|
||||
namespace LINGYUN.Abp.Notifications.Sms |
namespace LINGYUN.Abp.Notifications.Sms |
||||
{ |
{ |
||||
public class SmsNotificationDataMapping_Tests : AbpNotificationsSmsTestsBase |
public class SmsNotificationDataMapping_Tests : AbpNotificationsSmsTestsBase |
||||
{ |
{ |
||||
private readonly NotificationData _notificationData; |
private readonly NotificationData _notificationData; |
||||
protected AbpNotificationOptions NotificationOptions { get; } |
protected AbpNotificationOptions NotificationOptions { get; } |
||||
protected AbpNotificationsSmsOptions NotificationSmsOptions { get; } |
protected AbpNotificationsSmsOptions NotificationSmsOptions { get; } |
||||
public SmsNotificationDataMapping_Tests() |
public SmsNotificationDataMapping_Tests() |
||||
{ |
{ |
||||
NotificationOptions = GetRequiredService<IOptions<AbpNotificationOptions>>().Value; |
NotificationOptions = GetRequiredService<IOptions<AbpNotificationOptions>>().Value; |
||||
NotificationSmsOptions = GetRequiredService<IOptions<AbpNotificationsSmsOptions>>().Value; |
NotificationSmsOptions = GetRequiredService<IOptions<AbpNotificationsSmsOptions>>().Value; |
||||
|
|
||||
_notificationData = new NotificationData(); |
_notificationData = new NotificationData(); |
||||
InitNotificationData(_notificationData); |
InitNotificationData(_notificationData); |
||||
} |
} |
||||
|
|
||||
private void InitNotificationData(NotificationData data) |
private void InitNotificationData(NotificationData data) |
||||
{ |
{ |
||||
data.WriteStandardData("title", "message", DateTime.Now, "formUser", "description"); |
data.WriteStandardData("title", "message", DateTime.Now, "formUser", "description"); |
||||
data.WriteStandardData(NotificationSmsOptions.TemplateParamsPrefix, "phoneNumber", "13800138000"); |
data.WriteStandardData(NotificationSmsOptions.TemplateParamsPrefix, "phoneNumber", "13800138000"); |
||||
data.WriteStandardData(NotificationSmsOptions.TemplateParamsPrefix, "template", "SM_202011250901"); |
data.WriteStandardData(NotificationSmsOptions.TemplateParamsPrefix, "template", "SM_202011250901"); |
||||
data.TrySetData("otherDataKey", "otherDataValue"); |
data.TrySetData("otherDataKey", "otherDataValue"); |
||||
} |
} |
||||
|
|
||||
[Fact] |
[Fact] |
||||
public void Mapping_Sms_Notification_Data_Test() |
public void Mapping_Sms_Notification_Data_Test() |
||||
{ |
{ |
||||
var mappingSmsItem = NotificationOptions |
var mappingSmsItem = NotificationOptions |
||||
.NotificationDataMappings |
.NotificationDataMappings |
||||
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test1); |
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test1); |
||||
|
|
||||
mappingSmsItem.ShouldNotBeNull(); |
mappingSmsItem.ShouldNotBeNull(); |
||||
|
|
||||
var mappingSmsData = mappingSmsItem.MappingFunc(_notificationData); |
var mappingSmsData = mappingSmsItem.MappingFunc(_notificationData); |
||||
mappingSmsData.TryGetData("phoneNumber").ShouldNotBeNull(); |
mappingSmsData.TryGetData("phoneNumber").ShouldNotBeNull(); |
||||
mappingSmsData.TryGetData("phoneNumber").ToString().ShouldBe("13800138000"); |
mappingSmsData.TryGetData("phoneNumber").ToString().ShouldBe("13800138000"); |
||||
|
|
||||
mappingSmsData.TryGetData("template").ShouldNotBeNull(); |
mappingSmsData.TryGetData("template").ShouldNotBeNull(); |
||||
mappingSmsData.TryGetData("template").ToString().ShouldBe("SM_202011250901"); |
mappingSmsData.TryGetData("template").ToString().ShouldBe("SM_202011250901"); |
||||
|
|
||||
// 按照预定义规则,这条数据被丢弃
|
// 按照预定义规则,这条数据被丢弃
|
||||
mappingSmsData.TryGetData("otherDataKey").ShouldBeNull(); |
mappingSmsData.TryGetData("otherDataKey").ShouldBeNull(); |
||||
} |
} |
||||
|
|
||||
[Fact] |
[Fact] |
||||
public void Mapping_Standard_Notification_Data_Test() |
public void Mapping_Standard_Notification_Data_Test() |
||||
{ |
{ |
||||
var mappingStandardItem = NotificationOptions |
var mappingStandardItem = NotificationOptions |
||||
.NotificationDataMappings |
.NotificationDataMappings |
||||
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test2); |
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test2); |
||||
|
|
||||
var mappingStandardData = mappingStandardItem.MappingFunc(_notificationData); |
var mappingStandardData = mappingStandardItem.MappingFunc(_notificationData); |
||||
|
|
||||
// 按照自定义规则,其他数据被丢弃
|
// 按照自定义规则,其他数据被丢弃
|
||||
mappingStandardData.TryGetData("phoneNumber").ShouldBeNull(); |
mappingStandardData.TryGetData("phoneNumber").ShouldBeNull(); |
||||
mappingStandardData.TryGetData("template").ShouldBeNull(); |
mappingStandardData.TryGetData("template").ShouldBeNull(); |
||||
mappingStandardData.TryGetData("otherDataKey").ShouldBeNull(); |
mappingStandardData.TryGetData("otherDataKey").ShouldBeNull(); |
||||
mappingStandardData.Properties.Count.ShouldBe(6); |
mappingStandardData.ExtraProperties.Count.ShouldBe(6); |
||||
} |
} |
||||
|
|
||||
[Fact] |
[Fact] |
||||
public void Mapping_Origin_Notification_Data_Test() |
public void Mapping_Origin_Notification_Data_Test() |
||||
{ |
{ |
||||
var mappingOriginItem = NotificationOptions |
var mappingOriginItem = NotificationOptions |
||||
.NotificationDataMappings |
.NotificationDataMappings |
||||
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test3); |
.GetMapItemOrDefault(SmsNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test3); |
||||
|
|
||||
var mappingOriginData = mappingOriginItem.MappingFunc(_notificationData); |
var mappingOriginData = mappingOriginItem.MappingFunc(_notificationData); |
||||
|
|
||||
// 按照自定义规则,所有数据被保留
|
// 按照自定义规则,所有数据被保留
|
||||
mappingOriginData.TryGetData(NotificationSmsOptions.TemplateParamsPrefix + "phoneNumber").ShouldNotBeNull(); |
mappingOriginData.TryGetData(NotificationSmsOptions.TemplateParamsPrefix + "phoneNumber").ShouldNotBeNull(); |
||||
mappingOriginData.TryGetData(NotificationSmsOptions.TemplateParamsPrefix + "template").ShouldNotBeNull(); |
mappingOriginData.TryGetData(NotificationSmsOptions.TemplateParamsPrefix + "template").ShouldNotBeNull(); |
||||
mappingOriginData.TryGetData("otherDataKey").ShouldNotBeNull(); |
mappingOriginData.TryGetData("otherDataKey").ShouldNotBeNull(); |
||||
mappingOriginData.Properties.Count.ShouldBe(9); |
mappingOriginData.ExtraProperties.Count.ShouldBe(9); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,77 +1,77 @@ |
|||||
using Microsoft.Extensions.Options; |
using Microsoft.Extensions.Options; |
||||
using Shouldly; |
using Shouldly; |
||||
using System; |
using System; |
||||
using Xunit; |
using Xunit; |
||||
|
|
||||
namespace LINGYUN.Abp.Notifications.WeChat.MiniProgram |
namespace LINGYUN.Abp.Notifications.WeChat.MiniProgram |
||||
{ |
{ |
||||
public class WeChatMiniProgramNotificationDataMapping_Tests : AbpNotificationsWeChatMiniProgramTestsBase |
public class WeChatMiniProgramNotificationDataMapping_Tests : AbpNotificationsWeChatMiniProgramTestsBase |
||||
{ |
{ |
||||
private readonly NotificationData _notificationData; |
private readonly NotificationData _notificationData; |
||||
protected AbpNotificationOptions NotificationOptions { get; } |
protected AbpNotificationOptions NotificationOptions { get; } |
||||
protected AbpNotificationsWeChatMiniProgramOptions NotificationWeChatMiniProgramOptions { get; } |
protected AbpNotificationsWeChatMiniProgramOptions NotificationWeChatMiniProgramOptions { get; } |
||||
public WeChatMiniProgramNotificationDataMapping_Tests() |
public WeChatMiniProgramNotificationDataMapping_Tests() |
||||
{ |
{ |
||||
NotificationOptions = GetRequiredService<IOptions<AbpNotificationOptions>>().Value; |
NotificationOptions = GetRequiredService<IOptions<AbpNotificationOptions>>().Value; |
||||
NotificationWeChatMiniProgramOptions = GetRequiredService<IOptions<AbpNotificationsWeChatMiniProgramOptions>>().Value; |
NotificationWeChatMiniProgramOptions = GetRequiredService<IOptions<AbpNotificationsWeChatMiniProgramOptions>>().Value; |
||||
|
|
||||
_notificationData = new NotificationData(); |
_notificationData = new NotificationData(); |
||||
InitNotificationData(_notificationData); |
InitNotificationData(_notificationData); |
||||
} |
} |
||||
|
|
||||
private void InitNotificationData(NotificationData data) |
private void InitNotificationData(NotificationData data) |
||||
{ |
{ |
||||
data.WriteStandardData("title", "message", DateTime.Now, "formUser", "description"); |
data.WriteStandardData("title", "message", DateTime.Now, "formUser", "description"); |
||||
data.WriteStandardData(NotificationWeChatMiniProgramOptions.DefaultMsgPrefix, "openid", "TEST"); |
data.WriteStandardData(NotificationWeChatMiniProgramOptions.DefaultMsgPrefix, "openid", "TEST"); |
||||
data.TrySetData("otherDataKey", "otherDataValue"); |
data.TrySetData("otherDataKey", "otherDataValue"); |
||||
} |
} |
||||
|
|
||||
|
|
||||
[Fact] |
[Fact] |
||||
public void Mapping_WeChatMiniProgram_Notification_Data_Test() |
public void Mapping_WeChatMiniProgram_Notification_Data_Test() |
||||
{ |
{ |
||||
var mappingOpenIdItem = NotificationOptions |
var mappingOpenIdItem = NotificationOptions |
||||
.NotificationDataMappings |
.NotificationDataMappings |
||||
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test1); |
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test1); |
||||
|
|
||||
mappingOpenIdItem.ShouldNotBeNull(); |
mappingOpenIdItem.ShouldNotBeNull(); |
||||
|
|
||||
var mappingOpenIdData = mappingOpenIdItem.MappingFunc(_notificationData); |
var mappingOpenIdData = mappingOpenIdItem.MappingFunc(_notificationData); |
||||
mappingOpenIdData.TryGetData("openid").ShouldNotBeNull(); |
mappingOpenIdData.TryGetData("openid").ShouldNotBeNull(); |
||||
mappingOpenIdData.TryGetData("openid").ToString().ShouldBe("TEST"); |
mappingOpenIdData.TryGetData("openid").ToString().ShouldBe("TEST"); |
||||
|
|
||||
// 按照预定义规则,这条数据被丢弃
|
// 按照预定义规则,这条数据被丢弃
|
||||
mappingOpenIdData.TryGetData("otherDataKey").ShouldBeNull(); |
mappingOpenIdData.TryGetData("otherDataKey").ShouldBeNull(); |
||||
} |
} |
||||
|
|
||||
[Fact] |
[Fact] |
||||
public void Mapping_Standard_Notification_Data_Test() |
public void Mapping_Standard_Notification_Data_Test() |
||||
{ |
{ |
||||
var mappingStandardItem = NotificationOptions |
var mappingStandardItem = NotificationOptions |
||||
.NotificationDataMappings |
.NotificationDataMappings |
||||
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test2); |
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test2); |
||||
|
|
||||
var mappingStandardData = mappingStandardItem.MappingFunc(_notificationData); |
var mappingStandardData = mappingStandardItem.MappingFunc(_notificationData); |
||||
|
|
||||
// 按照自定义规则,其他数据被丢弃
|
// 按照自定义规则,其他数据被丢弃
|
||||
mappingStandardData.TryGetData("openid").ShouldBeNull(); |
mappingStandardData.TryGetData("openid").ShouldBeNull(); |
||||
mappingStandardData.TryGetData("otherDataKey").ShouldBeNull(); |
mappingStandardData.TryGetData("otherDataKey").ShouldBeNull(); |
||||
mappingStandardData.Properties.Count.ShouldBe(6); |
mappingStandardData.ExtraProperties.Count.ShouldBe(6); |
||||
} |
} |
||||
|
|
||||
[Fact] |
[Fact] |
||||
public void Mapping_Origin_Notification_Data_Test() |
public void Mapping_Origin_Notification_Data_Test() |
||||
{ |
{ |
||||
var mappingOriginItem = NotificationOptions |
var mappingOriginItem = NotificationOptions |
||||
.NotificationDataMappings |
.NotificationDataMappings |
||||
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test3); |
.GetMapItemOrDefault(WeChatMiniProgramNotificationPublishProvider.ProviderName, NotificationsTestsNames.Test3); |
||||
|
|
||||
var mappingOriginData = mappingOriginItem.MappingFunc(_notificationData); |
var mappingOriginData = mappingOriginItem.MappingFunc(_notificationData); |
||||
|
|
||||
// 按照自定义规则,所有数据被保留
|
// 按照自定义规则,所有数据被保留
|
||||
mappingOriginData.TryGetData(NotificationWeChatMiniProgramOptions.DefaultMsgPrefix + "openid").ShouldNotBeNull(); |
mappingOriginData.TryGetData(NotificationWeChatMiniProgramOptions.DefaultMsgPrefix + "openid").ShouldNotBeNull(); |
||||
mappingOriginData.TryGetData("otherDataKey").ShouldNotBeNull(); |
mappingOriginData.TryGetData("otherDataKey").ShouldNotBeNull(); |
||||
mappingOriginData.Properties.Count.ShouldBe(8); |
mappingOriginData.ExtraProperties.Count.ShouldBe(8); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue