Merge branch 'furion' of https://gitee.com/ccnetcore/Yi into furion

This commit is contained in:
橙子
2023-08-13 21:27:55 +08:00
16 changed files with 250 additions and 10 deletions

View File

@@ -78,8 +78,6 @@ Rbac后台管理系统[yi.ccnetcore.com](http://yi.ccnetcore.com) (已上
例如我们大部分功能紧密贴合Sqlsugar虽然缺少其他orm的替换性但在使用程度上降低的使用难度 例如我们大部分功能紧密贴合Sqlsugar虽然缺少其他orm的替换性但在使用程度上降低的使用难度
例如:我们在应用层中使用属性注入,虽然依赖关系会比较模糊,但是使用起来会减少一定代码量
> 一个面向用户的快速开发后端框架 > 一个面向用户的快速开发后端框架
在真正的使用这,你会明白这一点,极致的简单,也是优雅的一种体现。 在真正的使用这,你会明白这一点,极致的简单,也是优雅的一种体现。

View File

@@ -69,8 +69,8 @@ password:[
]}) ]})
const loginForm = reactive({ const loginForm = reactive({
userName: "", userName: "cc",
password: "", password: "123456",
uuid: "", uuid: "",
code: "" code: ""
}) })

View File

@@ -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/**/*" ]
}
]
}
]
}

View File

@@ -13,7 +13,7 @@ using Yi.Framework.Infrastructure.Data.Entities;
namespace Yi.Framework.Infrastructure.Sqlsugar namespace Yi.Framework.Infrastructure.Sqlsugar
{ {
public class SqlSugarDbContext public class SqlSugarDbContext
{ {
/// <summary> /// <summary>
/// SqlSugar 客户端 /// SqlSugar 客户端
@@ -109,7 +109,11 @@ namespace Yi.Framework.Infrastructure.Sqlsugar
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModificationTime))) 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))) if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModifierId)))
{ {
@@ -122,7 +126,11 @@ namespace Yi.Framework.Infrastructure.Sqlsugar
case DataFilterType.InsertByObject: case DataFilterType.InsertByObject:
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreationTime))) 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))) if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreatorId)))
{ {

View File

@@ -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
{
}
}

View File

@@ -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<long>, ICreationAuditedObject
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public long Id { get; set; }
/// <summary>
/// 模板字符串
/// </summary>
public string TemplateStr { get; set; } = string.Empty;
public long? CreatorId { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -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
{
/// <summary>
/// 变量名称
/// </summary>
public string Name { get; set; }=string.Empty;
/// <summary>
/// 变量值
/// </summary>
public string Value { get; set; } = string.Empty;
}
}

View File

@@ -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
{
}
}

View File

@@ -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
{
}
}

View File

@@ -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
{
}
}

View File

@@ -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
{
}
}

View File

@@ -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
{
}
}

View File

@@ -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<TemplateEntity> _repository;
public WebFirstService(IRepository<TemplateEntity> repository) { _repository = repository; }
/// <summary>
/// 根据模板id生成对应的结果
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<WebFirstGetOutputDto> GetAsync(Guid id)
{
var entity = await _repository.GetByIdAsync(id);
return entity.Adapt<WebFirstGetOutputDto>();
}
}
}

View File

@@ -346,7 +346,7 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
[HttpPut] [HttpPut]
public async Task<bool> RestPasswordAsync(long userId, RestPasswordDto input) public async Task<bool> RestPasswordAsync(long userId, RestPasswordDto input)
{ {
if (!string.IsNullOrEmpty(input.Password)) if (string.IsNullOrEmpty(input.Password))
{ {
throw new UserFriendlyException("重置密码不能为空!"); throw new UserFriendlyException("重置密码不能为空!");
} }

View File

@@ -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<ConfigEntity>, ITransient
{
public ConfigDataSeed(IRepository<ConfigEntity> repository) : base(repository)
{
}
public override List<ConfigEntity> GetSeedData()
{
List<ConfigEntity> entities = new List<ConfigEntity>();
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;
}
}
}

View File

@@ -24,7 +24,7 @@ public class Startup : AppStartup
services.AddCorsAccessor(); services.AddCorsAccessor();
services.AddControllers().AddInjectWithUnifyResult().AddJsonOptions(x => { 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()); x.JsonSerializerOptions.Converters.Add(new LongToStringConverter());
}); });
@@ -36,7 +36,7 @@ public class Startup : AppStartup
services.AddSchedule(options => services.AddSchedule(options =>
{ {
// 注册作业,并配置作业触发器 // 注册作业,并配置作业触发器
options.AddJob<TestJob>(Triggers.Period(10000)); //options.AddJob<TestJob>(Triggers.Period(10000));
options.AddJob<SystemDataJob>(Triggers.Cron("0 0 0,12 ? * ?",CronStringFormat.WithSeconds)); // 表示每天凌晨与12点 options.AddJob<SystemDataJob>(Triggers.Cron("0 0 0,12 ? * ?",CronStringFormat.WithSeconds)); // 表示每天凌晨与12点
}); });
services.AddFileLogging("log/application-{0:yyyy}-{0:MM}-{0:dd}.log", options => services.AddFileLogging("log/application-{0:yyyy}-{0:MM}-{0:dd}.log", options =>