From c23ff654edcebda836e95a0cebc4bc7aa737fde4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sat, 8 Jun 2024 21:51:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90add-module=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/DiscussConst.cs | 2 +- .../CommentCreatedEventHandler.cs | 4 +- .../Entities/UserAggregateRoot.cs | 2 +- Yi.Abp.Net8/src/Yi.Abp.Web/TestOptions.cs | 30 ----------- Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs | 3 -- .../Yi.Abp.Tool/Commands/AddModuleCommand.cs | 9 ++-- .../tool/Yi.Abp.Tool/Commands/CloneCommand.cs | 50 +++++++++++++++++++ .../tool/Yi.Abp.Tool/Commands/HelpCommand.cs | 3 +- Yi.Bbs.Vue3/src/layout/AppHeader.vue | 10 +++- Yi.Bbs.Vue3/src/views/start/Index.vue | 40 +++++++++++---- .../src/views/start/components/Box.vue | 1 + 11 files changed, 101 insertions(+), 53 deletions(-) delete mode 100644 Yi.Abp.Net8/src/Yi.Abp.Web/TestOptions.cs create mode 100644 Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/CloneCommand.cs diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs index b29d6c4a..c7dc524f 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs @@ -18,6 +18,6 @@ namespace Yi.Framework.Bbs.Domain.Shared.Consts public const string AgreeNotice = "您的主题[{0}]被[{1}]用户点赞!得到一致认可,发现宝藏内容!"; - public const string CommentNotice = "您的主题[{0}]被[{1}]用户评论!评论内容:[{2}]。。。"; + public const string CommentNotice = "您的主题[{0}]被[{1}]用户评论!评论内容:[{2}]"; } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs index 45a5dfcc..0be15463 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs @@ -50,8 +50,8 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers var commentUser = await _userRepository.GetFirstAsync(x => x.Id == commentEntity.CreatorId); - //截取10个长度 - var content = commentEntity.Content.Length >= 10 ? commentEntity.Content.Substring(0, 10) : commentEntity.Content; + //截取30个长度 + var content = commentEntity.Content.Length >= 30 ? commentEntity.Content.Substring(0, 30)+"..." : commentEntity.Content; //通知主题作者,有人评论 await _localEventBus.PublishAsync(new BbsNoticeEventArgs(disucssDto.DiscussId, string.Format(DiscussConst.CommentNotice, disucssDto.DiscussTitle, commentUser.UserName, content)), false); } diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Entities/UserAggregateRoot.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Entities/UserAggregateRoot.cs index 78012041..3f992a59 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Entities/UserAggregateRoot.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Entities/UserAggregateRoot.cs @@ -24,7 +24,7 @@ namespace Yi.Framework.Rbac.Domain.Entities UserName = userName; EncryPassword.Password = password; Phone = phone; - Nick = nick; + Nick = nick+"-"+userName; BuildPassword(); } diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/TestOptions.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/TestOptions.cs deleted file mode 100644 index bbcce5d0..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/TestOptions.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Volo.Abp.Data; - -namespace Yi.Abp.Web -{ - public class TestOptions - { - public ConnectionStrings2 ConnectionStrings { get; set; }=new ConnectionStrings2(); - - public AbpDatabaseInfoDictionary2 Databases { get; set; }=new AbpDatabaseInfoDictionary2(); - } - - public class ConnectionStrings2 : Dictionary - { - } - public class AbpDatabaseInfoDictionary2 : Dictionary - { - } - - public class AbpDatabaseInfo2 - { - internal AbpDatabaseInfo2(string databaseName) - { - DatabaseName = databaseName; - MappedConnections = new HashSet(); - } - public string DatabaseName { get; } - public HashSet MappedConnections { get; } - public bool IsUsedByTenants { get; set; } = true; - } -} diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs index 6c86fbe1..5ec09a9a 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs @@ -3,7 +3,6 @@ using System.Text; using System.Threading.RateLimiting; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Cors; -using Microsoft.AspNetCore.RateLimiting; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; using Newtonsoft.Json.Converters; @@ -15,7 +14,6 @@ using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Auditing; using Volo.Abp.Autofac; using Volo.Abp.Caching; -using Volo.Abp.Data; using Volo.Abp.MultiTenancy; using Volo.Abp.Swashbuckle; using Yi.Abp.Application; @@ -251,7 +249,6 @@ namespace Yi.Abp.Web //授权 context.Services.AddAuthorization(); - Configure(configuration); return Task.CompletedTask; } diff --git a/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/AddModuleCommand.cs b/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/AddModuleCommand.cs index dd9c215f..4e72b395 100644 --- a/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/AddModuleCommand.cs +++ b/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/AddModuleCommand.cs @@ -13,7 +13,7 @@ namespace Yi.Abp.Tool.Commands public async Task InvokerAsync(Dictionary options, string[] args) { - //只有一个add + //只有一个add-module if (args.Length <= 1) { throw new UserFriendlyException("命令错误,add-module命令后必须添加 模块名"); @@ -23,18 +23,21 @@ namespace Yi.Abp.Tool.Commands var moduleName = args[1]; options.TryGetValue("modulePath", out var modulePath); + //模块路径默认按小写规则,当前路径 if (string.IsNullOrEmpty(modulePath)) { - throw new UserFriendlyException("命令错误,添加模块,必须指定模块路径"); + modulePath = moduleName.ToLower().Replace(".", "-"); } + + //解决方案默认在模块文件夹上一级,也可以通过s进行指定 var slnPath = string.Empty; options.TryGetValue("s", out var slnPath1); options.TryGetValue("solution", out var slnPath2); slnPath = string.IsNullOrEmpty(slnPath1) ? slnPath2 : slnPath1; if (string.IsNullOrEmpty(slnPath)) { - slnPath = "./"; + slnPath = "../"; } CheckFirstSlnPath(slnPath); diff --git a/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/CloneCommand.cs b/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/CloneCommand.cs new file mode 100644 index 00000000..52d81dc0 --- /dev/null +++ b/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/CloneCommand.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Abp.Tool.Commands +{ + public class CloneCommand : ICommand + { + public List CommandStrs => new List { "clone"}; + + private const string cloneAddress= "https://gitee.com/ccnetcore/Yi"; + public Task InvokerAsync(Dictionary options, string[] args) + { + StartCmd($"git clone {cloneAddress}"); + return Task.CompletedTask; + } + + /// + /// 执行cmd命令 + /// + /// + private void StartCmd(params string[] cmdCommands) + { + ProcessStartInfo psi = new ProcessStartInfo + { + FileName = "cmd.exe", + Arguments = $"/c chcp 65001&{string.Join("&", cmdCommands)}", + RedirectStandardInput = true, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = true, + UseShellExecute = false + }; + + Process proc = new Process + { + StartInfo = psi + }; + + proc.Start(); + string output = proc.StandardOutput.ReadToEnd(); + Console.WriteLine(output); + + proc.WaitForExit(); + } + } +} diff --git a/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/HelpCommand.cs b/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/HelpCommand.cs index f896a9cb..07d9c980 100644 --- a/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/HelpCommand.cs +++ b/Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/HelpCommand.cs @@ -30,8 +30,7 @@ namespace Yi.Abp.Tool.Commands > help: 查看帮助列表,写下命令` yi-abp help ` > new: 创建模块模板` yi-abp new -t module -csf ` > new: 创建项目模板` yi-abp new -csf ` - > add-module: 将内容添加到当前解决方案` yi-abp add-module -modulePath [-s ] ` - - add:例子:yi-abp add-module Acme.Demo -s "D:\code\csharp\source\Yi\Yi.Abp.Net8" -modulePath "D:\\code\\csharp\\source\\Yi\\Yi.Abp.Net8\\module\\acme-demo" + > add-module: 将内容添加到当前解决方案` yi-abp add-module [-modulePath ] [-s ] ` """); return Task.CompletedTask; diff --git a/Yi.Bbs.Vue3/src/layout/AppHeader.vue b/Yi.Bbs.Vue3/src/layout/AppHeader.vue index 7195449c..0d67eaa4 100644 --- a/Yi.Bbs.Vue3/src/layout/AppHeader.vue +++ b/Yi.Bbs.Vue3/src/layout/AppHeader.vue @@ -61,13 +61,21 @@
- + + + + + + + + +