diff --git a/README.md b/README.md index c494c401..05dc909a 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,6 @@ Rbac后台管理系统:[yi.ccnetcore.com](http://yi.ccnetcore.com) (已上 例如:我们大部分功能紧密贴合Sqlsugar,虽然缺少其他orm的替换性,但在使用程度上降低的使用难度 -例如:我们在应用层中使用属性注入,虽然依赖关系会比较模糊,但是使用起来会减少一定代码量 - > 一个面向用户的快速开发后端框架 在真正的使用这,你会明白这一点,极致的简单,也是优雅的一种体现。 diff --git a/Yi.BBS.Vue3/src/views/Login.vue b/Yi.BBS.Vue3/src/views/Login.vue index 5b516844..a39f813b 100644 --- a/Yi.BBS.Vue3/src/views/Login.vue +++ b/Yi.BBS.Vue3/src/views/Login.vue @@ -69,8 +69,8 @@ password:[ ]}) const loginForm = reactive({ - userName: "", - password: "", + userName: "cc", + password: "123456", uuid: "", code: "" }) diff --git a/Yi.Furion.Net6/.template.config/template.json b/Yi.Furion.Net6/.template.config/template.json new file mode 100644 index 00000000..86262b2c --- /dev/null +++ b/Yi.Furion.Net6/.template.config/template.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "YI", + "classifications": [ "Common", "Code" ], + "identity": "yi", + "name": "YI", + "shortName": "yi", + "sourceName": "Yi.Furion", + "tags": { + "language": "C#", + "type": "item" + }, + "sources": [ + { + "modifiers": [ + { + "exclude": [ "Server.Bin/**/*", "obj/**/*", "*.user", "*.vspscc", "*.vssscc", "*.cache",".git/**/*",".vs/**/*" ] + } + ] + } + ] + +} \ No newline at end of file diff --git a/Yi.Furion.Net6/Yi.Framework.Infrastructure/Sqlsugar/SqlSugarDbContext.cs b/Yi.Furion.Net6/Yi.Framework.Infrastructure/Sqlsugar/SqlSugarDbContext.cs index 880ef42c..702ca832 100644 --- a/Yi.Furion.Net6/Yi.Framework.Infrastructure/Sqlsugar/SqlSugarDbContext.cs +++ b/Yi.Furion.Net6/Yi.Framework.Infrastructure/Sqlsugar/SqlSugarDbContext.cs @@ -13,7 +13,7 @@ using Yi.Framework.Infrastructure.Data.Entities; namespace Yi.Framework.Infrastructure.Sqlsugar { - public class SqlSugarDbContext + public class SqlSugarDbContext { /// /// SqlSugar 客户端 @@ -109,7 +109,11 @@ namespace Yi.Framework.Infrastructure.Sqlsugar if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModificationTime))) { - entityInfo.SetValue(DateTime.Now); + //为空或者为默认最小值 + if (oldValue is null || DateTime.MinValue.Equals((DateTime)oldValue)) + { + entityInfo.SetValue(DateTime.Now); + } } if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModifierId))) { @@ -122,7 +126,11 @@ namespace Yi.Framework.Infrastructure.Sqlsugar case DataFilterType.InsertByObject: if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreationTime))) { - entityInfo.SetValue(DateTime.Now); + //为空或者为默认最小值 + if (oldValue is null || DateTime.MinValue.Equals((DateTime)oldValue)) + { + entityInfo.SetValue(DateTime.Now); + } } if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreatorId))) { diff --git a/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Dtos/WebFirstGetOutputDto.cs b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Dtos/WebFirstGetOutputDto.cs new file mode 100644 index 00000000..f4a2da45 --- /dev/null +++ b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Dtos/WebFirstGetOutputDto.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Module.WebFirstManager.Dtos +{ + public class WebFirstGetOutputDto + { + } +} diff --git a/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Entities/TemplateEntity.cs b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Entities/TemplateEntity.cs new file mode 100644 index 00000000..5f68e67e --- /dev/null +++ b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Entities/TemplateEntity.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +using Yi.Framework.Infrastructure.Data.Auditing; +using Yi.Framework.Infrastructure.Ddd.Entities; + +namespace Yi.Framework.Module.WebFirstManager.Entities +{ + public class TemplateEntity : IEntity, ICreationAuditedObject + { + + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] + public long Id { get; set; } + + /// + /// 模板字符串 + /// + public string TemplateStr { get; set; } = string.Empty; + + + public long? CreatorId { get; set; } + + public DateTime CreationTime { get; set; } + } +} diff --git a/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Entities/TemplateVarEntity.cs b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Entities/TemplateVarEntity.cs new file mode 100644 index 00000000..e6288876 --- /dev/null +++ b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Entities/TemplateVarEntity.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Module.WebFirstManager.Entities +{ + public class TemplateVarEntity + { + /// + /// 变量名称 + /// + public string Name { get; set; }=string.Empty; + + /// + /// 变量值 + /// + public string Value { get; set; } = string.Empty; + } +} diff --git a/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/ITemplateService.cs b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/ITemplateService.cs new file mode 100644 index 00000000..7c5c34a4 --- /dev/null +++ b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/ITemplateService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Module.WebFirstManager +{ + public interface ITemplateService + { + } +} diff --git a/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/ITemplateVarService.cs b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/ITemplateVarService.cs new file mode 100644 index 00000000..3b481571 --- /dev/null +++ b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/ITemplateVarService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Module.WebFirstManager +{ + public interface ITemplateVarService + { + } +} diff --git a/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/IWebFirstService.cs b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/IWebFirstService.cs new file mode 100644 index 00000000..9cec1608 --- /dev/null +++ b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/IWebFirstService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Module.WebFirstManager +{ + public interface IWebFirstService + { + } +} diff --git a/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Impl/TemplateService.cs b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Impl/TemplateService.cs new file mode 100644 index 00000000..c8a5d11b --- /dev/null +++ b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Impl/TemplateService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Module.WebFirstManager.Impl +{ + public class TemplateService: ITemplateService + { + } +} diff --git a/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Impl/TemplateVarService.cs b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Impl/TemplateVarService.cs new file mode 100644 index 00000000..3ca54984 --- /dev/null +++ b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Impl/TemplateVarService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Module.WebFirstManager.Impl +{ + public class TemplateVarService: ITemplateVarService + { + } +} diff --git a/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Impl/WebFirstService.cs b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Impl/WebFirstService.cs new file mode 100644 index 00000000..8aabc68f --- /dev/null +++ b/Yi.Furion.Net6/Yi.Framework.Module/WebFirstManager/Impl/WebFirstService.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Mapster; +using Microsoft.AspNetCore.DataProtection.KeyManagement; +using Yi.Framework.Infrastructure.Ddd.Repositories; +using Yi.Framework.Infrastructure.Ddd.Services; +using Yi.Framework.Module.WebFirstManager.Dtos; +using Yi.Framework.Module.WebFirstManager.Entities; + +namespace Yi.Framework.Module.WebFirstManager.Impl +{ + public class WebFirstService : ApplicationService, IWebFirstService + { + private IRepository _repository; + public WebFirstService(IRepository repository) { _repository = repository; } + + /// + /// 根据模板id生成对应的结果 + /// + /// + /// + public async Task GetAsync(Guid id) + { + var entity = await _repository.GetByIdAsync(id); + + return entity.Adapt(); + } + + } +} diff --git a/Yi.Furion.Net6/Yi.Furion.Application/Rbac/Services/Impl/AccountService.cs b/Yi.Furion.Net6/Yi.Furion.Application/Rbac/Services/Impl/AccountService.cs index 8ec75824..1faa9396 100644 --- a/Yi.Furion.Net6/Yi.Furion.Application/Rbac/Services/Impl/AccountService.cs +++ b/Yi.Furion.Net6/Yi.Furion.Application/Rbac/Services/Impl/AccountService.cs @@ -346,7 +346,7 @@ namespace Yi.Furion.Application.Rbac.Services.Impl [HttpPut] public async Task RestPasswordAsync(long userId, RestPasswordDto input) { - if (!string.IsNullOrEmpty(input.Password)) + if (string.IsNullOrEmpty(input.Password)) { throw new UserFriendlyException("重置密码不能为空!"); } diff --git a/Yi.Furion.Net6/Yi.Furion.Core/Bbs/DataSeeds/ConfigDataSeed.cs b/Yi.Furion.Net6/Yi.Furion.Core/Bbs/DataSeeds/ConfigDataSeed.cs new file mode 100644 index 00000000..64f4fdb1 --- /dev/null +++ b/Yi.Furion.Net6/Yi.Furion.Core/Bbs/DataSeeds/ConfigDataSeed.cs @@ -0,0 +1,57 @@ +using SqlSugar; +using Yi.Framework.Infrastructure.Data.DataSeeds; +using Yi.Framework.Infrastructure.Ddd.Repositories; +using Yi.Framework.Module.DictionaryManager.Entities; +using Yi.Furion.Core.Rbac.Entities; + +namespace Yi.Furion.Core.Bbs.DataSeeds +{ + public class ConfigDataSeed : AbstractDataSeed, ITransient + { + public ConfigDataSeed(IRepository repository) : base(repository) + { + } + + public override List GetSeedData() + { + List entities = new List(); + ConfigEntity config1 = new ConfigEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + ConfigKey= "bbs.site.name", + ConfigName="站点名称", + ConfigValue="意社区" + }; + entities.Add(config1); + + ConfigEntity config2 = new ConfigEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + ConfigKey = "bbs.site.author", + ConfigName = "站点作者", + ConfigValue = "橙子" + }; + entities.Add(config2); + + ConfigEntity config3 = new ConfigEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + ConfigKey = "bbs.site.icp", + ConfigName = "站点Icp备案", + ConfigValue = "赣ICP备20008025号" + }; + entities.Add(config3); + + + ConfigEntity config4 = new ConfigEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + ConfigKey = "bbs.site.bottom", + ConfigName = "站点底部信息", + ConfigValue = "你好世界" + }; + entities.Add(config4); + return entities; + } + } +} diff --git a/Yi.Furion.Net6/Yi.Furion.Web.Core/Startup.cs b/Yi.Furion.Net6/Yi.Furion.Web.Core/Startup.cs index 8cee79d9..405fd0b1 100644 --- a/Yi.Furion.Net6/Yi.Furion.Web.Core/Startup.cs +++ b/Yi.Furion.Net6/Yi.Furion.Web.Core/Startup.cs @@ -24,7 +24,7 @@ public class Startup : AppStartup services.AddCorsAccessor(); services.AddControllers().AddInjectWithUnifyResult().AddJsonOptions(x => { - //x.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); + x.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); x.JsonSerializerOptions.Converters.Add(new LongToStringConverter()); }); @@ -36,7 +36,7 @@ public class Startup : AppStartup services.AddSchedule(options => { // 注册作业,并配置作业触发器 - options.AddJob(Triggers.Period(10000)); + //options.AddJob(Triggers.Period(10000)); options.AddJob(Triggers.Cron("0 0 0,12 ? * ?",CronStringFormat.WithSeconds)); // 表示每天凌晨与12点 }); services.AddFileLogging("log/application-{0:yyyy}-{0:MM}-{0:dd}.log", options =>