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;
|
||||
|
||||
@@ -61,13 +61,21 @@
|
||||
|
||||
<div class="notice">
|
||||
<el-dropdown trigger="click" :max-height="500">
|
||||
<el-badge :value="noticeStore.noticeForNoReadCount">
|
||||
<el-badge v-if="noticeStore.noticeForNoReadCount>0" :value="noticeStore.noticeForNoReadCount">
|
||||
<el-button type="primary">
|
||||
<el-icon :size="15">
|
||||
<Bell />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</el-badge>
|
||||
|
||||
<el-button v-else="noticeStore.noticeForNoReadCount" type="primary">
|
||||
<el-icon :size="15">
|
||||
<Bell />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
|
||||
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
|
||||
|
||||
@@ -10,13 +10,17 @@ const isFixed = ref(false);
|
||||
const form = reactive({
|
||||
name: "Acme.BookStore",
|
||||
isCsf: true,
|
||||
dbType: 'sqlite'
|
||||
dbType: 'sqlite',
|
||||
type:"module"
|
||||
});
|
||||
const installText = "> dotnet tool install -g Yi.Abp.Tool";
|
||||
const commandTest = "> yi-abp new Acme.BookStore -t module -csf";
|
||||
const cloneText = "> git clone https://gitee.com/ccnetcore/Yi ";
|
||||
const cloneText = "> yi-abp clone ";
|
||||
|
||||
const onDbTypeSelected = (data) => {
|
||||
form.dbType = data.value;
|
||||
}
|
||||
const onProjectSelected=(data)=>{
|
||||
|
||||
}
|
||||
const dbData = [
|
||||
{ name: 'Sqlite', key: 'sqlite', value: 'sqlite' },
|
||||
@@ -29,9 +33,21 @@ const dbData = [
|
||||
|
||||
|
||||
const typeData = [{ name: '模块', key: 'module', value: 'module' },
|
||||
{ name: '项目', key: 'project', value: 'project' }]
|
||||
{ name: '模块', key: 'project', value: 'project' }]
|
||||
const addModuleComputed=computed(()=>{
|
||||
|
||||
return `> yi-abp add-module ${form.name.toLowerCase().replace(/\./g, "-")}`;
|
||||
})
|
||||
|
||||
const commandComputed=computed(()=>{
|
||||
return `yi-abp new ${form.name} -t module ${form.isCsf==true?'-csf':''}`
|
||||
let dbType=form.dbType;
|
||||
if(dbType=="sqlite")
|
||||
{
|
||||
dbType=""
|
||||
}
|
||||
|
||||
|
||||
return `> yi-abp new ${form.name} -t module ${dbType!=''?'-dbms '+form.dbType:''} ${form.isCsf==true?'-csf':''}`
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
@@ -50,7 +66,6 @@ const scrolling = () => {
|
||||
var width = document.getElementById('command').getBoundingClientRect().width;
|
||||
|
||||
document.getElementById('command').style.width = width + 'px';
|
||||
|
||||
if (scrollTop > commandBoxTop) {
|
||||
|
||||
isFixed.value = true;
|
||||
@@ -79,7 +94,7 @@ onUnmounted(() => {
|
||||
<CodeBox v-model="installText" />
|
||||
|
||||
<h4>克隆源代码,yi框架非打包,便于大家调试二开</h4>
|
||||
<p>需安装git,执行命令:</p>
|
||||
<p>需安装git及Yi.Abp.Tool,执行命令:</p>
|
||||
<CodeBox v-model="cloneText" />
|
||||
|
||||
|
||||
@@ -88,6 +103,11 @@ onUnmounted(() => {
|
||||
<CodeBox id="command" :class="{ command: isFixed }" v-model="commandComputed" />
|
||||
|
||||
|
||||
<h4>将你创建的模块添加到当前解决方案中</h4>
|
||||
<p>在module文件夹内,命令行终端运行以下命令:</p>
|
||||
<CodeBox v-model="addModuleComputed" />
|
||||
|
||||
|
||||
<h4>配置</h4>
|
||||
<p>您可以更改下面的解决方案配置。</p>
|
||||
|
||||
@@ -98,7 +118,7 @@ onUnmounted(() => {
|
||||
|
||||
|
||||
<h5>选择创建类型</h5>
|
||||
<SlectBox :data="typeData" width="25%" @onSelected="onDbTypeSelected" />
|
||||
<SlectBox :data="typeData" width="25%" @onSelected="onProjectSelected" />
|
||||
|
||||
|
||||
<h5>选择数据库管理系统</h5>
|
||||
@@ -122,7 +142,7 @@ onUnmounted(() => {
|
||||
position: fixed !important;
|
||||
z-index: 99;
|
||||
top: 100px;
|
||||
width: 1000px;
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
.start-body {
|
||||
@@ -151,7 +171,7 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
&-body {
|
||||
height: 1200px;
|
||||
height: 1400px;
|
||||
padding: 48px;
|
||||
background-color: #fff;
|
||||
border-radius: 12px;
|
||||
|
||||
@@ -28,6 +28,7 @@ watch(()=>props.isSelect,(n,o)=>{
|
||||
}
|
||||
|
||||
.box {
|
||||
cursor: pointer;
|
||||
color: #292d33;
|
||||
background-color: #fafafa;
|
||||
padding: 18px !important;
|
||||
|
||||
Reference in New Issue
Block a user