feat: 完成add-module功能
This commit is contained in:
@@ -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}]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Yi.Framework.Rbac.Domain.Entities
|
||||
UserName = userName;
|
||||
EncryPassword.Password = password;
|
||||
Phone = phone;
|
||||
Nick = nick;
|
||||
Nick = nick+"-"+userName;
|
||||
BuildPassword();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<string, string?>
|
||||
{
|
||||
}
|
||||
public class AbpDatabaseInfoDictionary2 : Dictionary<string, AbpDatabaseInfo2>
|
||||
{
|
||||
}
|
||||
|
||||
public class AbpDatabaseInfo2
|
||||
{
|
||||
internal AbpDatabaseInfo2(string databaseName)
|
||||
{
|
||||
DatabaseName = databaseName;
|
||||
MappedConnections = new HashSet<string>();
|
||||
}
|
||||
public string DatabaseName { get; }
|
||||
public HashSet<string> MappedConnections { get; }
|
||||
public bool IsUsedByTenants { get; set; } = true;
|
||||
}
|
||||
}
|
||||
@@ -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<TestOptions>(configuration);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Yi.Abp.Tool.Commands
|
||||
|
||||
public async Task InvokerAsync(Dictionary<string, string> 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);
|
||||
|
||||
50
Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/CloneCommand.cs
Normal file
50
Yi.Abp.Net8/tool/Yi.Abp.Tool/Commands/CloneCommand.cs
Normal file
@@ -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<string> CommandStrs => new List<string> { "clone"};
|
||||
|
||||
private const string cloneAddress= "https://gitee.com/ccnetcore/Yi";
|
||||
public Task InvokerAsync(Dictionary<string, string> options, string[] args)
|
||||
{
|
||||
StartCmd($"git clone {cloneAddress}");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行cmd命令
|
||||
/// </summary>
|
||||
/// <param name="cmdCommands"></param>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,7 @@ namespace Yi.Abp.Tool.Commands
|
||||
> help: 查看帮助列表,写下命令` yi-abp help <command> `
|
||||
> new: 创建模块模板` yi-abp new <name> -t module -csf `
|
||||
> new: 创建项目模板` yi-abp new <name> -csf `
|
||||
> add-module: 将内容添加到当前解决方案` yi-abp add-module <moduleName> -modulePath <path> [-s <slnPath>] `
|
||||
- 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 <moduleName> [-modulePath <path>] [-s <slnPath>] `
|
||||
|
||||
""");
|
||||
return Task.CompletedTask;
|
||||
|
||||
Reference in New Issue
Block a user