This commit is contained in:
28
Api/Dilon.Application/Dilon.Application.csproj
Normal file
28
Api/Dilon.Application/Dilon.Application.csproj
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
<NoWarn>1701;1702;1591</NoWarn>
|
||||||
|
<DocumentationFile>Dilon.Application.xml</DocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="applicationsettings.json" />
|
||||||
|
<None Remove="Dilon.Application.xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="applicationsettings.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Dilon.Core\Dilon.Core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Furion.Extras.DatabaseAccessor.SqlSugar" Version="1.17.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
69
Api/Dilon.Application/Dilon.Application.xml
Normal file
69
Api/Dilon.Application/Dilon.Application.xml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<doc>
|
||||||
|
<assembly>
|
||||||
|
<name>Dilon.Application</name>
|
||||||
|
</assembly>
|
||||||
|
<members>
|
||||||
|
<member name="T:Dilon.Application.CodeGenTest">
|
||||||
|
<summary>
|
||||||
|
代码生成实体测试(EF)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Dilon.Application.CodeGenTest.Name">
|
||||||
|
<summary>
|
||||||
|
名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Dilon.Application.CodeGenTest.NickName">
|
||||||
|
<summary>
|
||||||
|
昵称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Dilon.Application.CodeGenTest.Birthday">
|
||||||
|
<summary>
|
||||||
|
生日
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Dilon.Application.CodeGenTest.Age">
|
||||||
|
<summary>
|
||||||
|
年龄
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Dilon.Application.Test">
|
||||||
|
<summary>
|
||||||
|
SqlSugar实体
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Dilon.Application.Test.Id">
|
||||||
|
<summary>
|
||||||
|
雪花Id
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Dilon.Application.Test.Name">
|
||||||
|
<summary>
|
||||||
|
名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Dilon.Application.Test.Age">
|
||||||
|
<summary>
|
||||||
|
年龄
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Dilon.Application.Test.CreateTime">
|
||||||
|
<summary>
|
||||||
|
创建时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Dilon.Application.TestService">
|
||||||
|
<summary>
|
||||||
|
业务服务及集成SqlSugar用法事例
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Dilon.Application.TestService.GetDescription">
|
||||||
|
<summary>
|
||||||
|
测试方法
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
</members>
|
||||||
|
</doc>
|
||||||
39
Api/Dilon.Application/Entity/CodeGenTest.cs
Normal file
39
Api/Dilon.Application/Entity/CodeGenTest.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using Dilon.Core;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Application
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 代码生成实体测试(EF)
|
||||||
|
/// </summary>
|
||||||
|
[Table("code_gen_test")]
|
||||||
|
[Comment("代码生成业务")]
|
||||||
|
public class CodeGenTest : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 昵称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("昵称")]
|
||||||
|
public string NickName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生日
|
||||||
|
/// </summary>
|
||||||
|
[Comment("生日")]
|
||||||
|
public DateTimeOffset Birthday { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 年龄
|
||||||
|
/// </summary>
|
||||||
|
[Comment("年龄")]
|
||||||
|
public int Age { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
1
Api/Dilon.Application/Entity/README.md
Normal file
1
Api/Dilon.Application/Entity/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/** 您的业务实体文件写在此文件夹下面 **/
|
||||||
35
Api/Dilon.Application/Entity/Test.cs
Normal file
35
Api/Dilon.Application/Entity/Test.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Dilon.Application
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// SqlSugar实体
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("Test", TableDescription = "我的业务表")]
|
||||||
|
public class Test
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 雪花Id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDataType = "Nvarchar(32)")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 年龄
|
||||||
|
/// </summary>
|
||||||
|
public int Age { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public DateTimeOffset CreateTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Api/Dilon.Application/README.md
Normal file
3
Api/Dilon.Application/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
1、原则上服务应该放在Application层次,考虑将咱自己的业务层直接写在Application里面好些,后续升级后,咱大家直接升级就行了,减少冲突!
|
||||||
|
2、系统默认ORM为EF Core,如果觉得不趁手,可以自行更换
|
||||||
|
3、在此应用层默认集成了SqlSugar,其他ORM类同,可以多个ORM并行开发,熟悉哪个用哪个
|
||||||
7
Api/Dilon.Application/Service/ITestService.cs
Normal file
7
Api/Dilon.Application/Service/ITestService.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Dilon.Application
|
||||||
|
{
|
||||||
|
public interface ITestService
|
||||||
|
{
|
||||||
|
string GetDescription();
|
||||||
|
}
|
||||||
|
}
|
||||||
76
Api/Dilon.Application/Service/TestService.cs
Normal file
76
Api/Dilon.Application/Service/TestService.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using Dilon.Core;
|
||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.DynamicApiController;
|
||||||
|
using Furion.Snowflake;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Application
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 业务服务及集成SqlSugar用法事例
|
||||||
|
/// </summary>
|
||||||
|
public class TestService : ITestService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
//private readonly ISqlSugarRepository<Test> _testRep;
|
||||||
|
//private readonly SqlSugarClient _db; // SqlSugar对象
|
||||||
|
|
||||||
|
public TestService(/*ISqlSugarRepository<Test> sqlSugarRep*/)
|
||||||
|
{
|
||||||
|
//_testRep = sqlSugarRep;
|
||||||
|
//_db = (SqlSugarClient)_testRep.Context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试方法
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("/test")]
|
||||||
|
public string GetDescription()
|
||||||
|
{
|
||||||
|
return "Admin.NET";
|
||||||
|
}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 增加数据
|
||||||
|
///// </summary>
|
||||||
|
///// <returns></returns>
|
||||||
|
//[HttpPost("/test/add")]
|
||||||
|
//public async Task AddTestAsync()
|
||||||
|
//{
|
||||||
|
// var test = new Test()
|
||||||
|
// {
|
||||||
|
// Id = IDGenerator.NextId(),
|
||||||
|
// Name = "Admin.NET",
|
||||||
|
// Age = 1,
|
||||||
|
// CreateTime = DateTimeOffset.Now
|
||||||
|
// };
|
||||||
|
// await _testRep.InsertAsync(test);
|
||||||
|
// // _db.Insertable(test).ExecuteCommand();
|
||||||
|
//}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 查询所有
|
||||||
|
///// </summary>
|
||||||
|
///// <returns></returns>
|
||||||
|
//[HttpPost("/test/page")]
|
||||||
|
//public async Task<List<Test>> GetTestListAsync()
|
||||||
|
//{
|
||||||
|
// return await _testRep.Entities.ToListAsync();
|
||||||
|
//}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 查询系统用户
|
||||||
|
///// </summary>
|
||||||
|
///// <returns></returns>
|
||||||
|
//[HttpPost("/test/userPage")]
|
||||||
|
//public async Task<dynamic> GetUserListAsync()
|
||||||
|
//{
|
||||||
|
// return await _db.Queryable<SysUser>().ToListAsync();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
Api/Dilon.Application/Startup.cs
Normal file
31
Api/Dilon.Application/Startup.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Furion;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using SqlSugar;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Dilon.Application
|
||||||
|
{
|
||||||
|
public class Startup : AppStartup
|
||||||
|
{
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
//services.AddSqlSugar(new ConnectionConfig
|
||||||
|
//{
|
||||||
|
// ConnectionString = App.Configuration["ConnectionStrings:DefaultConnection"],
|
||||||
|
// DbType = DbType.Sqlite,
|
||||||
|
// IsAutoCloseConnection = true,
|
||||||
|
// InitKeyType = InitKeyType.Attribute
|
||||||
|
//},
|
||||||
|
//db =>
|
||||||
|
//{
|
||||||
|
// // db.DbMaintenance.CreateDatabase();
|
||||||
|
// // db.CodeFirst.SetStringDefaultLength(200).InitTables(typeof(Test));
|
||||||
|
|
||||||
|
// db.Aop.OnLogExecuting = (sql, pars) =>
|
||||||
|
// {
|
||||||
|
// App.PrintToMiniProfiler("SqlSugar", "Info", sql + "\r\n" + string.Join(",", pars?.Select(it => it.ParameterName + ":" + it.Value)));
|
||||||
|
// };
|
||||||
|
//});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Api/Dilon.Application/applicationsettings.json
Normal file
3
Api/Dilon.Application/applicationsettings.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
33
Api/Dilon.Core/Cache/CacheOptions.cs
Normal file
33
Api/Dilon.Core/Cache/CacheOptions.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using Furion.ConfigurableOptions;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 缓存配置
|
||||||
|
/// </summary>
|
||||||
|
public class CacheOptions : IConfigurableOptions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 缓存类型
|
||||||
|
/// </summary>
|
||||||
|
public CacheType CacheType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Redis配置
|
||||||
|
/// </summary>
|
||||||
|
public string RedisConnectionString { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CacheType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 内存缓存
|
||||||
|
/// </summary>
|
||||||
|
MemoryCache,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Redis缓存
|
||||||
|
/// </summary>
|
||||||
|
RedisCache
|
||||||
|
}
|
||||||
|
}
|
||||||
107
Api/Dilon.Core/Cache/ICache.cs
Normal file
107
Api/Dilon.Core/Cache/ICache.cs
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 缓存接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ICache
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用于在 key 存在时删除 key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
long Del(params string[] key);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用于在 key 存在时删除 key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<long> DelAsync(params string[] key);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用于在 key 模板存在时删除
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pattern">key模板</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<long> DelByPatternAsync(string pattern);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查给定 key 是否存在
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool Exists(string key);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查给定 key 是否存在
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> ExistsAsync(string key);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定 key 的值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
string Get(string key);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定 key 的值
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">byte[] 或其他类型</typeparam>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
T Get<T>(string key);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定 key 的值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<string> GetAsync(string key);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定 key 的值
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">byte[] 或其他类型</typeparam>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<T> GetAsync<T>(string key);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <param name="value">值</param>
|
||||||
|
bool Set(string key, object value);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <param name="value">值</param>
|
||||||
|
/// <param name="expire">有效期</param>
|
||||||
|
bool Set(string key, object value, TimeSpan expire);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <param name="value">值</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> SetAsync(string key, object value);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">键</param>
|
||||||
|
/// <param name="value">值</param>
|
||||||
|
/// <param name="expire">有效期</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> SetAsync(string key, object value, TimeSpan expire);
|
||||||
|
}
|
||||||
|
}
|
||||||
125
Api/Dilon.Core/Cache/MemoryCache.cs
Normal file
125
Api/Dilon.Core/Cache/MemoryCache.cs
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 内存缓存
|
||||||
|
/// </summary>
|
||||||
|
public class MemoryCache : ICache, ISingleton
|
||||||
|
{
|
||||||
|
private readonly IMemoryCache _memoryCache;
|
||||||
|
|
||||||
|
public MemoryCache(IMemoryCache memoryCache)
|
||||||
|
{
|
||||||
|
_memoryCache = memoryCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long Del(params string[] key)
|
||||||
|
{
|
||||||
|
foreach (var k in key)
|
||||||
|
{
|
||||||
|
_memoryCache.Remove(k);
|
||||||
|
}
|
||||||
|
return key.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<long> DelAsync(params string[] key)
|
||||||
|
{
|
||||||
|
foreach (var k in key)
|
||||||
|
{
|
||||||
|
_memoryCache.Remove(k);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.FromResult((long)key.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<long> DelByPatternAsync(string pattern)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(pattern))
|
||||||
|
return default;
|
||||||
|
|
||||||
|
//pattern = Regex.Replace(pattern, @"\{*.\}", "(.*)");
|
||||||
|
var keys = GetAllKeys().Where(k => k.StartsWith(pattern));
|
||||||
|
if (keys != null && keys.Any())
|
||||||
|
return await DelAsync(keys.ToArray());
|
||||||
|
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Exists(string key)
|
||||||
|
{
|
||||||
|
return _memoryCache.TryGetValue(key, out _);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> ExistsAsync(string key)
|
||||||
|
{
|
||||||
|
return Task.FromResult(_memoryCache.TryGetValue(key, out _));
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Get(string key)
|
||||||
|
{
|
||||||
|
return _memoryCache.Get(key)?.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public T Get<T>(string key)
|
||||||
|
{
|
||||||
|
return _memoryCache.Get<T>(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<string> GetAsync(string key)
|
||||||
|
{
|
||||||
|
return Task.FromResult(Get(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<T> GetAsync<T>(string key)
|
||||||
|
{
|
||||||
|
return Task.FromResult(Get<T>(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Set(string key, object value)
|
||||||
|
{
|
||||||
|
_memoryCache.Set(key, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Set(string key, object value, TimeSpan expire)
|
||||||
|
{
|
||||||
|
_memoryCache.Set(key, value, expire);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> SetAsync(string key, object value)
|
||||||
|
{
|
||||||
|
Set(key, value);
|
||||||
|
return Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> SetAsync(string key, object value, TimeSpan expire)
|
||||||
|
{
|
||||||
|
Set(key, value, expire);
|
||||||
|
return Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> GetAllKeys()
|
||||||
|
{
|
||||||
|
const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
|
||||||
|
var entries = _memoryCache.GetType().GetField("_entries", flags).GetValue(_memoryCache);
|
||||||
|
var cacheItems = entries.GetType().GetProperty("Keys").GetValue(entries) as ICollection<object>; //entries as IDictionary;
|
||||||
|
var keys = new List<string>();
|
||||||
|
if (cacheItems == null) return keys;
|
||||||
|
return cacheItems.Select(u => u.ToString()).ToList();
|
||||||
|
//foreach (DictionaryEntry cacheItem in cacheItems)
|
||||||
|
//{
|
||||||
|
// keys.Add(cacheItem.Key.ToString());
|
||||||
|
//}
|
||||||
|
//return keys;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
95
Api/Dilon.Core/Cache/RedisCache.cs
Normal file
95
Api/Dilon.Core/Cache/RedisCache.cs
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Redis缓存
|
||||||
|
/// </summary>
|
||||||
|
public class RedisCache : ICache, ISingleton
|
||||||
|
{
|
||||||
|
public RedisCache(IOptions<CacheOptions> cacheOptions)
|
||||||
|
{
|
||||||
|
var csredis = new CSRedis.CSRedisClient(cacheOptions.Value.RedisConnectionString);
|
||||||
|
RedisHelper.Initialization(csredis);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long Del(params string[] key)
|
||||||
|
{
|
||||||
|
return RedisHelper.Del(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<long> DelAsync(params string[] key)
|
||||||
|
{
|
||||||
|
return RedisHelper.DelAsync(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<long> DelByPatternAsync(string pattern)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(pattern))
|
||||||
|
return default;
|
||||||
|
|
||||||
|
//pattern = Regex.Replace(pattern, @"\{.*\}", "*");
|
||||||
|
var keys = (await RedisHelper.KeysAsync(pattern));
|
||||||
|
if (keys != null && keys.Length > 0)
|
||||||
|
{
|
||||||
|
return await RedisHelper.DelAsync(keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Exists(string key)
|
||||||
|
{
|
||||||
|
return RedisHelper.Exists(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> ExistsAsync(string key)
|
||||||
|
{
|
||||||
|
return RedisHelper.ExistsAsync(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Get(string key)
|
||||||
|
{
|
||||||
|
return RedisHelper.Get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public T Get<T>(string key)
|
||||||
|
{
|
||||||
|
return RedisHelper.Get<T>(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<string> GetAsync(string key)
|
||||||
|
{
|
||||||
|
return RedisHelper.GetAsync(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<T> GetAsync<T>(string key)
|
||||||
|
{
|
||||||
|
return RedisHelper.GetAsync<T>(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Set(string key, object value)
|
||||||
|
{
|
||||||
|
return RedisHelper.Set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Set(string key, object value, TimeSpan expire)
|
||||||
|
{
|
||||||
|
return RedisHelper.Set(key, value, expire);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> SetAsync(string key, object value)
|
||||||
|
{
|
||||||
|
return RedisHelper.SetAsync(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> SetAsync(string key, object value, TimeSpan expire)
|
||||||
|
{
|
||||||
|
return RedisHelper.SetAsync(key, value, expire);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
227
Api/Dilon.Core/Captcha/ClickWord/ClickWordCaptcha.cs
Normal file
227
Api/Dilon.Core/Captcha/ClickWord/ClickWordCaptcha.cs
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
using Furion;
|
||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.JsonSerialization;
|
||||||
|
using Furion.Snowflake;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 点选验证码
|
||||||
|
/// </summary>
|
||||||
|
public class ClickWordCaptcha : IClickWordCaptcha, ITransient
|
||||||
|
{
|
||||||
|
private readonly IMemoryCache _memoryCache;
|
||||||
|
|
||||||
|
public ClickWordCaptcha(IMemoryCache memoryCache)
|
||||||
|
{
|
||||||
|
_memoryCache = memoryCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成验证码图片
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="code"></param>
|
||||||
|
/// <param name="width"></param>
|
||||||
|
/// <param name="height"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ClickWordCaptchaResult CreateCaptchaImage(string code, int width, int height)
|
||||||
|
{
|
||||||
|
var rtnResult = new ClickWordCaptchaResult();
|
||||||
|
|
||||||
|
// 变化点: 3个字
|
||||||
|
int rightCodeLength = 3;
|
||||||
|
|
||||||
|
Bitmap bitmap = null;
|
||||||
|
Graphics g = null;
|
||||||
|
MemoryStream ms = null;
|
||||||
|
Random random = new Random();
|
||||||
|
|
||||||
|
Color[] colorArray = { Color.Black, Color.DarkBlue, Color.Green, Color.Orange, Color.Brown, Color.DarkCyan, Color.Purple };
|
||||||
|
|
||||||
|
string bgImagesDir = Path.Combine(App.WebHostEnvironment.WebRootPath, "Captcha/Image");
|
||||||
|
string[] bgImagesFiles = Directory.GetFiles(bgImagesDir);
|
||||||
|
//if (bgImagesFiles == null || bgImagesFiles.Length == 0)
|
||||||
|
// throw Oops.Oh("背景图片文件丢失");
|
||||||
|
|
||||||
|
// 字体来自:https://www.zcool.com.cn/special/zcoolfonts/
|
||||||
|
string fontsDir = Path.Combine(App.WebHostEnvironment.WebRootPath, "Captcha/Font");
|
||||||
|
string[] fontFiles = new DirectoryInfo(fontsDir)?.GetFiles()
|
||||||
|
?.Where(m => m.Extension.ToLower() == ".ttf")
|
||||||
|
?.Select(m => m.FullName).ToArray();
|
||||||
|
//if (fontFiles == null || fontFiles.Length == 0)
|
||||||
|
// throw Oops.Oh("字体文件丢失");
|
||||||
|
|
||||||
|
int imgIndex = random.Next(bgImagesFiles.Length);
|
||||||
|
string randomImgFile = bgImagesFiles[imgIndex];
|
||||||
|
var imageStream = Image.FromFile(randomImgFile);
|
||||||
|
|
||||||
|
bitmap = new Bitmap(imageStream, width, height);
|
||||||
|
imageStream.Dispose();
|
||||||
|
g = Graphics.FromImage(bitmap);
|
||||||
|
Color[] penColor = { Color.Red, Color.Green, Color.Blue };
|
||||||
|
int code_length = code.Length;
|
||||||
|
List<string> words = new List<string>();
|
||||||
|
for (int i = 0; i < code_length; i++)
|
||||||
|
{
|
||||||
|
int colorIndex = random.Next(colorArray.Length);
|
||||||
|
int fontIndex = random.Next(fontFiles.Length);
|
||||||
|
Font f = LoadFont(fontFiles[fontIndex], 15, FontStyle.Regular);
|
||||||
|
Brush b = new SolidBrush(colorArray[colorIndex]);
|
||||||
|
int _y = random.Next(height);
|
||||||
|
if (_y > (height - 30))
|
||||||
|
_y = _y - 60;
|
||||||
|
|
||||||
|
int _x = width / (i + 1);
|
||||||
|
if ((width - _x) < 50)
|
||||||
|
{
|
||||||
|
_x = width - 60;
|
||||||
|
}
|
||||||
|
string word = code.Substring(i, 1);
|
||||||
|
if (rtnResult.repData.point.Count < rightCodeLength)
|
||||||
|
{
|
||||||
|
// (int, int) percentPos = ToPercentPos((width, height), (_x, _y));
|
||||||
|
// 添加正确答案 位置数据
|
||||||
|
rtnResult.repData.point.Add(new PointPosModel()
|
||||||
|
{
|
||||||
|
X = _x, //percentPos.Item1,
|
||||||
|
Y = _y //percentPos.Item2,
|
||||||
|
});
|
||||||
|
words.Add(word);
|
||||||
|
}
|
||||||
|
g.DrawString(word, f, b, _x, _y);
|
||||||
|
}
|
||||||
|
rtnResult.repData.wordList = words;
|
||||||
|
|
||||||
|
ms = new MemoryStream();
|
||||||
|
bitmap.Save(ms, ImageFormat.Jpeg);
|
||||||
|
g.Dispose();
|
||||||
|
bitmap.Dispose();
|
||||||
|
ms.Dispose();
|
||||||
|
rtnResult.repData.originalImageBase64 = Convert.ToBase64String(ms.GetBuffer()); //"data:image/jpg;base64," +
|
||||||
|
rtnResult.repData.token = IDGenerator.NextId().ToString();
|
||||||
|
|
||||||
|
// 缓存验证码正确位置集合
|
||||||
|
var cacheOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(30));
|
||||||
|
_memoryCache.Set(CommonConst.CACHE_KEY_CODE + rtnResult.repData.token, rtnResult.repData.point, cacheOptions);
|
||||||
|
|
||||||
|
rtnResult.repData.point = null; // 清空位置信息
|
||||||
|
return rtnResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转换为相对于图片的百分比单位
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="widthAndHeight">图片宽高</param>
|
||||||
|
/// <param name="xAndy">相对于图片的绝对尺寸</param>
|
||||||
|
/// <returns>(int:xPercent, int:yPercent)</returns>
|
||||||
|
private (int, int) ToPercentPos((int, int) widthAndHeight, (int, int) xAndy)
|
||||||
|
{
|
||||||
|
(int, int) rtnResult = (0, 0);
|
||||||
|
// 注意: int / int = int (小数部分会被截断)
|
||||||
|
rtnResult.Item1 = (int)(((double)xAndy.Item1) / ((double)widthAndHeight.Item1) * 100);
|
||||||
|
rtnResult.Item2 = (int)(((double)xAndy.Item2) / ((double)widthAndHeight.Item2) * 100);
|
||||||
|
|
||||||
|
return rtnResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载字体
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">字体文件路径,包含字体文件名和后缀名</param>
|
||||||
|
/// <param name="size">大小</param>
|
||||||
|
/// <param name="fontStyle">字形(常规/粗体/斜体/粗斜体)</param>
|
||||||
|
private Font LoadFont(string path, int size, FontStyle fontStyle)
|
||||||
|
{
|
||||||
|
var pfc = new System.Drawing.Text.PrivateFontCollection();
|
||||||
|
pfc.AddFontFile(path);// 字体文件路径
|
||||||
|
Font myFont = new Font(pfc.Families[0], size, fontStyle);
|
||||||
|
return myFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 随机绘制字符串
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="number"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string RandomCode(int number)
|
||||||
|
{
|
||||||
|
var str = "左怀军天地玄黄宇宙洪荒日月盈昃辰宿列张寒来暑往秋收冬藏闰余成岁律吕调阳云腾致雨露结为霜金生丽水玉出昆冈剑号巨阙珠称夜光果珍李柰菜重芥姜海咸河淡鳞潜羽翔龙师火帝鸟官人皇始制文字乃服衣裳推位让国有虞陶唐吊民伐罪周发殷汤坐朝问道垂拱平章爱育黎首臣伏戎羌遐迩体率宾归王";
|
||||||
|
char[] str_char_arrary = str.ToArray();
|
||||||
|
Random rand = new Random();
|
||||||
|
HashSet<string> hs = new HashSet<string>();
|
||||||
|
bool randomBool = true;
|
||||||
|
while (randomBool)
|
||||||
|
{
|
||||||
|
if (hs.Count == number)
|
||||||
|
break;
|
||||||
|
int rand_number = rand.Next(str_char_arrary.Length);
|
||||||
|
hs.Add(str_char_arrary[rand_number].ToString());
|
||||||
|
}
|
||||||
|
return string.Join("", hs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证码验证
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public dynamic CheckCode(ClickWordCaptchaInput input)
|
||||||
|
{
|
||||||
|
var res = new ClickWordCaptchaResult();
|
||||||
|
|
||||||
|
var rightVCodePos = _memoryCache.Get(CommonConst.CACHE_KEY_CODE + input.Token) as List<PointPosModel>;
|
||||||
|
if (rightVCodePos == null)
|
||||||
|
{
|
||||||
|
res.repCode = "6110";
|
||||||
|
res.repMsg = "验证码已失效,请重新获取";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
var userVCodePos = JSON.GetJsonSerializer().Deserialize<List<PointPosModel>>(input.PointJson);
|
||||||
|
if (userVCodePos == null || userVCodePos.Count < rightVCodePos.Count)
|
||||||
|
{
|
||||||
|
res.repCode = "6111";
|
||||||
|
res.repMsg = "验证码无效";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
int allowOffset = 20; // 允许的偏移量(点触容错)
|
||||||
|
for (int i = 0; i < userVCodePos.Count; i++)
|
||||||
|
{
|
||||||
|
var xOffset = userVCodePos[i].X - rightVCodePos[i].X;
|
||||||
|
var yOffset = userVCodePos[i].Y - rightVCodePos[i].Y;
|
||||||
|
xOffset = Math.Abs(xOffset); // x轴偏移量
|
||||||
|
yOffset = Math.Abs(yOffset); // y轴偏移量
|
||||||
|
// 只要有一个点的任意一个轴偏移量大于allowOffset,则验证不通过
|
||||||
|
if (xOffset > allowOffset || yOffset > allowOffset)
|
||||||
|
{
|
||||||
|
res.repCode = "6112";
|
||||||
|
res.repMsg = "验证码错误";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_memoryCache.Remove(CommonConst.CACHE_KEY_CODE + input.Token);
|
||||||
|
res.repCode = "0000";
|
||||||
|
res.repMsg = "验证成功";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录正确位置
|
||||||
|
/// </summary>
|
||||||
|
public class PointPosModel
|
||||||
|
{
|
||||||
|
public int X { get; set; }
|
||||||
|
|
||||||
|
public int Y { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Api/Dilon.Core/Captcha/ClickWord/ClickWordCaptchaInput.cs
Normal file
29
Api/Dilon.Core/Captcha/ClickWord/ClickWordCaptchaInput.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Furion.DependencyInjection;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 点击验证码输入参数
|
||||||
|
/// </summary>
|
||||||
|
[SkipScan]
|
||||||
|
public class ClickWordCaptchaInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 验证码类型
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "验证码类型")]
|
||||||
|
public string CaptchaType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 坐标点集合
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "坐标点集合不能为空")]
|
||||||
|
public string PointJson { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Token
|
||||||
|
/// </summary>
|
||||||
|
public string Token { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
44
Api/Dilon.Core/Captcha/ClickWord/ClickWordCaptchaResult.cs
Normal file
44
Api/Dilon.Core/Captcha/ClickWord/ClickWordCaptchaResult.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using Furion.DependencyInjection;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 验证码输出参数
|
||||||
|
/// </summary>
|
||||||
|
[SkipScan]
|
||||||
|
public class ClickWordCaptchaResult
|
||||||
|
{
|
||||||
|
public string repCode { get; set; } = "0000";
|
||||||
|
public string repMsg { get; set; }
|
||||||
|
public RepData repData { get; set; } = new RepData();
|
||||||
|
public bool error { get; set; }
|
||||||
|
public bool success { get; set; } = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
[SkipScan]
|
||||||
|
public class RepData
|
||||||
|
{
|
||||||
|
public string captchaId { get; set; }
|
||||||
|
public string projectCode { get; set; }
|
||||||
|
public string captchaType { get; set; }
|
||||||
|
public string captchaOriginalPath { get; set; }
|
||||||
|
public string captchaFontType { get; set; }
|
||||||
|
public string captchaFontSize { get; set; }
|
||||||
|
public string secretKey { get; set; }
|
||||||
|
public string originalImageBase64 { get; set; }
|
||||||
|
public List<PointPosModel> point { get; set; } = new List<PointPosModel>();
|
||||||
|
public string jigsawImageBase64 { get; set; }
|
||||||
|
public List<string> wordList { get; set; } = new List<string>();
|
||||||
|
public string pointList { get; set; }
|
||||||
|
public string pointJson { get; set; }
|
||||||
|
public string token { get; set; }
|
||||||
|
public bool result { get; set; }
|
||||||
|
public string captchaVerification { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[SkipScan]
|
||||||
|
public class WordList
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
9
Api/Dilon.Core/Captcha/ClickWord/IClickWordCaptcha.cs
Normal file
9
Api/Dilon.Core/Captcha/ClickWord/IClickWordCaptcha.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
public interface IClickWordCaptcha
|
||||||
|
{
|
||||||
|
dynamic CheckCode(ClickWordCaptchaInput input);
|
||||||
|
ClickWordCaptchaResult CreateCaptchaImage(string code, int width, int height);
|
||||||
|
string RandomCode(int number);
|
||||||
|
}
|
||||||
|
}
|
||||||
130
Api/Dilon.Core/Captcha/General/GeneralCaptcha.cs
Normal file
130
Api/Dilon.Core/Captcha/General/GeneralCaptcha.cs
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 常规验证码
|
||||||
|
/// </summary>
|
||||||
|
public class GeneralCaptcha : IGeneralCaptcha, ITransient
|
||||||
|
{
|
||||||
|
private readonly IMemoryCache _memoryCache;
|
||||||
|
|
||||||
|
public GeneralCaptcha(IMemoryCache memoryCache)
|
||||||
|
{
|
||||||
|
_memoryCache = memoryCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成验证码图片
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="length"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string CreateCaptchaImage(int length = 4)
|
||||||
|
{
|
||||||
|
return Convert.ToBase64String(Draw(length));
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GenerateRandom(int length)
|
||||||
|
{
|
||||||
|
var chars = new StringBuilder();
|
||||||
|
// 验证码的字符集,去掉了一些容易混淆的字符
|
||||||
|
char[] character = { '2', '3', '4', '5', '6', '8', '9', 'a', 'b', 'd', 'e', 'f', 'h', 'k', 'm', 'n', 'r', 'x', 'y', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'W', 'X', 'Y' };
|
||||||
|
Random rnd = new Random();
|
||||||
|
// 生成验证码字符串
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
chars.Append(character[rnd.Next(character.Length)]);
|
||||||
|
}
|
||||||
|
return chars.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] Draw(int length = 4)
|
||||||
|
{
|
||||||
|
int codeW = 110;
|
||||||
|
int codeH = 36;
|
||||||
|
int fontSize = 22;
|
||||||
|
|
||||||
|
// 颜色列表,用于验证码、噪线、噪点
|
||||||
|
Color[] color = { Color.Black, Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Brown, Color.Brown, Color.DarkBlue };
|
||||||
|
// 字体列表,用于验证码
|
||||||
|
string[] fonts = new[] { "Times New Roman", "Verdana", "Arial", "Gungsuh", "Impact" };
|
||||||
|
|
||||||
|
var code = GenerateRandom(length); // 随机字符串集合
|
||||||
|
|
||||||
|
using (Bitmap bmp = new Bitmap(codeW, codeH))
|
||||||
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
g.Clear(Color.White);
|
||||||
|
Random rnd = new Random();
|
||||||
|
// 画噪线
|
||||||
|
for (int i = 0; i < 1; i++)
|
||||||
|
{
|
||||||
|
int x1 = rnd.Next(codeW);
|
||||||
|
int y1 = rnd.Next(codeH);
|
||||||
|
int x2 = rnd.Next(codeW);
|
||||||
|
int y2 = rnd.Next(codeH);
|
||||||
|
var clr = color[rnd.Next(color.Length)];
|
||||||
|
g.DrawLine(new Pen(clr), x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 画验证码字符串
|
||||||
|
string fnt;
|
||||||
|
Font ft;
|
||||||
|
for (int i = 0; i < code.Length; i++)
|
||||||
|
{
|
||||||
|
fnt = fonts[rnd.Next(fonts.Length)];
|
||||||
|
ft = new Font(fnt, fontSize);
|
||||||
|
var clr = color[rnd.Next(color.Length)];
|
||||||
|
g.DrawString(code[i].ToString(), ft, new SolidBrush(clr), (float)i * 24 + 2, (float)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 缓存验证码正确集合
|
||||||
|
var cacheOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(30));
|
||||||
|
_memoryCache.Set(CommonConst.CACHE_KEY_CODE + Guid.NewGuid().ToString("N"), code, cacheOptions);
|
||||||
|
|
||||||
|
// 将验证码图片写入内存流
|
||||||
|
bmp.Save(ms, ImageFormat.Png);
|
||||||
|
return ms.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证码验证
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public dynamic CheckCode(GeneralCaptchaInput input)
|
||||||
|
{
|
||||||
|
var res = new ClickWordCaptchaResult();
|
||||||
|
|
||||||
|
var code = _memoryCache.Get(CommonConst.CACHE_KEY_CODE + input.Token);
|
||||||
|
if (code == null)
|
||||||
|
{
|
||||||
|
res.repCode = "6110";
|
||||||
|
res.repMsg = "验证码已失效,请重新获取";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
if (input.CaptchaCode != (string)code)
|
||||||
|
{
|
||||||
|
res.repCode = "6112";
|
||||||
|
res.repMsg = "验证码错误";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
_memoryCache.Remove(CommonConst.CACHE_KEY_CODE + input.Token);
|
||||||
|
res.repCode = "0000";
|
||||||
|
res.repMsg = "验证成功";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
29
Api/Dilon.Core/Captcha/General/GeneralCaptchaInput.cs
Normal file
29
Api/Dilon.Core/Captcha/General/GeneralCaptchaInput.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Furion.DependencyInjection;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 常规验证码输入
|
||||||
|
/// </summary>
|
||||||
|
[SkipScan]
|
||||||
|
public class GeneralCaptchaInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 验证码类型
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "验证码类型")]
|
||||||
|
public string CaptchaType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证码字符
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "验证码字符不能为空")]
|
||||||
|
public string CaptchaCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Token
|
||||||
|
/// </summary>
|
||||||
|
public string Token { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Api/Dilon.Core/Captcha/General/IGeneralCaptcha.cs
Normal file
8
Api/Dilon.Core/Captcha/General/IGeneralCaptcha.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
public interface IGeneralCaptcha
|
||||||
|
{
|
||||||
|
dynamic CheckCode(GeneralCaptchaInput input);
|
||||||
|
string CreateCaptchaImage(int length = 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
Api/Dilon.Core/Const/ClaimConst.cs
Normal file
26
Api/Dilon.Core/Const/ClaimConst.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
public class ClaimConst
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户Id
|
||||||
|
/// </summary>
|
||||||
|
public const string CLAINM_USERID = "UserId";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 账号
|
||||||
|
/// </summary>
|
||||||
|
public const string CLAINM_ACCOUNT = "Account";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public const string CLAINM_NAME = "Name";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否超级管理
|
||||||
|
/// </summary>
|
||||||
|
public const string CLAINM_SUPERADMIN = "SuperAdmin";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
35
Api/Dilon.Core/Const/CommonConst.cs
Normal file
35
Api/Dilon.Core/Const/CommonConst.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
public class CommonConst
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 默认密码
|
||||||
|
/// </summary>
|
||||||
|
public const string DEFAULT_PASSWORD = "123456";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户缓存
|
||||||
|
/// </summary>
|
||||||
|
public const string CACHE_KEY_USER = "user_";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单缓存
|
||||||
|
/// </summary>
|
||||||
|
public const string CACHE_KEY_MENU = "menu_";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 权限缓存
|
||||||
|
/// </summary>
|
||||||
|
public const string CACHE_KEY_PERMISSION = "permission_";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据范围缓存
|
||||||
|
/// </summary>
|
||||||
|
public const string CACHE_KEY_DATASCOPE = "datascope_";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证码缓存
|
||||||
|
/// </summary>
|
||||||
|
public const string CACHE_KEY_CODE = "vercode_";
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Api/Dilon.Core/Dilon.Core.csproj
Normal file
49
Api/Dilon.Core/Dilon.Core.csproj
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
<NoWarn>1701;1702;1591</NoWarn>
|
||||||
|
<DocumentationFile>Dilon.Core.xml</DocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="OAuth\Wechat1\**" />
|
||||||
|
<EmbeddedResource Remove="OAuth\Wechat1\**" />
|
||||||
|
<None Remove="OAuth\Wechat1\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="OAuth\AuthorizeResult.cs" />
|
||||||
|
<Compile Remove="OAuth\IUserInfoModel.cs" />
|
||||||
|
<Compile Remove="OAuth\OAuthLoginBase.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="Dilon.Core.xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CSRedisCore" Version="3.6.6" />
|
||||||
|
<PackageReference Include="Furion" Version="1.19.2" />
|
||||||
|
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="1.19.2" />
|
||||||
|
<PackageReference Include="Furion.Extras.Logging.Serilog" Version="1.19.2" />
|
||||||
|
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="1.19.2" />
|
||||||
|
<PackageReference Include="Quartz" Version="3.3.2" />
|
||||||
|
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
|
||||||
|
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
|
||||||
|
<PackageReference Include="UAParser" Version="3.1.46" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Service\CodeGen\Dto\TableOutput.cs">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="applicationconfig.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
6997
Api/Dilon.Core/Dilon.Core.xml
Normal file
6997
Api/Dilon.Core/Dilon.Core.xml
Normal file
File diff suppressed because it is too large
Load Diff
68
Api/Dilon.Core/Entity/DEntityBase.cs
Normal file
68
Api/Dilon.Core/Entity/DEntityBase.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 自定义实体基类
|
||||||
|
/// </summary>
|
||||||
|
public abstract class DEntityBase : IEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主键Id
|
||||||
|
/// </summary>
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||||
|
[Comment("Id主键")]
|
||||||
|
public virtual long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("创建时间")]
|
||||||
|
public virtual DateTimeOffset? CreatedTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("更新时间")]
|
||||||
|
public virtual DateTimeOffset? UpdatedTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建者Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("创建者Id")]
|
||||||
|
public virtual long? CreatedUserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建者名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("创建者名称")]
|
||||||
|
[MaxLength(20)]
|
||||||
|
public virtual string CreatedUserName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("修改者Id")]
|
||||||
|
public virtual long? UpdatedUserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("修改者名称")]
|
||||||
|
[MaxLength(20)]
|
||||||
|
public virtual string UpdatedUserName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 软删除
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore, FakeDelete(true)]
|
||||||
|
[Comment("软删除标记")]
|
||||||
|
public virtual bool IsDeleted { get; set; } = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
56
Api/Dilon.Core/Entity/SysApp.cs
Normal file
56
Api/Dilon.Core/Entity/SysApp.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统应用表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_app")]
|
||||||
|
[Comment("系统应用表")]
|
||||||
|
public class SysApp : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
[Comment("编码")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图标
|
||||||
|
/// </summary>
|
||||||
|
[Comment("图标")]
|
||||||
|
public string Icon { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图标颜色
|
||||||
|
/// </summary>
|
||||||
|
[Comment("图标颜色")]
|
||||||
|
public string Color { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否默认激活(Y-是,N-否),只能有一个系统默认激活
|
||||||
|
/// 用户登录后默认展示此系统菜单
|
||||||
|
/// </summary>
|
||||||
|
[Comment("是否默认激活")]
|
||||||
|
public string Active { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0正常 1停用 2删除)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态")]
|
||||||
|
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
[Comment("排序")]
|
||||||
|
public int Sort { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Api/Dilon.Core/Entity/SysCodeGen.cs
Normal file
49
Api/Dilon.Core/Entity/SysCodeGen.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 代码生成表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_code_gen")]
|
||||||
|
[Comment("代码生成表")]
|
||||||
|
public class SysCodeGen : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 作者姓名
|
||||||
|
/// </summary>
|
||||||
|
[Comment("作者姓名")]
|
||||||
|
public string AuthorName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否移除表前缀
|
||||||
|
/// </summary>
|
||||||
|
[Comment("是否移除表前缀")]
|
||||||
|
public string TablePrefix { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成方式
|
||||||
|
/// </summary>
|
||||||
|
[Comment("生成方式")]
|
||||||
|
public string GenerateType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库表名
|
||||||
|
/// </summary>
|
||||||
|
[Comment("数据库表名")]
|
||||||
|
public string TableName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 命名空间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("命名空间")]
|
||||||
|
public string NameSpace { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 业务名
|
||||||
|
/// </summary>
|
||||||
|
[Comment("业务名")]
|
||||||
|
public string BusName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
103
Api/Dilon.Core/Entity/SysCodeGenConfig.cs
Normal file
103
Api/Dilon.Core/Entity/SysCodeGenConfig.cs
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 代码生成字段配置表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_code_gen_config")]
|
||||||
|
[Comment("代码生成字段配置表")]
|
||||||
|
public class SysCodeGenConfig : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 代码生成主表ID
|
||||||
|
/// </summary>
|
||||||
|
[Comment("代码生成主表ID")]
|
||||||
|
public long CodeGenId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库字段名
|
||||||
|
/// </summary>
|
||||||
|
[Comment("数据库字段名")]
|
||||||
|
public string ColumnName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字段描述
|
||||||
|
/// </summary>
|
||||||
|
[Comment("字段描述")]
|
||||||
|
public string ColumnComment { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// .NET数据类型
|
||||||
|
/// </summary>
|
||||||
|
[Comment(".NET数据类型")]
|
||||||
|
public string NetType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 作用类型(字典)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("作用类型")]
|
||||||
|
public string EffectType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字典code
|
||||||
|
/// </summary>
|
||||||
|
[Comment("字典Code")]
|
||||||
|
public string DictTypeCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 列表是否缩进(字典)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("列表是否缩进")]
|
||||||
|
public string WhetherRetract { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否必填(字典)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("是否必填")]
|
||||||
|
public string WhetherRequired { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否是查询条件
|
||||||
|
/// </summary>
|
||||||
|
[Comment("是否是查询条件")]
|
||||||
|
public string QueryWhether { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询方式
|
||||||
|
/// </summary>
|
||||||
|
[Comment("查询方式")]
|
||||||
|
public string QueryType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 列表显示
|
||||||
|
/// </summary>
|
||||||
|
[Comment("列表显示")]
|
||||||
|
public string WhetherTable { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 增改
|
||||||
|
/// </summary>
|
||||||
|
[Comment("增改")]
|
||||||
|
public string WhetherAddUpdate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主外键
|
||||||
|
/// </summary>
|
||||||
|
[Comment("主外键")]
|
||||||
|
public string ColumnKey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库中类型(物理类型)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("数据库中类型")]
|
||||||
|
public string DataType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否通用字段
|
||||||
|
/// </summary>
|
||||||
|
[Comment("是否通用字段")]
|
||||||
|
public string WhetherCommon { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
73
Api/Dilon.Core/Entity/SysConfig.cs
Normal file
73
Api/Dilon.Core/Entity/SysConfig.cs
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
using Dilon.Core.Service;
|
||||||
|
using Furion;
|
||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 参数配置表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_config")]
|
||||||
|
[Comment("参数配置表")]
|
||||||
|
public class SysConfig : DEntityBase, IEntityChangedListener<SysConfig>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
[Comment("编码")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 属性值
|
||||||
|
/// </summary>
|
||||||
|
[Comment("属性值")]
|
||||||
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否是系统参数(Y-是,N-否)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("是否是系统参数")]
|
||||||
|
public string SysFlag { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0正常 1停用 2删除)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态")]
|
||||||
|
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 常量所属分类的编码,来自于“常量的分类”字典
|
||||||
|
/// </summary>
|
||||||
|
[Comment("常量所属分类的编码")]
|
||||||
|
public string GroupCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 监听实体更改之后
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newEntity"></param>
|
||||||
|
/// <param name="oldEntity"></param>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
public void OnChanged(SysConfig newEntity, SysConfig oldEntity, DbContext dbContext, Type dbContextLocator, EntityState state)
|
||||||
|
{
|
||||||
|
// 刷新配置缓存
|
||||||
|
App.GetService<ISysConfigService>().UpdateConfigCache(newEntity.Code, newEntity.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
54
Api/Dilon.Core/Entity/SysDictData.cs
Normal file
54
Api/Dilon.Core/Entity/SysDictData.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 字典值表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_dict_data")]
|
||||||
|
[Comment("字典值表")]
|
||||||
|
public class SysDictData : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 字典类型Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("字典类型Id")]
|
||||||
|
public long TypeId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 值
|
||||||
|
/// </summary>
|
||||||
|
[Comment("值")]
|
||||||
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
[Comment("编码")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
[Comment("排序")]
|
||||||
|
public int Sort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0正常 1停用 2删除)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态")]
|
||||||
|
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属类型
|
||||||
|
/// </summary>
|
||||||
|
public SysDictType SysDictType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
59
Api/Dilon.Core/Entity/SysDictType.cs
Normal file
59
Api/Dilon.Core/Entity/SysDictType.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 字典类型表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_dict_type")]
|
||||||
|
[Comment("字典类型表")]
|
||||||
|
public class SysDictType : DEntityBase, IEntityTypeBuilder<SysDictType>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
[Comment("编码")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
[Comment("排序")]
|
||||||
|
public int Sort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0正常 1停用 2删除)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态")]
|
||||||
|
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字典数据
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysDictData> SysDictDatas { get; set; }
|
||||||
|
|
||||||
|
public void Configure(EntityTypeBuilder<SysDictType> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
entityBuilder.HasMany(x => x.SysDictDatas)
|
||||||
|
.WithOne(x => x.SysDictType)
|
||||||
|
.HasForeignKey(x => x.TypeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
69
Api/Dilon.Core/Entity/SysEmp.cs
Normal file
69
Api/Dilon.Core/Entity/SysEmp.cs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 员工表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_emp")]
|
||||||
|
[Comment("员工表")]
|
||||||
|
public class SysEmp : IEntity, IEntityTypeBuilder<SysEmp>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户Id
|
||||||
|
/// </summary>
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||||
|
[Comment("用户Id")]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工号
|
||||||
|
/// </summary>
|
||||||
|
[Comment("工号")]
|
||||||
|
public string JobNum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 机构Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("机构Id")]
|
||||||
|
public long OrgId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 机构名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("机构名称")]
|
||||||
|
public string OrgName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(职位)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysPos> SysPos { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(员工-职位)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysEmpPos> SysEmpPos { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多配置关系
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entityBuilder"></param>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
public void Configure(EntityTypeBuilder<SysEmp> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
entityBuilder.HasMany(p => p.SysPos).WithMany(p => p.SysEmps).UsingEntity<SysEmpPos>(
|
||||||
|
u => u.HasOne(c => c.SysPos).WithMany(c => c.SysEmpPos).HasForeignKey(c => c.SysPosId),
|
||||||
|
u => u.HasOne(c => c.SysEmp).WithMany(c => c.SysEmpPos).HasForeignKey(c => c.SysEmpId),
|
||||||
|
u =>
|
||||||
|
{
|
||||||
|
u.HasKey(c => new { c.SysEmpId, c.SysPosId });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
67
Api/Dilon.Core/Entity/SysEmpExtOrgPos.cs
Normal file
67
Api/Dilon.Core/Entity/SysEmpExtOrgPos.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 员工附属机构职位表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_emp_ext_org_pos")]
|
||||||
|
[Comment("员工附属机构职位表")]
|
||||||
|
public class SysEmpExtOrgPos : IEntity, IEntityTypeBuilder<SysEmpExtOrgPos>, IEntitySeedData<SysEmpExtOrgPos>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 员工Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("员工Id")]
|
||||||
|
public long SysEmpId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(员工)
|
||||||
|
/// </summary>
|
||||||
|
public SysEmp SysEmp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 机构Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("机构Id")]
|
||||||
|
public long SysOrgId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(机构)
|
||||||
|
/// </summary>
|
||||||
|
public SysOrg SysOrg { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 职位Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("职位Id")]
|
||||||
|
public long SysPosId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(职位)
|
||||||
|
/// </summary>
|
||||||
|
public SysPos SysPos { get; set; }
|
||||||
|
|
||||||
|
public void Configure(EntityTypeBuilder<SysEmpExtOrgPos> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
entityBuilder.HasKey(c => new { c.SysEmpId, c.SysOrgId, c.SysPosId });
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<SysEmpExtOrgPos> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysEmpExtOrgPos { SysEmpId = 142307070910551, SysOrgId = 142307070910539, SysPosId = 142307070910547 },
|
||||||
|
new SysEmpExtOrgPos { SysEmpId = 142307070910551, SysOrgId = 142307070910540, SysPosId = 142307070910548 },
|
||||||
|
new SysEmpExtOrgPos { SysEmpId = 142307070910551, SysOrgId = 142307070910541, SysPosId = 142307070910549 },
|
||||||
|
new SysEmpExtOrgPos { SysEmpId = 142307070910551, SysOrgId = 142307070910542, SysPosId = 142307070910550 },
|
||||||
|
new SysEmpExtOrgPos { SysEmpId = 142307070910553, SysOrgId = 142307070910542, SysPosId = 142307070910547 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Api/Dilon.Core/Entity/SysEmpPos.cs
Normal file
36
Api/Dilon.Core/Entity/SysEmpPos.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 员工职位表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_emp_pos")]
|
||||||
|
[Comment("员工职位表")]
|
||||||
|
public class SysEmpPos : IEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 员工Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("员工Id")]
|
||||||
|
public long SysEmpId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(员工)
|
||||||
|
/// </summary>
|
||||||
|
public SysEmp SysEmp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 职位Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("职位Id")]
|
||||||
|
public long SysPosId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(职位)
|
||||||
|
/// </summary>
|
||||||
|
public SysPos SysPos { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
61
Api/Dilon.Core/Entity/SysFile.cs
Normal file
61
Api/Dilon.Core/Entity/SysFile.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文件信息表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_file")]
|
||||||
|
[Comment("文件信息表")]
|
||||||
|
public class SysFile : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文件存储位置(1:阿里云,2:腾讯云,3:minio,4:本地)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("文件存储位置")]
|
||||||
|
public int FileLocation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件仓库
|
||||||
|
/// </summary>
|
||||||
|
[Comment("文件仓库")]
|
||||||
|
public string FileBucket { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件名称(上传时候的文件名)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("文件名称")]
|
||||||
|
public string FileOriginName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件后缀
|
||||||
|
/// </summary>
|
||||||
|
[Comment("文件后缀")]
|
||||||
|
public string FileSuffix { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件大小kb
|
||||||
|
/// </summary>
|
||||||
|
[Comment("文件大小kb")]
|
||||||
|
public long FileSizeKb { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件大小信息,计算后的
|
||||||
|
/// </summary>
|
||||||
|
[Comment("文件大小信息")]
|
||||||
|
public string FileSizeInfo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 存储到bucket的名称(文件唯一标识id)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("存储到bucket的名称")]
|
||||||
|
public string FileObjectName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 存储路径
|
||||||
|
/// </summary>
|
||||||
|
[Comment("存储路径")]
|
||||||
|
public string FilePath { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
63
Api/Dilon.Core/Entity/SysLogAudit.cs
Normal file
63
Api/Dilon.Core/Entity/SysLogAudit.cs
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统操作/审计日志表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_log_audit")]
|
||||||
|
[Comment("审计日志表")]
|
||||||
|
public class SysLogAudit : EntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 表名
|
||||||
|
/// </summary>
|
||||||
|
[Comment("表名")]
|
||||||
|
public string TableName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 列名
|
||||||
|
/// </summary>
|
||||||
|
[Comment("列名")]
|
||||||
|
public string ColumnName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 新值
|
||||||
|
/// </summary>
|
||||||
|
[Comment("新值")]
|
||||||
|
public string NewValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 旧值
|
||||||
|
/// </summary>
|
||||||
|
[Comment("旧值")]
|
||||||
|
public string OldValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("操作时间")]
|
||||||
|
public DateTimeOffset CreatedTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作人Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("操作人Id")]
|
||||||
|
public long UserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作人名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("操作人名称")]
|
||||||
|
public string UserName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作方式:新增、更新、删除
|
||||||
|
/// </summary>
|
||||||
|
[Comment("操作方式")]
|
||||||
|
public string Operate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
117
Api/Dilon.Core/Entity/SysLogOp.cs
Normal file
117
Api/Dilon.Core/Entity/SysLogOp.cs
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 操作日志表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_log_op")]
|
||||||
|
[Comment("操作日志表")]
|
||||||
|
public class SysLogOp : EntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作类型(0其他 1增加 2删除 3编辑)(见LogAnnotionOpTypeEnum)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("操作类型")]
|
||||||
|
public int? OpType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否执行成功(Y-是,N-否)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("是否执行成功")]
|
||||||
|
public string Success { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体消息
|
||||||
|
/// </summary>
|
||||||
|
[Comment("具体消息")]
|
||||||
|
public string Message { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IP
|
||||||
|
/// </summary>
|
||||||
|
[Comment("IP")]
|
||||||
|
public string Ip { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地址
|
||||||
|
/// </summary>
|
||||||
|
[Comment("地址")]
|
||||||
|
public string Location { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 浏览器
|
||||||
|
/// </summary>
|
||||||
|
[Comment("浏览器")]
|
||||||
|
public string Browser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作系统
|
||||||
|
/// </summary>
|
||||||
|
[Comment("操作系统")]
|
||||||
|
public string Os { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求地址
|
||||||
|
/// </summary>
|
||||||
|
[Comment("请求地址")]
|
||||||
|
public string Url { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 类名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("类名称")]
|
||||||
|
public string ClassName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 方法名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("方法名称")]
|
||||||
|
public string MethodName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求方式(GET POST PUT DELETE)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("请求方式")]
|
||||||
|
public string ReqMethod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求参数
|
||||||
|
/// </summary>
|
||||||
|
[Comment("请求参数")]
|
||||||
|
public string Param { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回结果
|
||||||
|
/// </summary>
|
||||||
|
[Comment("返回结果")]
|
||||||
|
public string Result { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 耗时(毫秒)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("耗时")]
|
||||||
|
public long ElapsedTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("操作时间")]
|
||||||
|
public DateTimeOffset OpTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作人
|
||||||
|
/// </summary>
|
||||||
|
[Comment("操作人")]
|
||||||
|
public string Account { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
75
Api/Dilon.Core/Entity/SysLogVis.cs
Normal file
75
Api/Dilon.Core/Entity/SysLogVis.cs
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 访问日志表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_log_vis")]
|
||||||
|
[Comment("访问日志表")]
|
||||||
|
public class SysLogVis : EntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否执行成功(Y-是,N-否)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("是否执行成功")]
|
||||||
|
public string Success { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具体消息
|
||||||
|
/// </summary>
|
||||||
|
[Comment("具体消息")]
|
||||||
|
public string Message { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IP
|
||||||
|
/// </summary>
|
||||||
|
[Comment("IP")]
|
||||||
|
public string Ip { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地址
|
||||||
|
/// </summary>
|
||||||
|
[Comment("地址")]
|
||||||
|
public string Location { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 浏览器
|
||||||
|
/// </summary>
|
||||||
|
[Comment("浏览器")]
|
||||||
|
public string Browser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作系统
|
||||||
|
/// </summary>
|
||||||
|
[Comment("操作系统")]
|
||||||
|
public string Os { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 访问类型(字典 1登入 2登出)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("访问类型")]
|
||||||
|
public int? VisType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 访问时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("访问时间")]
|
||||||
|
public DateTimeOffset VisTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 访问人
|
||||||
|
/// </summary>
|
||||||
|
[Comment("访问人")]
|
||||||
|
public string Account { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
131
Api/Dilon.Core/Entity/SysMenu.cs
Normal file
131
Api/Dilon.Core/Entity/SysMenu.cs
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_menu")]
|
||||||
|
[Comment("菜单表")]
|
||||||
|
public class SysMenu : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 父Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("父Id")]
|
||||||
|
public long Pid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 父Ids
|
||||||
|
/// </summary>
|
||||||
|
[Comment("父Ids")]
|
||||||
|
public string Pids { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
[Comment("编码")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单类型(字典 0目录 1菜单 2按钮)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("菜单类型")]
|
||||||
|
public int Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图标
|
||||||
|
/// </summary>
|
||||||
|
[Comment("图标")]
|
||||||
|
public string Icon { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 路由地址
|
||||||
|
/// </summary>
|
||||||
|
[Comment("路由地址")]
|
||||||
|
public string Router { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 组件地址
|
||||||
|
/// </summary>
|
||||||
|
[Comment("组件地址")]
|
||||||
|
public string Component { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 权限标识
|
||||||
|
/// </summary>
|
||||||
|
[Comment("权限标识")]
|
||||||
|
public string Permission { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用分类(应用编码)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("应用分类")]
|
||||||
|
public string Application { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打开方式(字典 0无 1组件 2内链 3外链)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("打开方式")]
|
||||||
|
public int OpenType { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否可见(Y-是,N-否)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("是否可见")]
|
||||||
|
public string Visible { get; set; } = "Y";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 内链地址
|
||||||
|
/// </summary>
|
||||||
|
[Comment("内链地址")]
|
||||||
|
public string Link { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重定向地址
|
||||||
|
/// </summary>
|
||||||
|
[Comment("重定向地址")]
|
||||||
|
public string Redirect { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 权重(字典 1系统权重 2业务权重)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("权重")]
|
||||||
|
public int Weight { get; set; } = 2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
[Comment("排序")]
|
||||||
|
public int Sort { get; set; } = 100;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0正常 1停用 2删除)
|
||||||
|
/// </summary>
|
||||||
|
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(角色)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysRole> SysRoles { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(用户角色)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysRoleMenu> SysRoleMenus { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
74
Api/Dilon.Core/Entity/SysNotice.cs
Normal file
74
Api/Dilon.Core/Entity/SysNotice.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通知公告表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_notice")]
|
||||||
|
[Comment("通知公告表")]
|
||||||
|
public class SysNotice : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 标题
|
||||||
|
/// </summary>
|
||||||
|
[Comment("标题")]
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 内容
|
||||||
|
/// </summary>
|
||||||
|
[Comment("内容")]
|
||||||
|
public string Content { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 类型(字典 1通知 2公告)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("类型")]
|
||||||
|
public int Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发布人Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("发布人Id")]
|
||||||
|
public long PublicUserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发布人姓名
|
||||||
|
/// </summary>
|
||||||
|
[Comment("发布人姓名")]
|
||||||
|
public string PublicUserName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发布机构Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("发布机构Id")]
|
||||||
|
public long PublicOrgId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发布机构名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("发布机构名称")]
|
||||||
|
public string PublicOrgName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发布时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("发布时间")]
|
||||||
|
public DateTimeOffset PublicTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 撤回时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("撤回时间")]
|
||||||
|
public DateTimeOffset CancelTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0草稿 1发布 2撤回 3删除)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态")]
|
||||||
|
public int Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
45
Api/Dilon.Core/Entity/SysNoticeUser.cs
Normal file
45
Api/Dilon.Core/Entity/SysNoticeUser.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通知公告用户表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_notice_user")]
|
||||||
|
[Comment("通知公告用户表")]
|
||||||
|
public class SysNoticeUser : IEntity, IEntityTypeBuilder<SysNoticeUser>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通知公告Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("通知公告Id")]
|
||||||
|
public long NoticeId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("用户Id")]
|
||||||
|
public long UserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 阅读时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("阅读时间")]
|
||||||
|
public DateTimeOffset ReadTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0未读 1已读)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态")]
|
||||||
|
public int ReadStatus { get; set; }
|
||||||
|
|
||||||
|
public void Configure(EntityTypeBuilder<SysNoticeUser> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
entityBuilder.HasNoKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
85
Api/Dilon.Core/Entity/SysOauthUser.cs
Normal file
85
Api/Dilon.Core/Entity/SysOauthUser.cs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Oauth登录用户表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_oauth_user")]
|
||||||
|
[Comment("Oauth登录用户表")]
|
||||||
|
public class SysOauthUser : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 第三方平台的用户唯一Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("UUID")]
|
||||||
|
public string Uuid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户授权的token
|
||||||
|
/// </summary>
|
||||||
|
[Comment("Token")]
|
||||||
|
public string AccessToken { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 昵称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("昵称")]
|
||||||
|
public string NickName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 头像
|
||||||
|
/// </summary>
|
||||||
|
[Comment("头像")]
|
||||||
|
public string Avatar { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 性别
|
||||||
|
/// </summary>
|
||||||
|
[Comment("性别")]
|
||||||
|
public string Gender { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电话
|
||||||
|
/// </summary>
|
||||||
|
[Comment("电话")]
|
||||||
|
public string Phone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 邮箱
|
||||||
|
/// </summary>
|
||||||
|
[Comment("邮箱")]
|
||||||
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 位置
|
||||||
|
/// </summary>
|
||||||
|
[Comment("位置")]
|
||||||
|
public string Location { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户网址
|
||||||
|
/// </summary>
|
||||||
|
[Comment("用户网址")]
|
||||||
|
public string Blog { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所在公司
|
||||||
|
/// </summary>
|
||||||
|
[Comment("所在公司")]
|
||||||
|
public string Company { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户来源
|
||||||
|
/// </summary>
|
||||||
|
[Comment("用户来源")]
|
||||||
|
public string Source { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户备注(各平台中的用户个人介绍)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
88
Api/Dilon.Core/Entity/SysOrg.cs
Normal file
88
Api/Dilon.Core/Entity/SysOrg.cs
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 组织机构表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_org")]
|
||||||
|
[Comment("组织机构表")]
|
||||||
|
public class SysOrg : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 父Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("父Id")]
|
||||||
|
public long Pid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 父Ids
|
||||||
|
/// </summary>
|
||||||
|
[Comment("父Ids")]
|
||||||
|
public string Pids { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
[Comment("编码")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 联系人
|
||||||
|
/// </summary>
|
||||||
|
[Comment("联系人")]
|
||||||
|
public string Contacts { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电话
|
||||||
|
/// </summary>
|
||||||
|
[Comment("电话")]
|
||||||
|
public string Tel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
[Comment("排序")]
|
||||||
|
public int Sort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0正常 1停用 2删除)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态")]
|
||||||
|
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(用户)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysUser> SysUsers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(用户数据范围)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysUserDataScope> SysUserDataScopes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(角色)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysRole> SysRoles { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(角色数据范围)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysRoleDataScope> SysRoleDataScopes { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
54
Api/Dilon.Core/Entity/SysPos.cs
Normal file
54
Api/Dilon.Core/Entity/SysPos.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 职位表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_pos")]
|
||||||
|
[Comment("职位表")]
|
||||||
|
public class SysPos : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
[Comment("编码")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
[Comment("排序")]
|
||||||
|
public int Sort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0正常 1停用 2删除)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态")]
|
||||||
|
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(员工)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysEmp> SysEmps { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(员工职位)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysEmpPos> SysEmpPos { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
112
Api/Dilon.Core/Entity/SysRole.cs
Normal file
112
Api/Dilon.Core/Entity/SysRole.cs
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_role")]
|
||||||
|
[Comment("角色表")]
|
||||||
|
public class SysRole : DEntityBase, IEntityTypeBuilder<SysRole>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
[Comment("编码")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
[Comment("排序")]
|
||||||
|
public int Sort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据范围类型(字典 1全部数据 2本部门及以下数据 3本部门数据 4仅本人数据 5自定义数据)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("数据范围类型")]
|
||||||
|
public int DataScopeType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0正常 1停用 2删除)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态")]
|
||||||
|
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(用户)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysUser> SysUsers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(用户角色)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysUserRole> SysUserRoles { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(机构)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysOrg> SysOrgs { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(角色-机构 数据范围)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysRoleDataScope> SysRoleDataScopes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(菜单)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysMenu> SysMenus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(角色-菜单)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysRoleMenu> SysRoleMenus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置多对多关系
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entityBuilder"></param>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
public void Configure(EntityTypeBuilder<SysRole> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
entityBuilder.HasMany(p => p.SysOrgs)
|
||||||
|
.WithMany(p => p.SysRoles)
|
||||||
|
.UsingEntity<SysRoleDataScope>(
|
||||||
|
u => u.HasOne(c => c.SysOrg).WithMany(c => c.SysRoleDataScopes).HasForeignKey(c => c.SysOrgId),
|
||||||
|
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysRoleDataScopes).HasForeignKey(c => c.SysRoleId),
|
||||||
|
u =>
|
||||||
|
{
|
||||||
|
u.HasKey(c => new { c.SysRoleId, c.SysOrgId });
|
||||||
|
});
|
||||||
|
|
||||||
|
entityBuilder.HasMany(p => p.SysMenus)
|
||||||
|
.WithMany(p => p.SysRoles)
|
||||||
|
.UsingEntity<SysRoleMenu>(
|
||||||
|
u => u.HasOne(c => c.SysMenu).WithMany(c => c.SysRoleMenus).HasForeignKey(c => c.SysMenuId),
|
||||||
|
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysRoleMenus).HasForeignKey(c => c.SysRoleId),
|
||||||
|
u =>
|
||||||
|
{
|
||||||
|
u.HasKey(c => new { c.SysRoleId, c.SysMenuId });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Api/Dilon.Core/Entity/SysRoleDataScope.cs
Normal file
36
Api/Dilon.Core/Entity/SysRoleDataScope.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色数据范围表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_role_data_scope")]
|
||||||
|
[Comment("角色数据范围表")]
|
||||||
|
public class SysRoleDataScope : IEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("角色Id")]
|
||||||
|
public long SysRoleId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(系统角色)
|
||||||
|
/// </summary>
|
||||||
|
public SysRole SysRole { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 机构Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("机构Id")]
|
||||||
|
public long SysOrgId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(系统机构)
|
||||||
|
/// </summary>
|
||||||
|
public SysOrg SysOrg { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Api/Dilon.Core/Entity/SysRoleMenu.cs
Normal file
36
Api/Dilon.Core/Entity/SysRoleMenu.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色菜单表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_role_menu")]
|
||||||
|
[Comment("角色菜单表")]
|
||||||
|
public class SysRoleMenu : IEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("角色Id")]
|
||||||
|
public long SysRoleId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(系统用户)
|
||||||
|
/// </summary>
|
||||||
|
public SysRole SysRole { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("菜单Id")]
|
||||||
|
public long SysMenuId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(系统菜单)
|
||||||
|
/// </summary>
|
||||||
|
public SysMenu SysMenu { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
56
Api/Dilon.Core/Entity/SysTenant.cs
Normal file
56
Api/Dilon.Core/Entity/SysTenant.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 租户表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_tenant")]
|
||||||
|
[Comment("租户表")]
|
||||||
|
public class SysTenant : DEntityBase, IEntity<MultiTenantDbContextLocator>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主机
|
||||||
|
/// </summary>
|
||||||
|
[Comment("主机")]
|
||||||
|
public string Host { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电子邮箱
|
||||||
|
/// </summary>
|
||||||
|
[Comment("电子邮箱")]
|
||||||
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电话
|
||||||
|
/// </summary>
|
||||||
|
[Comment("电话")]
|
||||||
|
public string Phone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库连接
|
||||||
|
/// </summary>
|
||||||
|
[Comment("数据库连接")]
|
||||||
|
public string Connection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 架构
|
||||||
|
/// </summary>
|
||||||
|
[Comment("架构")]
|
||||||
|
public string Schema { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
101
Api/Dilon.Core/Entity/SysTimer.cs
Normal file
101
Api/Dilon.Core/Entity/SysTimer.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using Dilon.Core.Service;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 定时任务
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_timer")]
|
||||||
|
[Comment("定时任务表")]
|
||||||
|
public class SysTimer : DEntityBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务名称
|
||||||
|
/// </summary>
|
||||||
|
/// <example>dilon</example>
|
||||||
|
[Comment("任务名称")]
|
||||||
|
public string JobName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务分组
|
||||||
|
/// </summary>
|
||||||
|
/// <example>dilon</example>
|
||||||
|
[Comment("任务分组")]
|
||||||
|
public string JobGroup { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("开始时间")]
|
||||||
|
public DateTimeOffset BeginTime { get; set; } = DateTimeOffset.Now;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结束时间
|
||||||
|
/// </summary>
|
||||||
|
/// <example>null</example>
|
||||||
|
[Comment("结束时间")]
|
||||||
|
public DateTimeOffset? EndTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cron表达式
|
||||||
|
/// </summary>
|
||||||
|
/// <example></example>
|
||||||
|
[Comment("Cron表达式")]
|
||||||
|
public string Cron { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行次数(默认无限循环)
|
||||||
|
/// </summary>
|
||||||
|
/// <example>10</example>
|
||||||
|
[Comment("执行次数")]
|
||||||
|
public int? RunNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行间隔时间,单位秒(如果有Cron,则IntervalSecond失效)
|
||||||
|
/// </summary>
|
||||||
|
/// <example>5</example>
|
||||||
|
[Comment("执行间隔时间")]
|
||||||
|
public int? Interval { get; set; } = 5;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 触发器类型
|
||||||
|
/// </summary>
|
||||||
|
[Comment("触发器类型")]
|
||||||
|
public TriggerTypeEnum TriggerType { get; set; } = TriggerTypeEnum.Simple;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求url
|
||||||
|
/// </summary>
|
||||||
|
[Comment("请求url")]
|
||||||
|
public string RequestUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求参数(Post,Put请求用)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("请求参数")]
|
||||||
|
public string RequestParameters { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Headers(可以包含如:Authorization授权认证)
|
||||||
|
/// 格式:{"Authorization":"userpassword.."}
|
||||||
|
/// </summary>
|
||||||
|
[Comment("Headers")]
|
||||||
|
public string Headers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求类型
|
||||||
|
/// </summary>
|
||||||
|
/// <example>2</example>
|
||||||
|
[Comment("请求类型")]
|
||||||
|
public RequestTypeEnum RequestType { get; set; } = RequestTypeEnum.Post;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[Comment("备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
155
Api/Dilon.Core/Entity/SysUser.cs
Normal file
155
Api/Dilon.Core/Entity/SysUser.cs
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_user")]
|
||||||
|
[Comment("用户表")]
|
||||||
|
public class SysUser : DEntityBase, IEntityTypeBuilder<SysUser>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 账号
|
||||||
|
/// </summary>
|
||||||
|
[Comment("账号")]
|
||||||
|
[Required, MaxLength(20)]
|
||||||
|
public string Account { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 密码(采用MD5加密)
|
||||||
|
/// </summary>
|
||||||
|
[Comment("密码")]
|
||||||
|
[Required]
|
||||||
|
public string Password { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 昵称
|
||||||
|
/// </summary>
|
||||||
|
[Comment("昵称")]
|
||||||
|
[MaxLength(20)]
|
||||||
|
public string NickName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 姓名
|
||||||
|
/// </summary>
|
||||||
|
[Comment("姓名")]
|
||||||
|
[MaxLength(20)]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 头像
|
||||||
|
/// </summary>
|
||||||
|
[Comment("头像")]
|
||||||
|
public string Avatar { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生日
|
||||||
|
/// </summary>
|
||||||
|
[Comment("生日")]
|
||||||
|
public DateTimeOffset Birthday { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 性别-男_1、女_2
|
||||||
|
/// </summary>
|
||||||
|
[Comment("性别-男_1、女_2")]
|
||||||
|
public int Sex { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 邮箱
|
||||||
|
/// </summary>
|
||||||
|
[Comment("邮箱")]
|
||||||
|
[MaxLength(30)]
|
||||||
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 手机
|
||||||
|
/// </summary>
|
||||||
|
[Comment("手机")]
|
||||||
|
[MaxLength(30)]
|
||||||
|
public string Phone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电话
|
||||||
|
/// </summary>
|
||||||
|
[Comment("电话")]
|
||||||
|
[MaxLength(30)]
|
||||||
|
public string Tel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后登录IP
|
||||||
|
/// </summary>
|
||||||
|
[Comment("最后登录IP")]
|
||||||
|
[MaxLength(30)]
|
||||||
|
public string LastLoginIp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后登录时间
|
||||||
|
/// </summary>
|
||||||
|
[Comment("最后登录时间")]
|
||||||
|
public DateTimeOffset LastLoginTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 管理员类型-超级管理员_1、非管理员_2
|
||||||
|
/// </summary>
|
||||||
|
[Comment("管理员类型-超级管理员_1、非管理员_2")]
|
||||||
|
public AdminType AdminType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态-正常_0、停用_1、删除_2
|
||||||
|
/// </summary>
|
||||||
|
[Comment("状态-正常_0、停用_1、删除_2")]
|
||||||
|
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(角色)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysRole> SysRoles { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(用户-角色)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysUserRole> SysUserRoles { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多(机构)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<SysOrg> SysOrgs { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多对多中间表(用户-机构 数据范围)
|
||||||
|
/// </summary>
|
||||||
|
public List<SysUserDataScope> SysUserDataScopes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置多对多关系
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entityBuilder"></param>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
public void Configure(EntityTypeBuilder<SysUser> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
entityBuilder.HasMany(p => p.SysRoles).WithMany(p => p.SysUsers).UsingEntity<SysUserRole>(
|
||||||
|
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysUserRoles).HasForeignKey(c => c.SysRoleId),
|
||||||
|
u => u.HasOne(c => c.SysUser).WithMany(c => c.SysUserRoles).HasForeignKey(c => c.SysUserId),
|
||||||
|
u =>
|
||||||
|
{
|
||||||
|
u.HasKey(c => new { c.SysUserId, c.SysRoleId });
|
||||||
|
});
|
||||||
|
|
||||||
|
entityBuilder.HasMany(p => p.SysOrgs).WithMany(p => p.SysUsers).UsingEntity<SysUserDataScope>(
|
||||||
|
u => u.HasOne(c => c.SysOrg).WithMany(c => c.SysUserDataScopes).HasForeignKey(c => c.SysOrgId),
|
||||||
|
u => u.HasOne(c => c.SysUser).WithMany(c => c.SysUserDataScopes).HasForeignKey(c => c.SysUserId),
|
||||||
|
u =>
|
||||||
|
{
|
||||||
|
u.HasKey(c => new { c.SysUserId, c.SysOrgId });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Api/Dilon.Core/Entity/SysUserDataScope.cs
Normal file
36
Api/Dilon.Core/Entity/SysUserDataScope.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户数据范围表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_user_data_scope")]
|
||||||
|
[Comment("用户数据范围表")]
|
||||||
|
public class SysUserDataScope : IEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("用户Id")]
|
||||||
|
public long SysUserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(系统用户)
|
||||||
|
/// </summary>
|
||||||
|
public SysUser SysUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 机构Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("机构Id")]
|
||||||
|
public long SysOrgId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(系统机构)
|
||||||
|
/// </summary>
|
||||||
|
public SysOrg SysOrg { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Api/Dilon.Core/Entity/SysUserRole.cs
Normal file
36
Api/Dilon.Core/Entity/SysUserRole.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户角色表
|
||||||
|
/// </summary>
|
||||||
|
[Table("sys_user_role")]
|
||||||
|
[Comment("用户角色表")]
|
||||||
|
public class SysUserRole : IEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("用户Id")]
|
||||||
|
public long SysUserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(系统用户)
|
||||||
|
/// </summary>
|
||||||
|
public SysUser SysUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 系统角色Id
|
||||||
|
/// </summary>
|
||||||
|
[Comment("角色Id")]
|
||||||
|
public long SysRoleId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一对一引用(系统角色)
|
||||||
|
/// </summary>
|
||||||
|
public SysRole SysRole { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Api/Dilon.Core/Enum/AdminType.cs
Normal file
22
Api/Dilon.Core/Enum/AdminType.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 账号类型
|
||||||
|
/// </summary>
|
||||||
|
public enum AdminType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 超级管理员
|
||||||
|
/// </summary>
|
||||||
|
[Description("超级管理员")]
|
||||||
|
SuperAdmin = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 非管理员
|
||||||
|
/// </summary>
|
||||||
|
[Description("非管理员")]
|
||||||
|
None = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
28
Api/Dilon.Core/Enum/CommonStatus.cs
Normal file
28
Api/Dilon.Core/Enum/CommonStatus.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 公共状态
|
||||||
|
/// </summary>
|
||||||
|
public enum CommonStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 正常
|
||||||
|
/// </summary>
|
||||||
|
[Description("正常")]
|
||||||
|
ENABLE = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 停用
|
||||||
|
/// </summary>
|
||||||
|
[Description("停用")]
|
||||||
|
DISABLE = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除
|
||||||
|
/// </summary>
|
||||||
|
[Description("删除")]
|
||||||
|
DELETED = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
37
Api/Dilon.Core/Enum/DataScopeType.cs
Normal file
37
Api/Dilon.Core/Enum/DataScopeType.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
public enum DataScopeType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 全部数据
|
||||||
|
/// </summary>
|
||||||
|
[Description("全部数据")]
|
||||||
|
ALL = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 本部门及以下数据
|
||||||
|
/// </summary>
|
||||||
|
[Description("本部门及以下数据")]
|
||||||
|
DEPT_WITH_CHILD = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 本部门数据
|
||||||
|
/// </summary>
|
||||||
|
[Description("本部门数据")]
|
||||||
|
DEPT = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仅本人数据
|
||||||
|
/// </summary>
|
||||||
|
[Description("仅本人数据")]
|
||||||
|
SELF = 4,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自定义数据
|
||||||
|
/// </summary>
|
||||||
|
[Description("自定义数据")]
|
||||||
|
DEFINE = 5
|
||||||
|
}
|
||||||
|
}
|
||||||
360
Api/Dilon.Core/Enum/ErrorCode.cs
Normal file
360
Api/Dilon.Core/Enum/ErrorCode.cs
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
using Furion.FriendlyException;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统错误码
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeType]
|
||||||
|
public enum ErrorCode
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户名或密码不正确
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("用户名或密码不正确")]
|
||||||
|
D1000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 非法操作!禁止删除自己
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("非法操作,禁止删除自己")]
|
||||||
|
D1001,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录不存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("记录不存在")]
|
||||||
|
D1002,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 账号已存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("账号已存在")]
|
||||||
|
D1003,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 旧密码不匹配
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("旧密码输入错误")]
|
||||||
|
D1004,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试数据禁止更改admin密码
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("测试数据禁止更改用户【admin】密码")]
|
||||||
|
D1005,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据已存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("数据已存在")]
|
||||||
|
D1006,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据不存在或含有关联引用,禁止删除
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("数据不存在或含有关联引用,禁止删除")]
|
||||||
|
D1007,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 禁止为管理员分配角色
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("禁止为管理员分配角色")]
|
||||||
|
D1008,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重复数据或记录含有不存在数据
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("重复数据或记录含有不存在数据")]
|
||||||
|
D1009,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 禁止为超级管理员角色分配权限
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("禁止为超级管理员角色分配权限")]
|
||||||
|
D1010,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 非法数据
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("非法数据")]
|
||||||
|
D1011,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Id不能为空
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("Id不能为空")]
|
||||||
|
D1012,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属机构不在自己的数据范围内
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("没有权限操作该数据")]
|
||||||
|
D1013,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 禁止删除超级管理员
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("禁止删除超级管理员")]
|
||||||
|
D1014,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 禁止修改超级管理员状态
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("禁止修改超级管理员状态")]
|
||||||
|
D1015,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 没有权限
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("没有权限")]
|
||||||
|
D1016,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 账号已冻结
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("账号已冻结")]
|
||||||
|
D1017,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 父机构不存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("父机构不存在")]
|
||||||
|
D2000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前机构Id不能与父机构Id相同
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("当前机构Id不能与父机构Id相同")]
|
||||||
|
D2001,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已有相同组织机构,编码或名称相同
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("已有相同组织机构,编码或名称相同")]
|
||||||
|
D2002,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 没有权限操作机构
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("没有权限操作机构")]
|
||||||
|
D2003,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 该机构下有员工禁止删除
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("该机构下有员工禁止删除")]
|
||||||
|
D2004,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 附属机构下有员工禁止删除
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("附属机构下有员工禁止删除")]
|
||||||
|
D2005,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字典类型不存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("字典类型不存在")]
|
||||||
|
D3000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字典类型已存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("字典类型已存在,名称或编码重复")]
|
||||||
|
D3001,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字典类型下面有字典值禁止删除
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("字典类型下面有字典值禁止删除")]
|
||||||
|
D3002,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字典值已存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("字典值已存在,名称或编码重复")]
|
||||||
|
D3003,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字典值不存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("字典值不存在")]
|
||||||
|
D3004,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字典状态错误
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("字典状态错误")]
|
||||||
|
D3005,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单已存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("菜单已存在")]
|
||||||
|
D4000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 路由地址为空
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("路由地址为空")]
|
||||||
|
D4001,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打开方式为空
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("打开方式为空")]
|
||||||
|
D4002,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 权限标识格式为空
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("权限标识格式为空")]
|
||||||
|
D4003,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 权限标识格式错误
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("权限标识格式错误")]
|
||||||
|
D4004,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 权限不存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("权限不存在")]
|
||||||
|
D4005,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 父级菜单不能为当前节点,请重新选择父级菜单
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("父级菜单不能为当前节点,请重新选择父级菜单")]
|
||||||
|
D4006,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 不能移动根节点
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("不能移动根节点")]
|
||||||
|
D4007,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已存在同名或同编码应用
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("已存在同名或同编码应用")]
|
||||||
|
D5000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 默认激活系统只能有一个
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("默认激活系统只能有一个")]
|
||||||
|
D5001,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 该应用下有菜单禁止删除
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("该应用下有菜单禁止删除")]
|
||||||
|
D5002,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已存在同名或同编码应用
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("已存在同名或同编码应用")]
|
||||||
|
D5003,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已存在同名或同编码职位
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("已存在同名或同编码职位")]
|
||||||
|
D6000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 该职位下有员工禁止删除
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("该职位下有员工禁止删除")]
|
||||||
|
D6001,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通知公告状态错误
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("通知公告状态错误")]
|
||||||
|
D7000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通知公告删除失败
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("通知公告删除失败")]
|
||||||
|
D7001,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通知公告编辑失败
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("通知公告编辑失败,类型必须为草稿")]
|
||||||
|
D7002,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件不存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("文件不存在")]
|
||||||
|
D8000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已存在同名或同编码参数配置
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("已存在同名或同编码参数配置")]
|
||||||
|
D9000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 禁止删除系统参数
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("禁止删除系统参数")]
|
||||||
|
D9001,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已存在同名任务调度
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("已存在同名任务调度")]
|
||||||
|
D1100,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务调度不存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("任务调度不存在")]
|
||||||
|
D1101,
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 演示环境禁止修改数据
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("演示环境禁止修改数据")]
|
||||||
|
D1200,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已存在同名或同主机租户
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("已存在同名或同主机租户")]
|
||||||
|
D1300,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 该表代码模板已经生成过
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("该表代码模板已经生成过")]
|
||||||
|
D1400,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已存在同名或同编码项目
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("已存在同名或同编码项目")]
|
||||||
|
xg1000,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已存在相同证件号码人员
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("已存在相同证件号码人员")]
|
||||||
|
xg1001,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检测数据不存在
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("检测数据不存在")]
|
||||||
|
xg1002,
|
||||||
|
}
|
||||||
|
}
|
||||||
34
Api/Dilon.Core/Enum/FileLocation.cs
Normal file
34
Api/Dilon.Core/Enum/FileLocation.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文件存储位置
|
||||||
|
/// </summary>
|
||||||
|
public enum FileLocation
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 阿里云
|
||||||
|
/// </summary>
|
||||||
|
[Description("阿里云")]
|
||||||
|
ALIYUN = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 腾讯云
|
||||||
|
/// </summary>
|
||||||
|
[Description("腾讯云")]
|
||||||
|
TENCENT = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// minio服务器
|
||||||
|
/// </summary>
|
||||||
|
[Description("minio服务器")]
|
||||||
|
MINIO = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 本地
|
||||||
|
/// </summary>
|
||||||
|
[Description("本地")]
|
||||||
|
LOCAL = 4
|
||||||
|
}
|
||||||
|
}
|
||||||
28
Api/Dilon.Core/Enum/Gender.cs
Normal file
28
Api/Dilon.Core/Enum/Gender.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 性别
|
||||||
|
/// </summary>
|
||||||
|
public enum Gender
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 男
|
||||||
|
/// </summary>
|
||||||
|
[Description("男")]
|
||||||
|
MALE = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 女
|
||||||
|
/// </summary>
|
||||||
|
[Description("女")]
|
||||||
|
FEMALE = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 未知
|
||||||
|
/// </summary>
|
||||||
|
[Description("未知")]
|
||||||
|
UNKNOWN = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
78
Api/Dilon.Core/Enum/LogOpType.cs
Normal file
78
Api/Dilon.Core/Enum/LogOpType.cs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 日志操作类型
|
||||||
|
/// </summary>
|
||||||
|
public enum LogOpType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 其它
|
||||||
|
/// </summary>
|
||||||
|
OTHER,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 增加
|
||||||
|
/// </summary>
|
||||||
|
ADD,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除
|
||||||
|
/// </summary>
|
||||||
|
DELETE,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑
|
||||||
|
/// </summary>
|
||||||
|
EDIT,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新
|
||||||
|
/// </summary>
|
||||||
|
UPDATE,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询
|
||||||
|
/// </summary>
|
||||||
|
QUERY,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 详情
|
||||||
|
/// </summary>
|
||||||
|
DETAIL,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 树
|
||||||
|
/// </summary>
|
||||||
|
TREE,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导入
|
||||||
|
/// </summary>
|
||||||
|
IMPORT,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导出
|
||||||
|
/// </summary>
|
||||||
|
EXPORT,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授权
|
||||||
|
/// </summary>
|
||||||
|
GRANT,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 强退
|
||||||
|
/// </summary>
|
||||||
|
FORCE,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清空
|
||||||
|
/// </summary>
|
||||||
|
CLEAN,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改状态
|
||||||
|
/// </summary>
|
||||||
|
CHANGE_STATUS
|
||||||
|
}
|
||||||
|
}
|
||||||
34
Api/Dilon.Core/Enum/MenuOpenType.cs
Normal file
34
Api/Dilon.Core/Enum/MenuOpenType.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统菜单类型
|
||||||
|
/// </summary>
|
||||||
|
public enum MenuOpenType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 无
|
||||||
|
/// </summary>
|
||||||
|
[Description("无")]
|
||||||
|
NONE = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 组件
|
||||||
|
/// </summary>
|
||||||
|
[Description("组件")]
|
||||||
|
COMPONENT = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 内链
|
||||||
|
/// </summary>
|
||||||
|
[Description("内链")]
|
||||||
|
INNER = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 外链
|
||||||
|
/// </summary>
|
||||||
|
[Description("外链")]
|
||||||
|
OUTER = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
28
Api/Dilon.Core/Enum/MenuType.cs
Normal file
28
Api/Dilon.Core/Enum/MenuType.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统菜单类型
|
||||||
|
/// </summary>
|
||||||
|
public enum MenuType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 目录
|
||||||
|
/// </summary>
|
||||||
|
[Description("目录")]
|
||||||
|
DIR = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单
|
||||||
|
/// </summary>
|
||||||
|
[Description("菜单")]
|
||||||
|
MENU = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按钮
|
||||||
|
/// </summary>
|
||||||
|
[Description("按钮")]
|
||||||
|
BTN = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Api/Dilon.Core/Enum/MenuWeight.cs
Normal file
22
Api/Dilon.Core/Enum/MenuWeight.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单权重
|
||||||
|
/// </summary>
|
||||||
|
public enum MenuWeight
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统权重
|
||||||
|
/// </summary>
|
||||||
|
[Description("系统权重")]
|
||||||
|
SUPER_ADMIN_WEIGHT = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 业务权重
|
||||||
|
/// </summary>
|
||||||
|
[Description("业务权重")]
|
||||||
|
DEFAULT_WEIGHT = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
34
Api/Dilon.Core/Enum/NoticeStatus.cs
Normal file
34
Api/Dilon.Core/Enum/NoticeStatus.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通知公告状态
|
||||||
|
/// </summary>
|
||||||
|
public enum NoticeStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 草稿
|
||||||
|
/// </summary>
|
||||||
|
[Description("草稿")]
|
||||||
|
DRAFT = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发布
|
||||||
|
/// </summary>
|
||||||
|
[Description("发布")]
|
||||||
|
PUBLIC = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 撤回
|
||||||
|
/// </summary>
|
||||||
|
[Description("撤回")]
|
||||||
|
CANCEL = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除
|
||||||
|
/// </summary>
|
||||||
|
[Description("删除")]
|
||||||
|
DELETED = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Api/Dilon.Core/Enum/NoticeUserStatus.cs
Normal file
22
Api/Dilon.Core/Enum/NoticeUserStatus.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通知公告用户状态
|
||||||
|
/// </summary>
|
||||||
|
public enum NoticeUserStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 未读
|
||||||
|
/// </summary>
|
||||||
|
[Description("未读")]
|
||||||
|
UNREAD = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已读
|
||||||
|
/// </summary>
|
||||||
|
[Description("已读")]
|
||||||
|
READ = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
58
Api/Dilon.Core/Enum/QueryTypeEnum.cs
Normal file
58
Api/Dilon.Core/Enum/QueryTypeEnum.cs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询类型的枚举
|
||||||
|
/// </summary>
|
||||||
|
public enum QueryTypeEnum
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 等于
|
||||||
|
/// </summary>
|
||||||
|
[Description("等于")]
|
||||||
|
eq = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模糊
|
||||||
|
/// </summary>
|
||||||
|
[Description("模糊")]
|
||||||
|
like = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 大于
|
||||||
|
/// </summary>
|
||||||
|
[Description("大于")]
|
||||||
|
gt = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 小于
|
||||||
|
/// </summary>
|
||||||
|
[Description("小于")]
|
||||||
|
lt = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 不等于
|
||||||
|
/// </summary>
|
||||||
|
[Description("不等于")]
|
||||||
|
ne = 4,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 大于等于
|
||||||
|
/// </summary>
|
||||||
|
[Description("大于等于")]
|
||||||
|
ge = 5,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 小于等于
|
||||||
|
/// </summary>
|
||||||
|
[Description("小于等于")]
|
||||||
|
le = 6,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 不为空
|
||||||
|
/// </summary>
|
||||||
|
[Description("不为空")]
|
||||||
|
isNotNull = 7
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Api/Dilon.Core/Enum/YesOrNot.cs
Normal file
22
Api/Dilon.Core/Enum/YesOrNot.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单激活类型
|
||||||
|
/// </summary>
|
||||||
|
public enum YesOrNot
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是
|
||||||
|
/// </summary>
|
||||||
|
[Description("是")]
|
||||||
|
Y = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 否
|
||||||
|
/// </summary>
|
||||||
|
[Description("否")]
|
||||||
|
N = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Api/Dilon.Core/Extension/DictionaryExtensions.cs
Normal file
49
Api/Dilon.Core/Extension/DictionaryExtensions.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 字典扩展
|
||||||
|
/// </summary>
|
||||||
|
public static class DictionaryExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 将一个字典转化为 QueryString
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dict"></param>
|
||||||
|
/// <param name="urlEncode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ToQueryString(this Dictionary<string, string> dict, bool urlEncode = true)
|
||||||
|
{
|
||||||
|
return string.Join("&", dict.Select(p => $"{(urlEncode ? p.Key?.UrlEncode() : "")}={(urlEncode ? p.Value?.UrlEncode() : "")}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 将一个字符串 URL 编码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string UrlEncode(this string str)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(str))
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return System.Web.HttpUtility.UrlEncode(str, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移除空值项
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dict"></param>
|
||||||
|
public static void RemoveEmptyValueItems(this Dictionary<string, string> dict)
|
||||||
|
{
|
||||||
|
dict.Where(item => string.IsNullOrEmpty(item.Value)).Select(item => item.Key).ToList().ForEach(key =>
|
||||||
|
{
|
||||||
|
dict.Remove(key);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
56
Api/Dilon.Core/Extension/XnInputBase.cs
Normal file
56
Api/Dilon.Core/Extension/XnInputBase.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通用输入扩展参数(带权限)
|
||||||
|
/// </summary>
|
||||||
|
public class XnInputBase : PageInputBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 授权菜单
|
||||||
|
/// </summary>
|
||||||
|
public List<long> GrantMenuIdList { get; set; } = new List<long>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授权角色
|
||||||
|
/// </summary>
|
||||||
|
public virtual List<long> GrantRoleIdList { get; set; } = new List<long>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授权数据
|
||||||
|
/// </summary>
|
||||||
|
public virtual List<long> GrantOrgIdList { get; set; } = new List<long>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通用分页输入参数
|
||||||
|
/// </summary>
|
||||||
|
public class PageInputBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 搜索值
|
||||||
|
/// </summary>
|
||||||
|
public virtual string SearchValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前页码
|
||||||
|
/// </summary>
|
||||||
|
public virtual int PageNo { get; set; } = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 页码容量
|
||||||
|
/// </summary>
|
||||||
|
public virtual int PageSize { get; set; } = 20;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 搜索开始时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual string SearchBeginTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 搜索结束时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual string SearchEndTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Api/Dilon.Core/Extension/XnPageResult.cs
Normal file
24
Api/Dilon.Core/Extension/XnPageResult.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 小诺分页列表结果
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public static class XnPageResult<T> where T : new()
|
||||||
|
{
|
||||||
|
public static dynamic PageResult(PagedList<T> page)
|
||||||
|
{
|
||||||
|
return new
|
||||||
|
{
|
||||||
|
PageNo = page.PageIndex,
|
||||||
|
PageSize = page.PageSize,
|
||||||
|
TotalPage = page.TotalPages,
|
||||||
|
TotalRows = page.TotalCount,
|
||||||
|
Rows = page.Items //.Adapt<List<T>>(),
|
||||||
|
//Rainbow = PageUtil.Rainbow(page.PageIndex, page.TotalPages, PageUtil.RAINBOW_NUM)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
166
Api/Dilon.Core/Extension/XnRestfulResultProvider.cs
Normal file
166
Api/Dilon.Core/Extension/XnRestfulResultProvider.cs
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
using Furion.DataValidation;
|
||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.UnifyResult;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 规范化RESTful风格返回值
|
||||||
|
/// </summary>
|
||||||
|
[SkipScan, UnifyModel(typeof(XnRestfulResult<>))]
|
||||||
|
public class XnRestfulResultProvider : IUnifyResultProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 异常返回值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IActionResult OnException(ExceptionContext context)
|
||||||
|
{
|
||||||
|
// 解析异常信息
|
||||||
|
var (StatusCode, ErrorCode, Errors) = UnifyContext.GetExceptionMetadata(context);
|
||||||
|
|
||||||
|
return new JsonResult(new XnRestfulResult<object>
|
||||||
|
{
|
||||||
|
Code = StatusCode,
|
||||||
|
Success = false,
|
||||||
|
Data = null,
|
||||||
|
Message = Errors,
|
||||||
|
Extras = UnifyContext.Take(),
|
||||||
|
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理输出状态码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
/// <param name="statusCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task OnResponseStatusCodes(HttpContext context, int statusCode)
|
||||||
|
{
|
||||||
|
switch (statusCode)
|
||||||
|
{
|
||||||
|
// 处理 401 状态码
|
||||||
|
case StatusCodes.Status401Unauthorized:
|
||||||
|
await context.Response.WriteAsJsonAsync(new XnRestfulResult<object>
|
||||||
|
{
|
||||||
|
Code = StatusCodes.Status401Unauthorized,
|
||||||
|
Success = false,
|
||||||
|
Data = null,
|
||||||
|
Message = "401 未经授权",
|
||||||
|
Extras = UnifyContext.Take(),
|
||||||
|
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
// 处理 403 状态码
|
||||||
|
case StatusCodes.Status403Forbidden:
|
||||||
|
await context.Response.WriteAsJsonAsync(new XnRestfulResult<object>
|
||||||
|
{
|
||||||
|
Code = StatusCodes.Status403Forbidden,
|
||||||
|
Success = false,
|
||||||
|
Data = null,
|
||||||
|
Message = "403 禁止访问",
|
||||||
|
Extras = UnifyContext.Take(),
|
||||||
|
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 成功返回值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IActionResult OnSucceeded(ActionExecutedContext context)
|
||||||
|
{
|
||||||
|
object data;
|
||||||
|
// 处理内容结果
|
||||||
|
if (context.Result is ContentResult contentResult) data = contentResult.Content;
|
||||||
|
// 处理对象结果
|
||||||
|
else if (context.Result is ObjectResult objectResult) data = objectResult.Value;
|
||||||
|
else if (context.Result is EmptyResult) data = null;
|
||||||
|
else return null;
|
||||||
|
|
||||||
|
return new JsonResult(new XnRestfulResult<object>
|
||||||
|
{
|
||||||
|
Code = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK, // 处理没有返回值情况 204
|
||||||
|
Success = true,
|
||||||
|
Data = data,
|
||||||
|
Message = "请求成功",
|
||||||
|
Extras = UnifyContext.Take(),
|
||||||
|
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证失败返回值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
/// <param name="modelStates"></param>
|
||||||
|
/// <param name="validationResults"></param>
|
||||||
|
/// <param name="validateFailedMessage"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, IEnumerable<ValidateFailedModel> validationResults, string validateFailedMessage)
|
||||||
|
{
|
||||||
|
return new JsonResult(new XnRestfulResult<object>
|
||||||
|
{
|
||||||
|
Code = StatusCodes.Status400BadRequest,
|
||||||
|
Success = false,
|
||||||
|
Data = null,
|
||||||
|
Message = validationResults,
|
||||||
|
Extras = UnifyContext.Take(),
|
||||||
|
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// RESTful风格---XIAONUO返回格式
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
[SkipScan]
|
||||||
|
public class XnRestfulResult<T>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 执行成功
|
||||||
|
/// </summary>
|
||||||
|
public bool Success { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态码
|
||||||
|
/// </summary>
|
||||||
|
public int? Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 错误信息
|
||||||
|
/// </summary>
|
||||||
|
public object Message { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据
|
||||||
|
/// </summary>
|
||||||
|
public T Data { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 附加数据
|
||||||
|
/// </summary>
|
||||||
|
public object Extras { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间戳
|
||||||
|
/// </summary>
|
||||||
|
public long Timestamp { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Api/Dilon.Core/Filter/LogExceptionHandler.cs
Normal file
24
Api/Dilon.Core/Filter/LogExceptionHandler.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.FriendlyException;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using Serilog;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 全局异常处理
|
||||||
|
/// </summary>
|
||||||
|
public class LogExceptionHandler : IGlobalExceptionHandler, ISingleton
|
||||||
|
{
|
||||||
|
public Task OnExceptionAsync(ExceptionContext context)
|
||||||
|
{
|
||||||
|
//context.Exception.ToString().LogError("错误");
|
||||||
|
|
||||||
|
// 写日志
|
||||||
|
Log.Error(context.Exception.ToString());
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
60
Api/Dilon.Core/Filter/RequestActionFilter.cs
Normal file
60
Api/Dilon.Core/Filter/RequestActionFilter.cs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
using Furion.DatabaseAccessor.Extensions;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UAParser;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 请求日志拦截
|
||||||
|
/// </summary>
|
||||||
|
public class RequestActionFilter : IAsyncActionFilter
|
||||||
|
{
|
||||||
|
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
||||||
|
{
|
||||||
|
var httpContext = context.HttpContext;
|
||||||
|
var httpRequest = httpContext.Request;
|
||||||
|
|
||||||
|
var sw = new Stopwatch();
|
||||||
|
sw.Start();
|
||||||
|
|
||||||
|
var actionContext = await next();
|
||||||
|
sw.Stop();
|
||||||
|
|
||||||
|
// 判断是否请求成功(没有异常就是请求成功)
|
||||||
|
var isRequestSucceed = actionContext.Exception == null;
|
||||||
|
|
||||||
|
var clent = Parser.GetDefault().Parse(httpContext.Request.Headers["User-Agent"]);
|
||||||
|
var actionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;
|
||||||
|
var descAtt = Attribute.GetCustomAttribute(actionDescriptor.MethodInfo, typeof(DescriptionAttribute)) as DescriptionAttribute;
|
||||||
|
|
||||||
|
var sysOpLog = new SysLogOp
|
||||||
|
{
|
||||||
|
Name = descAtt != null ? descAtt.Description : actionDescriptor.ActionName,
|
||||||
|
OpType = 1,
|
||||||
|
Success = isRequestSucceed ? YesOrNot.Y.ToString() : YesOrNot.N.ToString(),
|
||||||
|
//Message = isRequestSucceed ? "成功" : "失败",
|
||||||
|
Ip = httpContext.GetRemoteIpAddressToIPv4(),
|
||||||
|
Location = httpRequest.GetRequestUrlAddress(),
|
||||||
|
Browser = clent.UA.Family + clent.UA.Major,
|
||||||
|
Os = clent.OS.Family + clent.OS.Major,
|
||||||
|
Url = httpRequest.Path,
|
||||||
|
ClassName = context.Controller.ToString(),
|
||||||
|
MethodName = actionDescriptor.ActionName,
|
||||||
|
ReqMethod = httpRequest.Method,
|
||||||
|
//Param = JsonSerializerUtility.Serialize(context.ActionArguments),
|
||||||
|
//Result = JsonSerializerUtility.Serialize(actionContext.Result),
|
||||||
|
ElapsedTime = sw.ElapsedMilliseconds,
|
||||||
|
OpTime = DateTimeOffset.Now,
|
||||||
|
Account = httpContext.User?.FindFirstValue(ClaimConst.CLAINM_ACCOUNT)
|
||||||
|
};
|
||||||
|
await sysOpLog.InsertAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Api/Dilon.Core/Manager/IUserManager.cs
Normal file
16
Api/Dilon.Core/Manager/IUserManager.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
public interface IUserManager
|
||||||
|
{
|
||||||
|
string Account { get; }
|
||||||
|
string Name { get; }
|
||||||
|
bool SuperAdmin { get; }
|
||||||
|
SysUser User { get; }
|
||||||
|
long UserId { get; }
|
||||||
|
|
||||||
|
Task<SysUser> CheckUserAsync(long userId, bool tracking = true);
|
||||||
|
Task<SysEmp> GetUserEmpInfo(long userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
75
Api/Dilon.Core/Manager/UserManager.cs
Normal file
75
Api/Dilon.Core/Manager/UserManager.cs
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.FriendlyException;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户管理
|
||||||
|
/// </summary>
|
||||||
|
public class UserManager : IUserManager, IScoped
|
||||||
|
{
|
||||||
|
private readonly IRepository<SysUser> _sysUserRep; // 用户表仓储
|
||||||
|
private readonly IRepository<SysEmp> _sysEmpRep; // 员工表
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
public long UserId
|
||||||
|
{
|
||||||
|
get => long.Parse(_httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Account
|
||||||
|
{
|
||||||
|
get => _httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => _httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_NAME)?.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SuperAdmin
|
||||||
|
{
|
||||||
|
get => _httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_SUPERADMIN)?.Value == ((int)AdminType.SuperAdmin).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysUser User
|
||||||
|
{
|
||||||
|
get => _sysUserRep.Find(UserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserManager(IRepository<SysUser> sysUserRep,
|
||||||
|
IRepository<SysEmp> sysEmpRep,
|
||||||
|
IHttpContextAccessor httpContextAccessor)
|
||||||
|
{
|
||||||
|
_sysUserRep = sysUserRep;
|
||||||
|
_sysEmpRep = sysEmpRep;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取用户信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="tracking"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<SysUser> CheckUserAsync(long userId, bool tracking = true)
|
||||||
|
{
|
||||||
|
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Id == userId, tracking);
|
||||||
|
return user ?? throw Oops.Oh(ErrorCode.D1002);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取用户员工信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<SysEmp> GetUserEmpInfo(long userId)
|
||||||
|
{
|
||||||
|
var emp = await _sysEmpRep.FirstOrDefaultAsync(u => u.Id == userId, false);
|
||||||
|
return emp ?? throw Oops.Oh(ErrorCode.D1002);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Api/Dilon.Core/OAuth/IWechatOAuth.cs
Normal file
12
Api/Dilon.Core/OAuth/IWechatOAuth.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core.OAuth
|
||||||
|
{
|
||||||
|
public interface IWechatOAuth
|
||||||
|
{
|
||||||
|
Task<TokenModel> GetAccessTokenAsync(string code, string state = "");
|
||||||
|
string GetAuthorizeUrl(string state = "");
|
||||||
|
Task<UserInfoModel> GetUserInfoAsync(string accessToken, string openId);
|
||||||
|
Task<TokenModel> GetRefreshTokenAsync(string refreshToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Api/Dilon.Core/OAuth/OAuthConfig.cs
Normal file
49
Api/Dilon.Core/OAuth/OAuthConfig.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
|
namespace Dilon.Core.OAuth
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// OAuth配置---此结构方便拓展
|
||||||
|
/// </summary>
|
||||||
|
public class OAuthConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// AppId
|
||||||
|
/// </summary>
|
||||||
|
public string AppId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Secret Key
|
||||||
|
/// </summary>
|
||||||
|
public string AppKey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 回调地址
|
||||||
|
/// </summary>
|
||||||
|
public string RedirectUri { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 权限范围
|
||||||
|
/// </summary>
|
||||||
|
public string Scope { get; set; }
|
||||||
|
|
||||||
|
public static OAuthConfig LoadFrom(IConfiguration configuration, string prefix)
|
||||||
|
{
|
||||||
|
return With(appId: configuration[prefix + ":app_id"],
|
||||||
|
appKey: configuration[prefix + ":app_key"],
|
||||||
|
redirectUri: configuration[prefix + ":redirect_uri"],
|
||||||
|
scope: configuration[prefix + ":scope"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static OAuthConfig With(string appId, string appKey, string redirectUri, string scope)
|
||||||
|
{
|
||||||
|
return new OAuthConfig()
|
||||||
|
{
|
||||||
|
AppId = appId,
|
||||||
|
AppKey = appKey,
|
||||||
|
RedirectUri = redirectUri,
|
||||||
|
Scope = scope
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
67
Api/Dilon.Core/OAuth/TokenModel.cs
Normal file
67
Api/Dilon.Core/OAuth/TokenModel.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Dilon.Core.OAuth
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// AccessToken参数
|
||||||
|
/// </summary>
|
||||||
|
public class TokenModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户标识
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("openid")]
|
||||||
|
public string OpenId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Token 类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("token_type")]
|
||||||
|
public string TokenType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AccessToken
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("access_token")]
|
||||||
|
public string AccessToken { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用于刷新 AccessToken 的 Token
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("refresh_token")]
|
||||||
|
public string RefreshToken { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 此 AccessToken 对应的权限
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("scope")]
|
||||||
|
public string Scope { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AccessToken 过期时间
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("expires_in")]
|
||||||
|
public dynamic ExpiresIn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 错误的详细描述
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("error_description")]
|
||||||
|
public string ErrorDescription { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AccessTokenModelModelExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取的Token是否包含错误
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="accessTokenModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool HasError(this TokenModel accessTokenModel)
|
||||||
|
{
|
||||||
|
return accessTokenModel == null ||
|
||||||
|
string.IsNullOrEmpty(accessTokenModel.AccessToken) ||
|
||||||
|
!string.IsNullOrEmpty(accessTokenModel.ErrorDescription);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
62
Api/Dilon.Core/OAuth/UserInfoModel.cs
Normal file
62
Api/Dilon.Core/OAuth/UserInfoModel.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Dilon.Core.OAuth
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 微信用户参数
|
||||||
|
/// </summary>
|
||||||
|
public class UserInfoModel
|
||||||
|
{
|
||||||
|
[JsonPropertyName("nickname")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("headimgurl")]
|
||||||
|
public string Avatar { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("language")]
|
||||||
|
public string Language { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("openid")]
|
||||||
|
public string Openid { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("sex")]
|
||||||
|
public int Sex { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("province")]
|
||||||
|
public string Province { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("city")]
|
||||||
|
public string City { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("country")]
|
||||||
|
public string Country { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom)
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("privilege")]
|
||||||
|
public List<string> Privilege { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("unionid")]
|
||||||
|
public string UnionId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("errmsg")]
|
||||||
|
public string ErrorMessage { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class UserInfoModelExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取的用户是否包含错误
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userInfoModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool HasError(this UserInfoModel userInfoModel)
|
||||||
|
{
|
||||||
|
return userInfoModel == null ||
|
||||||
|
string.IsNullOrEmpty(userInfoModel.Name) ||
|
||||||
|
!string.IsNullOrEmpty(userInfoModel.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
102
Api/Dilon.Core/OAuth/WechatOAuth.cs
Normal file
102
Api/Dilon.Core/OAuth/WechatOAuth.cs
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.FriendlyException;
|
||||||
|
using Furion.RemoteRequest.Extensions;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core.OAuth
|
||||||
|
{
|
||||||
|
public class WechatOAuth : IWechatOAuth, ISingleton
|
||||||
|
{
|
||||||
|
private readonly string _authorizeUrl = "https://open.weixin.qq.com/connect/oauth2/authorize";
|
||||||
|
private readonly string _accessTokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token";
|
||||||
|
private readonly string _refreshTokenUrl = "https://api.weixin.qq.com/sns/oauth2/refresh_token";
|
||||||
|
private readonly string _userInfoUrl = "https://api.weixin.qq.com/sns/userinfo";
|
||||||
|
|
||||||
|
private readonly OAuthConfig _oauthConfig;
|
||||||
|
|
||||||
|
public WechatOAuth(IConfiguration configuration)
|
||||||
|
{
|
||||||
|
_oauthConfig = OAuthConfig.LoadFrom(configuration, "oauth:wechat");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发起授权
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GetAuthorizeUrl(string state = "")
|
||||||
|
{
|
||||||
|
var param = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
["appid"] = _oauthConfig.AppId,
|
||||||
|
["redirect_uri"] = _oauthConfig.RedirectUri,
|
||||||
|
["response_type"] = "code",
|
||||||
|
["scope"] = _oauthConfig.Scope,
|
||||||
|
["state"] = state
|
||||||
|
};
|
||||||
|
return $"{_authorizeUrl}?{param.ToQueryString()}#wechat_redirect";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取微信Token
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="code"></param>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<TokenModel> GetAccessTokenAsync(string code, string state = "")
|
||||||
|
{
|
||||||
|
var param = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
["appid"] = _oauthConfig.AppId,
|
||||||
|
["secret"] = _oauthConfig.AppKey,
|
||||||
|
["code"] = code,
|
||||||
|
["grant_type"] = "authorization_code"
|
||||||
|
};
|
||||||
|
var accessTokenModel = await $"{_accessTokenUrl}?{param.ToQueryString()}".GetAsAsync<TokenModel>();
|
||||||
|
if (accessTokenModel.HasError())
|
||||||
|
throw Oops.Oh($"{ accessTokenModel.ErrorDescription}");
|
||||||
|
return accessTokenModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取微信用户基本信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="accessToken"></param>
|
||||||
|
/// <param name="openId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<UserInfoModel> GetUserInfoAsync(string accessToken, string openId)
|
||||||
|
{
|
||||||
|
var param = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
["access_token"] = accessToken,
|
||||||
|
["openid"] = openId,
|
||||||
|
["lang"] = "zh_CN",
|
||||||
|
};
|
||||||
|
var userInfoModel = await $"{_userInfoUrl}?{param.ToQueryString()}".GetAsAsync<UserInfoModel>();
|
||||||
|
if (userInfoModel.HasError())
|
||||||
|
throw Oops.Oh($"{ userInfoModel.ErrorMessage}");
|
||||||
|
return userInfoModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新微信Token
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="refreshToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<TokenModel> GetRefreshTokenAsync(string refreshToken)
|
||||||
|
{
|
||||||
|
var param = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
["appid"] = _oauthConfig.AppId,
|
||||||
|
["grant_type"] = "refresh_token",
|
||||||
|
["refresh_token"] = refreshToken
|
||||||
|
};
|
||||||
|
var refreshTokenModel = await $"{_refreshTokenUrl}?{param.ToQueryString()}".GetAsAsync<TokenModel>();
|
||||||
|
if (refreshTokenModel.HasError())
|
||||||
|
throw Oops.Oh($"{ refreshTokenModel.ErrorDescription}");
|
||||||
|
return refreshTokenModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Api/Dilon.Core/SeedData/SysAppSeedData.cs
Normal file
30
Api/Dilon.Core/SeedData/SysAppSeedData.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统应用表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysAppSeedData : IEntitySeedData<SysApp>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysApp> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysApp{Id=142307070922869, Name="业务应用", Code="busapp", Active="N", Status=0, Sort=100 },
|
||||||
|
new SysApp{Id=142307070898245, Name="系统管理", Code="system", Active="Y", Status=0, Sort=100 },
|
||||||
|
new SysApp{Id=142307070902341, Name="系统工具", Code="system_tool", Active="N", Status=0, Sort=100 },
|
||||||
|
new SysApp{Id=142307070922826, Name="高级功能", Code="advanced", Active="N", Status=0, Sort=100 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
59
Api/Dilon.Core/SeedData/SysConfigSeedData.cs
Normal file
59
Api/Dilon.Core/SeedData/SysConfigSeedData.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统参数配置表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysConfigSeedData : IEntitySeedData<SysConfig>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysConfig> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysConfig{Id=142307070902342, Name="jwt密钥", Code="DILON_JWT_SECRET", Value="xiaonuo",SysFlag="Y", Remark="(重要)jwt密钥,默认为空,自行设置", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902343, Name="默认密码", Code="DILON_DEFAULT_PASSWORD", Value="123456",SysFlag="Y", Remark="默认密码", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902344, Name="token过期时间", Code="DILON_TOKEN_EXPIRE", Value="86400",SysFlag="Y", Remark="token过期时间(单位:秒)", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902345, Name="session会话过期时间", Code="DILON_SESSION_EXPIRE", Value="7200",SysFlag="Y", Remark="session会话过期时间(单位:秒)", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902346, Name="阿里云短信keyId", Code="DILON_ALIYUN_SMS_ACCESSKEY_ID", Value="你的keyId",SysFlag="Y", Remark="阿里云短信keyId", Status=0, GroupCode="ALIYUN_SMS"},
|
||||||
|
new SysConfig{Id=142307070902347, Name="阿里云短信secret", Code="DILON_ALIYUN_SMS_ACCESSKEY_SECRET", Value="你的secret",SysFlag="Y", Remark="阿里云短信secret", Status=0, GroupCode="ALIYUN_SMS"},
|
||||||
|
new SysConfig{Id=142307070902348, Name="阿里云短信签名", Code="DILON_ALIYUN_SMS_SIGN_NAME", Value="你的签名",SysFlag="Y", Remark="阿里云短信签名", Status=0, GroupCode="ALIYUN_SMS"},
|
||||||
|
new SysConfig{Id=142307070902349, Name="阿里云短信-登录模板号", Code="DILON_ALIYUN_SMS_LOGIN_TEMPLATE_CODE", Value="SMS_1877123456",SysFlag="Y", Remark="阿里云短信-登录模板号", Status=0, GroupCode="ALIYUN_SMS"},
|
||||||
|
new SysConfig{Id=142307070902350, Name="阿里云短信默认失效时间", Code="DILON_ALIYUN_SMS_INVALIDATE_MINUTES", Value="5",SysFlag="Y", Remark="阿里云短信默认失效时间(单位:分钟)", Status=0, GroupCode="ALIYUN_SMS"},
|
||||||
|
new SysConfig{Id=142307070902351, Name="腾讯云短信secretId", Code="DILON_TENCENT_SMS_SECRET_ID", Value="你的secretId",SysFlag="Y", Remark="腾讯云短信secretId", Status=0, GroupCode="TENCENT_SMS"},
|
||||||
|
new SysConfig{Id=142307070902352, Name="腾讯云短信secretKey", Code="DILON_TENCENT_SMS_SECRET_KEY", Value="你的secretkey",SysFlag="Y", Remark="腾讯云短信secretKey", Status=0, GroupCode="TENCENT_SMS"},
|
||||||
|
new SysConfig{Id=142307070902353, Name="腾讯云短信sdkAppId", Code="DILON_TENCENT_SMS_SDK_APP_ID", Value="1400375123",SysFlag="Y", Remark="腾讯云短信sdkAppId", Status=0, GroupCode="TENCENT_SMS"},
|
||||||
|
new SysConfig{Id=142307070902354, Name="腾讯云短信签名", Code="DILON_TENCENT_SMS_SIGN", Value="你的签名",SysFlag="Y", Remark="腾讯云短信签名", Status=0, GroupCode="TENCENT_SMS"},
|
||||||
|
new SysConfig{Id=142307070902355, Name="邮箱host", Code="DILON_EMAIL_HOST", Value="smtp.126.com",SysFlag="Y", Remark="邮箱host", Status=0, GroupCode="EMAIL"},
|
||||||
|
new SysConfig{Id=142307070902356, Name="邮箱用户名", Code="DILON_EMAIL_USERNAME", Value="test@126.com",SysFlag="Y", Remark="邮箱用户名", Status=0, GroupCode="EMAIL"},
|
||||||
|
new SysConfig{Id=142307070902357, Name="邮箱密码", Code="DILON_EMAIL_PASSWORD", Value="你的邮箱密码",SysFlag="Y", Remark="邮箱密码", Status=0, GroupCode="EMAIL"},
|
||||||
|
new SysConfig{Id=142307070902358, Name="邮箱端口", Code="DILON_EMAIL_PORT", Value="465",SysFlag="Y", Remark="邮箱端口", Status=0, GroupCode="EMAIL"},
|
||||||
|
new SysConfig{Id=142307070902359, Name="邮箱是否开启ssl", Code="DILON_EMAIL_SSL", Value="true",SysFlag="Y", Remark="邮箱是否开启ssl", Status=0, GroupCode="EMAIL"},
|
||||||
|
new SysConfig{Id=142307070902360, Name="邮箱发件人", Code="DILON_EMAIL_FROM", Value="test@126.com",SysFlag="Y", Remark="邮箱发件人", Status=0, GroupCode="EMAIL"},
|
||||||
|
new SysConfig{Id=142307070902361, Name="Win本地上传文件路径", Code="DILON_FILE_UPLOAD_PATH_FOR_WINDOWS", Value="D:/tmp",SysFlag="Y", Remark="Win本地上传文件路径", Status=0, GroupCode="FILE_PATH"},
|
||||||
|
new SysConfig{Id=142307070902362, Name="Linux/Mac本地上传文件路径", Code="DILON_FILE_UPLOAD_PATH_FOR_LINUX", Value="/tmp",SysFlag="Y", Remark="Linux/Mac本地上传文件路径", Status=0, GroupCode="FILE_PATH"},
|
||||||
|
new SysConfig{Id=142307070902363, Name="放开XSS过滤的接口", Code="DILON_UN_XSS_FILTER_URL", Value="/demo/xssfilter,/demo/unxss",SysFlag="Y", Remark="多个url可以用英文逗号隔开", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902364, Name="单用户登陆的开关", Code="DILON_ENABLE_SINGLE_LOGIN", Value="false",SysFlag="Y", Remark="true-打开,false-关闭,如果一个人登录两次,就会将上一次登陆挤下去", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902365, Name="登录验证码的开关", Code="DILON_CAPTCHA_OPEN", Value="true",SysFlag="Y", Remark="true-打开,false-关闭", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902366, Name="Druid监控登录账号", Code="DILON_DRUID_USERNAME", Value="superAdmin",SysFlag="Y", Remark="Druid监控登录账号", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902367, Name="Druid监控界面登录密码", Code="DILON_DRUID_PASSWORD", Value="123456",SysFlag="Y", Remark="Druid监控界面登录密码", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902368, Name="阿里云定位api接口地址", Code="DILON_IP_GEO_API", Value="http://api01.aliyun.venuscn.com/ip?ip=%s",SysFlag="Y", Remark="阿里云定位api接口地址", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902369, Name="阿里云定位appCode", Code="DILON_IP_GEO_APP_CODE", Value="461535aabeae4f34861884d392f5d452",SysFlag="Y", Remark="阿里云定位appCode", Status=0, GroupCode="DEFAULT"},
|
||||||
|
new SysConfig{Id=142307070902370, Name="Oauth用户登录的开关", Code="DILON_ENABLE_OAUTH_LOGIN", Value="true",SysFlag="Y", Remark="Oauth用户登录的开关", Status=0, GroupCode="OAUTH"},
|
||||||
|
new SysConfig{Id=142307070902371, Name="Oauth码云登录ClientId", Code="DILON_OAUTH_GITEE_CLIENT_ID", Value="你的clientId",SysFlag="Y", Remark="Oauth码云登录ClientId", Status=0, GroupCode="OAUTH"},
|
||||||
|
new SysConfig{Id=142307070902372, Name="Oauth码云登录ClientSecret", Code="DILON_OAUTH_GITEE_CLIENT_SECRET", Value="你的clientSecret",SysFlag="Y", Remark="Oauth码云登录ClientSecret", Status=0, GroupCode="OAUTH"},
|
||||||
|
new SysConfig{Id=142307070902373, Name="Oauth码云登录回调地址", Code="DILON_OAUTH_GITEE_REDIRECT_URI", Value="http://127.0.0.1:5566/oauth/callback/gitee",SysFlag="Y", Remark="Oauth码云登录回调地址", Status=0, GroupCode="OAUTH"},
|
||||||
|
new SysConfig{Id=142307070902374, Name="演示环境", Code="DILON_DEMO_ENV_FLAG", Value="false",SysFlag="Y", Remark="演示环境的开关,true-打开,false-关闭,如果演示环境开启,则只能读数据不能写数据", Status=0, GroupCode="DEFAULT"},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
138
Api/Dilon.Core/SeedData/SysDictDataSeedData.cs
Normal file
138
Api/Dilon.Core/SeedData/SysDictDataSeedData.cs
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统字典值种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysDictDataSeedData : IEntitySeedData<SysDictData>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysDictData> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysDictData{Id=142307070902375, TypeId=142307070906484, Value="男", Code="1", Sort=100, Remark="男性", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902376, TypeId=142307070906484, Value="女", Code="2", Sort=100, Remark="女性", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902377, TypeId=142307070906484, Value="未知", Code="3", Sort=100, Remark="未知性别", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902378, TypeId=142307070906485, Value="默认常量", Code="DEFAULT", Sort=100, Remark="默认常量,都以XIAONUO_开头的", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902379, TypeId=142307070906485, Value="阿里云短信", Code="ALIYUN_SMS", Sort=100, Remark="阿里云短信配置", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902380, TypeId=142307070906485, Value="腾讯云短信", Code="TENCENT_SMS", Sort=100, Remark="腾讯云短信", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902381, TypeId=142307070906485, Value="邮件配置", Code="EMAIL", Sort=100, Remark="邮件配置", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902382, TypeId=142307070906485, Value="文件上传路径", Code="FILE_PATH", Sort=100, Remark="文件上传路径", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902383, TypeId=142307070906485, Value="Oauth配置", Code="OAUTH", Sort=100, Remark="Oauth配置", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902384, TypeId=142307070906483, Value="正常", Code="0", Sort=100, Remark="正常", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902385, TypeId=142307070906483, Value="停用", Code="1", Sort=100, Remark="停用", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902386, TypeId=142307070906483, Value="删除", Code="2", Sort=100, Remark="删除", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902387, TypeId=142307070906486, Value="否", Code="N", Sort=100, Remark="否", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902388, TypeId=142307070906486, Value="是", Code="Y", Sort=100, Remark="是", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902389, TypeId=142307070906487, Value="登录", Code="1", Sort=100, Remark="登录", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902390, TypeId=142307070906487, Value="登出", Code="2", Sort=100, Remark="登出", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902391, TypeId=142307070906488, Value="目录", Code="0", Sort=100, Remark="目录", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902392, TypeId=142307070906488, Value="菜单", Code="1", Sort=100, Remark="菜单", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902393, TypeId=142307070906488, Value="按钮", Code="2", Sort=100, Remark="按钮", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902394, TypeId=142307070906489, Value="未发送", Code="0", Sort=100, Remark="未发送", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902395, TypeId=142307070906489, Value="发送成功", Code="1", Sort=100, Remark="发送成功", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902396, TypeId=142307070906489, Value="发送失败", Code="2", Sort=100, Remark="发送失败", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902397, TypeId=142307070906489, Value="失效", Code="3", Sort=100, Remark="失效", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902398, TypeId=142307070906490, Value="无", Code="0", Sort=100, Remark="无", Status=0 },
|
||||||
|
new SysDictData{Id=142307070902399, TypeId=142307070906490, Value="组件", Code="1", Sort=100, Remark="组件", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906437, TypeId=142307070906490, Value="内链", Code="2", Sort=100, Remark="内链", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906438, TypeId=142307070906490, Value="外链", Code="3", Sort=100, Remark="外链", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906439, TypeId=142307070906491, Value="系统权重", Code="1", Sort=100, Remark="系统权重", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906440, TypeId=142307070906491, Value="业务权重", Code="2", Sort=100, Remark="业务权重", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906441, TypeId=142307070906492, Value="全部数据", Code="1", Sort=100, Remark="全部数据", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906442, TypeId=142307070906492, Value="本部门及以下数据", Code="2", Sort=100, Remark="本部门及以下数据", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906443, TypeId=142307070906492, Value="本部门数据", Code="3", Sort=100, Remark="本部门数据", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906444, TypeId=142307070906492, Value="仅本人数据", Code="4", Sort=100, Remark="仅本人数据", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906445, TypeId=142307070906492, Value="自定义数据", Code="5", Sort=100, Remark="自定义数据", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906446, TypeId=142307070906493, Value="app", Code="1", Sort=100, Remark="app", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906447, TypeId=142307070906493, Value="pc", Code="2", Sort=100, Remark="pc", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906448, TypeId=142307070906493, Value="其他", Code="3", Sort=100, Remark="其他", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906449, TypeId=142307070906494, Value="其它", Code="0", Sort=100, Remark="其它", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906450, TypeId=142307070906494, Value="增加", Code="1", Sort=100, Remark="增加", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906451, TypeId=142307070906494, Value="删除", Code="2", Sort=100, Remark="删除", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906452, TypeId=142307070906494, Value="编辑", Code="3", Sort=100, Remark="编辑", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906453, TypeId=142307070906494, Value="更新", Code="4", Sort=100, Remark="更新", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906454, TypeId=142307070906494, Value="查询", Code="5", Sort=100, Remark="查询", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906455, TypeId=142307070906494, Value="详情", Code="6", Sort=100, Remark="详情", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906456, TypeId=142307070906494, Value="树", Code="7", Sort=100, Remark="树", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906457, TypeId=142307070906494, Value="导入", Code="8", Sort=100, Remark="导入", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906458, TypeId=142307070906494, Value="导出", Code="9", Sort=100, Remark="导出", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906459, TypeId=142307070906494, Value="授权", Code="10", Sort=100, Remark="授权", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906460, TypeId=142307070906494, Value="强退", Code="11", Sort=100, Remark="强退", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906461, TypeId=142307070906494, Value="清空", Code="12", Sort=100, Remark="清空", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906462, TypeId=142307070906494, Value="修改状态", Code="13", Sort=100, Remark="修改状态", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906463, TypeId=142307070906495, Value="阿里云", Code="1", Sort=100, Remark="阿里云", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906464, TypeId=142307070906495, Value="腾讯云", Code="2", Sort=100, Remark="腾讯云", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906465, TypeId=142307070906495, Value="minio", Code="3", Sort=100, Remark="minio", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906466, TypeId=142307070906495, Value="本地", Code="4", Sort=100, Remark="本地", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906467, TypeId=142307070910533, Value="运行", Code="1", Sort=100, Remark="运行", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906468, TypeId=142307070910533, Value="停止", Code="2", Sort=100, Remark="停止", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906469, TypeId=142307070910534, Value="通知", Code="1", Sort=100, Remark="通知", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906470, TypeId=142307070910534, Value="公告", Code="2", Sort=100, Remark="公告", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906471, TypeId=142307070910535, Value="草稿", Code="0", Sort=100, Remark="草稿", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906472, TypeId=142307070910535, Value="发布", Code="1", Sort=100, Remark="发布", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906473, TypeId=142307070910535, Value="撤回", Code="2", Sort=100, Remark="撤回", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906474, TypeId=142307070910535, Value="删除", Code="3", Sort=100, Remark="删除", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906475, TypeId=142307070910536, Value="是", Code="true", Sort=100, Remark="是", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906476, TypeId=142307070910536, Value="否", Code="false", Sort=100, Remark="否", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906477, TypeId=142307070910537, Value="下载压缩包", Code="1", Sort=100, Remark="下载压缩包", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906478, TypeId=142307070910537, Value="生成到本项目", Code="2", Sort=100, Remark="生成到本项目", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906479, TypeId=142307070910538, Value="GET", Code="1", Sort=100, Remark="GET", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906480, TypeId=142307070910538, Value="POST", Code="2", Sort=100, Remark="POST", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906481, TypeId=142307070910538, Value="PUT", Code="3", Sort=100, Remark="PUT", Status=0 },
|
||||||
|
new SysDictData{Id=142307070906482, TypeId=142307070910538, Value="DELETE", Code="4", Sort=100, Remark="DELETE", Status=0 },
|
||||||
|
|
||||||
|
new SysDictData{Id=142307070922830, TypeId=142307070922827, Value="输入框", Code="input", Sort=100, Remark="输入框", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922831, TypeId=142307070922827, Value="时间选择", Code="datepicker", Sort=100, Remark="时间选择", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922832, TypeId=142307070922827, Value="下拉框", Code="select", Sort=100, Remark="下拉框", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922833, TypeId=142307070922827, Value="单选框", Code="radio", Sort=100, Remark="单选框", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922834, TypeId=142307070922827, Value="开关", Code="switch", Sort=100, Remark="开关", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922835, TypeId=142307070922827, Value="多选框", Code="checkbox", Sort=100, Remark="多选框", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922836, TypeId=142307070922827, Value="数字输入框", Code="inputnumber", Sort=100, Remark="数字输入框", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922837, TypeId=142307070922827, Value="文本域", Code="textarea", Sort=100, Remark="文本域", Status=0 },
|
||||||
|
|
||||||
|
new SysDictData{Id=142307070922838, TypeId=142307070922828, Value="等于", Code="==", Sort=1, Remark="等于", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922839, TypeId=142307070922828, Value="模糊", Code="like", Sort=2, Remark="模糊", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922840, TypeId=142307070922828, Value="大于", Code=">", Sort=3, Remark="大于", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922841, TypeId=142307070922828, Value="小于", Code="<", Sort=4, Remark="小于", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922842, TypeId=142307070922828, Value="不等于", Code="!=", Sort=5, Remark="不等于", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922843, TypeId=142307070922828, Value="大于等于", Code=">=", Sort=6, Remark="大于等于", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922844, TypeId=142307070922828, Value="小于等于", Code="<=", Sort=7, Remark="小于等于", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922845, TypeId=142307070922828, Value="不为空", Code="isNotNull", Sort=8, Remark="不为空", Status=0 },
|
||||||
|
|
||||||
|
new SysDictData{Id=142307070922851, TypeId=142307070922829, Value="int", Code="int", Sort=100, Remark="int", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922846, TypeId=142307070922829, Value="long", Code="long", Sort=100, Remark="long", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922847, TypeId=142307070922829, Value="string", Code="string", Sort=100, Remark="string", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922850, TypeId=142307070922829, Value="bool", Code="bool", Sort=100, Remark="bool", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922852, TypeId=142307070922829, Value="double", Code="double", Sort=100, Remark="double", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922848, TypeId=142307070922829, Value="DateTime", Code="DateTime", Sort=100, Remark="DateTime", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922861, TypeId=142307070922829, Value="float", Code="float", Sort=100, Remark="float", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922862, TypeId=142307070922829, Value="decimal", Code="decimal", Sort=100, Remark="decimal", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922863, TypeId=142307070922829, Value="Guid", Code="Guid", Sort=100, Remark="Guid", Status=0 },
|
||||||
|
new SysDictData{Id=142307070922864, TypeId=142307070922829, Value="DateTimeOffset", Code="DateTimeOffset", Sort=100, Remark="DateTimeOffset", Status=0 },
|
||||||
|
|
||||||
|
//new SysDictData{Id=142307070922854, TypeId=142307070922853, Value="int", Code="int", Sort=100, Remark="int", Status=0 },
|
||||||
|
//new SysDictData{Id=142307070922855, TypeId=142307070922853, Value="long", Code="long", Sort=100, Remark="long", Status=0 },
|
||||||
|
//new SysDictData{Id=142307070922856, TypeId=142307070922853, Value="string", Code="string", Sort=100, Remark="string", Status=0 },
|
||||||
|
//new SysDictData{Id=142307070922858, TypeId=142307070922853, Value="bool", Code="bool", Sort=100, Remark="boolean", Status=0 },
|
||||||
|
//new SysDictData{Id=142307070922859, TypeId=142307070922853, Value="double", Code="double", Sort=100, Remark="double", Status=0 },
|
||||||
|
//new SysDictData{Id=142307070922860, TypeId=142307070922853, Value="DateTime", Code="DateTime", Sort=100, Remark="DateTime", Status=0 },
|
||||||
|
//new SysDictData{Id=142307070922865, TypeId=142307070922853, Value="float", Code="float", Sort=100, Remark="float", Status=0 },
|
||||||
|
//new SysDictData{Id=142307070922866, TypeId=142307070922853, Value="decimal", Code="decimal", Sort=100, Remark="decimal", Status=0 },
|
||||||
|
//new SysDictData{Id=142307070922867, TypeId=142307070922853, Value="Guid", Code="Guid", Sort=100, Remark="Guid", Status=0 },
|
||||||
|
//new SysDictData{Id=142307070922868, TypeId=142307070922853, Value="DateTimeOffset", Code="DateTimeOffset", Sort=100, Remark="DateTimeOffset", Status=0 },
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Api/Dilon.Core/SeedData/SysDictTypeSeedData.cs
Normal file
49
Api/Dilon.Core/SeedData/SysDictTypeSeedData.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统字典类型种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysDictTypeSeedData : IEntitySeedData<SysDictType>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysDictType> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysDictType{Id=142307070906483, Name="通用状态", Code="common_status", Sort=100, Remark="通用状态", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906484, Name="性别", Code="sex", Sort=100, Remark="性别字典", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906485, Name="常量的分类", Code="consts_type", Sort=100, Remark="常量的分类,用于区别一组配置", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906486, Name="是否", Code="yes_or_no", Sort=100, Remark="是否", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906487, Name="访问类型", Code="vis_type", Sort=100, Remark="访问类型", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906488, Name="菜单类型", Code="menu_type", Sort=100, Remark="菜单类型", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906489, Name="发送类型", Code="send_type", Sort=100, Remark="发送类型", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906490, Name="打开方式", Code="open_type", Sort=100, Remark="打开方式", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906491, Name="菜单权重", Code="menu_weight", Sort=100, Remark="菜单权重", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906492, Name="数据范围类型", Code="data_scope_type", Sort=100, Remark="数据范围类型", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906493, Name="短信发送来源", Code="sms_send_source", Sort=100, Remark="短信发送来源", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906494, Name="操作类型", Code="op_type", Sort=100, Remark="操作类型", Status=0 },
|
||||||
|
new SysDictType{Id=142307070906495, Name="文件存储位置", Code="file_storage_location", Sort=100, Remark="文件存储位置", Status=0 },
|
||||||
|
new SysDictType{Id=142307070910533, Name="运行状态", Code="run_status", Sort=100, Remark="定时任务运行状态", Status=0 },
|
||||||
|
new SysDictType{Id=142307070910534, Name="通知公告类型", Code="notice_type", Sort=100, Remark="通知公告类型", Status=0 },
|
||||||
|
new SysDictType{Id=142307070910535, Name="通知公告状态", Code="notice_status", Sort=100, Remark="通知公告状态", Status=0 },
|
||||||
|
new SysDictType{Id=142307070910536, Name="是否boolean", Code="yes_true_false", Sort=100, Remark="是否boolean", Status=0 },
|
||||||
|
new SysDictType{Id=142307070910537, Name="代码生成方式", Code="code_gen_create_type", Sort=100, Remark="代码生成方式", Status=0 },
|
||||||
|
new SysDictType{Id=142307070910538, Name="请求方式", Code="request_type", Sort=100, Remark="请求方式", Status=0 },
|
||||||
|
new SysDictType{Id=142307070922827, Name="代码生成作用类型", Code="code_gen_effect_type", Sort=100, Remark="代码生成作用类型", Status=0 },
|
||||||
|
new SysDictType{Id=142307070922828, Name="代码生成查询类型", Code="code_gen_query_type", Sort=100, Remark="代码生成查询类型", Status=0 },
|
||||||
|
new SysDictType{Id=142307070922829, Name="代码生成.NET类型", Code="code_gen_net_type", Sort=100, Remark="代码生成.NET类型", Status=0 },
|
||||||
|
//new SysDictType{Id=142307070922853, Name="字段类型", Code="filed_type", Sort=100, Remark="字段类型", Status=0 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Api/Dilon.Core/SeedData/SysEmpPosSeedData.cs
Normal file
30
Api/Dilon.Core/SeedData/SysEmpPosSeedData.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统员工职位表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysEmpPosSeedData : IEntitySeedData<SysEmpPos>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 员工种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysEmpPos> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysEmpPos{SysEmpId=142307070910551, SysPosId=142307070910547 },
|
||||||
|
new SysEmpPos{SysEmpId=142307070910551, SysPosId=142307070910548 },
|
||||||
|
new SysEmpPos{SysEmpId=142307070910552, SysPosId=142307070910549 },
|
||||||
|
new SysEmpPos{SysEmpId=142307070910553, SysPosId=142307070910547 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Api/Dilon.Core/SeedData/SysEmpSeedData.cs
Normal file
29
Api/Dilon.Core/SeedData/SysEmpSeedData.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统员工表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysEmpSeedData : IEntitySeedData<SysEmp>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 员工种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysEmp> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysEmp{Id=142307070910551, JobNum="D1001", OrgId=142307070910539, OrgName="华夏集团" },
|
||||||
|
new SysEmp{Id=142307070910552, JobNum="D1002", OrgId=142307070910539, OrgName="华夏集团" },
|
||||||
|
new SysEmp{Id=142307070910553, JobNum="D1003", OrgId=142307070910539, OrgName="华夏集团" }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
189
Api/Dilon.Core/SeedData/SysMenuSeedData.cs
Normal file
189
Api/Dilon.Core/SeedData/SysMenuSeedData.cs
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统菜单表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysMenuSeedData : IEntitySeedData<SysMenu>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysMenu> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysMenu{Id=142307070910560, Pid=0, Pids="[0],", Name="主控面板", Code="system_index", Type=0, Icon="home", Router="/", Component="RouteView", Application="system", OpenType=0, Visible="Y", Redirect="/analysis", Weight=1, Sort=1, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910561, Pid=142307070910560, Pids="[0],[142307070910560],", Name="分析页", Code="system_index_dashboard", Type=1, Router="analysis", Component="system/dashboard/Analysis", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910562, Pid=142307070910560, Pids="[0],[142307070910560],", Name="工作台", Code="system_index_workplace", Type=1, Router="workplace", Component="system/dashboard/Workplace", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070910563, Pid=0, Pids="[0],", Name="组织架构", Code="sys_mgr", Type=0, Icon="team", Router="/sys", Component="PageView", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910564, Pid=142307070910563, Pids="[0],[142307070910563],", Name="用户管理", Code="sys_user_mgr", Type=1, Router="/mgr_user", Component="system/user/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910565, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户查询", Code="sys_user_mgr_page", Type=2, Permission="sysUser:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910566, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户编辑", Code="sys_user_mgr_edit", Type=2, Permission="sysUser:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910567, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户增加", Code="sys_user_mgr_add", Type=2, Permission="sysUser:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070910568, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户删除", Code="sys_user_mgr_delete", Type=2, Permission="sysUser:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070910569, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户详情", Code="sys_user_mgr_detail", Type=2, Permission="sysUser:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910570, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户导出", Code="sys_user_mgr_export", Type=2, Permission="sysUser:export", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910571, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户选择器", Code="sys_user_mgr_selector", Type=2, Permission="sysUser:selector", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910572, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户授权角色", Code="sys_user_mgr_grant_role", Type=2, Permission="sysUser:grantRole", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910573, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户拥有角色", Code="sys_user_mgr_own_role", Type=2, Permission="sysUser:ownRole", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910574, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户授权数据", Code="sys_user_mgr_grant_data", Type=2, Permission="sysUser:grantData", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910575, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户拥有数据", Code="sys_user_mgr_own_data", Type=2, Permission="sysUser:ownData", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910576, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户更新信息", Code="sys_user_mgr_update_info", Type=2, Permission="sysUser:updateInfo", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910577, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户修改密码", Code="sys_user_mgr_update_pwd", Type=2, Permission="sysUser:updatePwd", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910578, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户修改状态", Code="sys_user_mgr_change_status", Type=2, Permission="sysUser:changeStatus", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910579, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户修改头像", Code="sys_user_mgr_update_avatar", Type=2, Permission="sysUser:updateAvatar", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070910580, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户重置密码", Code="sys_user_mgr_reset_pwd", Type=2, Permission="sysUser:resetPwd", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918777, Pid=142307070910564, Pids="[0],[142307070910563],[142307070910564],", Name="用户登录信息", Code="sys_user_mgr_login", Type=2, Permission="getLoginUser", Application="system", OpenType=0, Visible="N", Weight=1, Sort=100, Status=CommonStatus.DISABLE },
|
||||||
|
new SysMenu{Id=142307070910581, Pid=142307070910563, Pids="[0],[142307070910563],", Name="机构管理", Code="sys_org_mgr", Type=1, Router="/org", Component="system/org/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910582, Pid=142307070910581, Pids="[0],[142307070910563],[142307070910581],", Name="机构查询", Code="sys_org_mgr_page", Type=2, Permission="sysOrg:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910583, Pid=142307070910581, Pids="[0],[142307070910563],[142307070910581],", Name="机构列表", Code="sys_org_mgr_list", Type=2, Permission="sysOrg:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910584, Pid=142307070910581, Pids="[0],[142307070910563],[142307070910581],", Name="机构增加", Code="sys_org_mgr_add", Type=2, Permission="sysOrg:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910585, Pid=142307070910581, Pids="[0],[142307070910563],[142307070910581],", Name="机构编辑", Code="sys_org_mgr_edit", Type=2, Permission="sysOrg:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910586, Pid=142307070910581, Pids="[0],[142307070910563],[142307070910581],", Name="机构删除", Code="sys_org_mgr_delete", Type=2, Permission="sysOrg:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070910587, Pid=142307070910581, Pids="[0],[142307070910563],[142307070910581],", Name="机构详情", Code="sys_org_mgr_detail", Type=2, Permission="sysOrg:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910588, Pid=142307070910581, Pids="[0],[142307070910563],[142307070910581],", Name="机构树", Code="sys_org_mgr_tree", Type=2, Permission="sysOrg:tree", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070910589, Pid=142307070910563, Pids="[0],[142307070910563],", Name="职位管理", Code="sys_pos_mgr", Type=1, Router="/pos", Component="system/pos/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070910590, Pid=142307070910589, Pids="[0],[142307070910563],[142307070910589],", Name="职位查询", Code="sys_pos_mgr_page", Type=2, Permission="sysPos:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070910591, Pid=142307070910589, Pids="[0],[142307070910563],[142307070910589],", Name="职位列表", Code="sys_pos_mgr_list", Type=2, Permission="sysPos:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914629, Pid=142307070910589, Pids="[0],[142307070910563],[142307070910589],", Name="职位增加", Code="sys_pos_mgr_add", Type=2, Permission="sysPos:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914630, Pid=142307070910589, Pids="[0],[142307070910563],[142307070910589],", Name="职位编辑", Code="sys_pos_mgr_edit", Type=2, Permission="sysPos:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070914631, Pid=142307070910589, Pids="[0],[142307070910563],[142307070910589],", Name="职位删除", Code="sys_pos_mgr_delete", Type=2, Permission="sysPos:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914632, Pid=142307070910589, Pids="[0],[142307070910563],[142307070910589],", Name="职位详情", Code="sys_pos_mgr_detail", Type=2, Permission="sysPos:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070914633, Pid=0, Pids="[0],", Name="权限管理", Code="auth_manager", Type=0, Icon="safety-certificate", Router="/auth", Component="PageView", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914634, Pid=142307070914633, Pids="[0],[142307070914633],", Name="应用管理", Code="sys_app_mgr", Type=1, Router="/app", Component="system/app/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914635, Pid=142307070914634, Pids="[0],[142307070914633],[142307070914634],", Name="应用查询", Code="sys_app_mgr_page", Type=2, Permission="sysApp:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914636, Pid=142307070914634, Pids="[0],[142307070914633],[142307070914634],", Name="应用列表", Code="sys_app_mgr_list", Type=2, Permission="sysApp:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914637, Pid=142307070914634, Pids="[0],[142307070914633],[142307070914634],", Name="应用增加", Code="sys_app_mgr_add", Type=2, Permission="sysApp:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914638, Pid=142307070914634, Pids="[0],[142307070914633],[142307070914634],", Name="应用编辑", Code="sys_app_mgr_edit", Type=2, Permission="sysApp:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914639, Pid=142307070914634, Pids="[0],[142307070914633],[142307070914634],", Name="应用删除", Code="sys_app_mgr_delete", Type=2, Permission="sysApp:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914640, Pid=142307070914634, Pids="[0],[142307070914633],[142307070914634],", Name="应用详情", Code="sys_app_mgr_detail", Type=2, Permission="sysApp:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914641, Pid=142307070914634, Pids="[0],[142307070914633],[142307070914634],", Name="设为默认应用", Code="sys_app_mgr_set_as_default", Type=2, Permission="sysApp:setAsDefault", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914642, Pid=142307070914633, Pids="[0],[142307070914633],", Name="菜单管理", Code="sys_menu_mgr", Type=1, Router="/menu", Component="system/menu/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070914643, Pid=142307070914642, Pids="[0],[142307070914633],[142307070914642],", Name="菜单列表", Code="sys_menu_mgr_list", Type=2, Permission="sysMenu:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914644, Pid=142307070914642, Pids="[0],[142307070914633],[142307070914642],", Name="菜单增加", Code="sys_menu_mgr_add", Type=2, Permission="sysMenu:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914645, Pid=142307070914642, Pids="[0],[142307070914633],[142307070914642],", Name="菜单编辑", Code="sys_menu_mgr_edit", Type=2, Permission="sysMenu:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914646, Pid=142307070914642, Pids="[0],[142307070914633],[142307070914642],", Name="菜单删除", Code="sys_menu_mgr_delete", Type=2, Permission="sysMenu:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914647, Pid=142307070914642, Pids="[0],[142307070914633],[142307070914642],", Name="菜单详情", Code="sys_menu_mgr_detail", Type=2, Permission="sysMenu:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914648, Pid=142307070914642, Pids="[0],[142307070914633],[142307070914642],", Name="菜单授权树", Code="sys_menu_mgr_grant_tree", Type=2, Permission="sysMenu:treeForGrant", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914649, Pid=142307070914642, Pids="[0],[142307070914633],[142307070914642],", Name="菜单树", Code="sys_menu_mgr_tree", Type=2, Permission="sysMenu:tree", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914650, Pid=142307070914642, Pids="[0],[142307070914633],[142307070914642],", Name="菜单切换", Code="sys_menu_mgr_change", Type=2, Permission="sysMenu:change", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914651, Pid=142307070914633, Pids="[0],[142307070914633],", Name="角色管理", Code="sys_role_mgr", Type=1, Router="/role", Component="system/role/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070914652, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色查询", Code="sys_role_mgr_page", Type=2, Permission="sysRole:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914653, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色增加", Code="sys_role_mgr_add", Type=2, Permission="sysRole:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914654, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色编辑", Code="sys_role_mgr_edit", Type=2, Permission="sysRole:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914655, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色删除", Code="sys_role_mgr_delete", Type=2, Permission="sysRole:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914656, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色详情", Code="sys_role_mgr_detail", Type=2, Permission="sysRole:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914657, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色下拉", Code="sys_role_mgr_drop_down", Type=2, Permission="sysRole:dropDown", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914658, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色授权菜单", Code="sys_role_mgr_grant_menu", Type=2, Permission="sysRole:grantMenu", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914659, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色拥有菜单", Code="sys_role_mgr_own_menu", Type=2, Permission="sysRole:ownMenu", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914660, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色授权数据", Code="sys_role_mgr_grant_data", Type=2, Permission="sysRole:grantData", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914661, Pid=142307070914651, Pids="[0],[142307070914633],[142307070914651],", Name="角色拥有数据", Code="sys_role_mgr_own_data", Type=2, Permission="sysRole:ownData", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070914662, Pid=0, Pids="[0],", Name="开发管理", Code="system_tools", Type=0, Icon="euro", Router="/tools", Component="PageView", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914663, Pid=142307070914662, Pids="[0],[142307070914662],", Name="系统配置", Code="system_tools_config", Type=1, Router="/config", Component="system/config/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914664, Pid=142307070914663, Pids="[0],[142307070914662],[142307070914663],", Name="配置查询", Code="system_tools_config_page", Type=2, Permission="sysConfig:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914665, Pid=142307070914663, Pids="[0],[142307070914662],[142307070914663],", Name="配置列表", Code="system_tools_config_list", Type=2, Permission="sysConfig:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914666, Pid=142307070914663, Pids="[0],[142307070914662],[142307070914663],", Name="配置增加", Code="system_tools_config_add", Type=2, Permission="sysConfig:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914667, Pid=142307070914663, Pids="[0],[142307070914662],[142307070914663],", Name="配置编辑", Code="system_tools_config_edit", Type=2, Permission="sysConfig:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914668, Pid=142307070914663, Pids="[0],[142307070914662],[142307070914663],", Name="配置删除", Code="system_tools_config_delete", Type=2, Permission="sysConfig:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914669, Pid=142307070914663, Pids="[0],[142307070914662],[142307070914663],", Name="配置详情", Code="system_tools_config_detail", Type=2, Permission="sysConfig:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914670, Pid=142307070914663, Pids="[0],[142307070914662],[142307070914663],", Name="设为默认应用", Code="sys_app_mgr_set_as_default", Type=2, Permission="sysApp:setAsDefault", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914671, Pid=142307070914662, Pids="[0],[142307070914662],", Name="邮件发送", Code="sys_email_mgr", Type=1, Router="/email", Component="system/email/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070914672, Pid=142307070914671, Pids="[0],[142307070914662],[142307070914671],", Name="发送文本邮件", Code="sys_email_mgr_send_email", Type=2, Permission="email:sendEmail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914673, Pid=142307070914671, Pids="[0],[142307070914662],[142307070914671],", Name="发送html邮件", Code="sys_email_mgr_send_email_html", Type=2, Permission="email:sendEmailHtml", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914674, Pid=142307070914662, Pids="[0],[142307070914662],", Name="短信管理", Code="sys_sms_mgr", Type=1, Router="/sms", Component="system/sms/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070914675, Pid=142307070914674, Pids="[0],[142307070914662],[142307070914674],", Name="短信发送查询", Code="sys_sms_mgr_page", Type=2, Permission="sms:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914676, Pid=142307070914674, Pids="[0],[142307070914662],[142307070914674],", Name="发送验证码短信", Code="sys_sms_mgr_send_login_message", Type=2, Permission="sms:sendLoginMessage", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914677, Pid=142307070914674, Pids="[0],[142307070914662],[142307070914674],", Name="验证短信验证码", Code="sys_sms_mgr_validate_message", Type=2, Permission="sms:validateMessage", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914678, Pid=142307070914662, Pids="[0],[142307070914662],", Name="字典管理", Code="sys_dict_mgr", Type=1, Router="/dict", Component="system/dict/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070914679, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典类型查询", Code="sys_dict_mgr_dict_type_page", Type=2, Permission="sysDictType:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914680, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典类型列表", Code="sys_dict_mgr_dict_type_list", Type=2, Permission="sysDictType:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914681, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典类型增加", Code="sys_dict_mgr_dict_type_add", Type=2, Permission="sysDictType:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914682, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典类型删除", Code="sys_dict_mgr_dict_type_delete", Type=2, Permission="sysDictType:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914683, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典类型编辑", Code="sys_dict_mgr_dict_type_edit", Type=2, Permission="sysDictType:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914684, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典类型详情", Code="sys_dict_mgr_dict_type_detail", Type=2, Permission="sysDictType:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914685, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典类型下拉", Code="sys_dict_mgr_dict_type_drop_down", Type=2, Permission="sysDictType:dropDown", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914686, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典类型修改状态", Code="sys_dict_mgr_dict_type_change_status", Type=2, Permission="sysDictType:changeStatus", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070914687, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典值查询", Code="sys_dict_mgr_dict_page", Type=2, Permission="sysDictData:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918725, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典值列表", Code="sys_dict_mgr_dict_list", Type=2, Permission="sysDictData:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918726, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典值增加", Code="sys_dict_mgr_dict_add", Type=2, Permission="sysDictData:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918727, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典值删除", Code="sys_dict_mgr_dict_delete", Type=2, Permission="sysDictData:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918728, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典值编辑", Code="sys_dict_mgr_dict_edit", Type=2, Permission="sysDictData:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918729, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典值详情", Code="sys_role_mgr_grant_data", Type=2, Permission="sysDictData:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918730, Pid=142307070914678, Pids="[0],[142307070914662],[142307070914678],", Name="字典值修改状态", Code="sys_dict_mgr_dict_change_status", Type=2, Permission="sysDictData:changeStatus", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918731, Pid=142307070914662, Pids="[0],[142307070914662],", Name="接口文档", Code="sys_swagger_mgr", Type=1, Router="/swagger", Component="Iframe", Application="system", OpenType=2, Visible="Y", Link="http://127.0.0.1:5566/", Weight=1, Sort=100, Status=0},
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070918732, Pid=0, Pids="[0],", Name="日志管理", Code="sys_log_mgr", Type=0, Icon="read", Router="/log", Component="PageView", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918733, Pid=142307070918732, Pids="[0],[142307070918732],", Name="访问日志", Code="sys_log_mgr_vis_log", Type=1, Router="/vislog", Component="system/log/vislog/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918734, Pid=142307070918733, Pids="[0],[142307070918732],[142307070918733],", Name="访问日志查询", Code="sys_log_mgr_vis_log_page", Type=2, Permission="sysVisLog:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918735, Pid=142307070918733, Pids="[0],[142307070918732],[142307070918733],", Name="访问日志清空", Code="sys_log_mgr_vis_log_delete", Type=2, Permission="sysVisLog:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918736, Pid=142307070918732, Pids="[0],[142307070918732],", Name="操作日志", Code="sys_log_mgr_op_log", Type=1, Router="/oplog", Component="system/log/oplog/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070918737, Pid=142307070918736, Pids="[0],[142307070918732],[142307070918736],", Name="操作日志查询", Code="sys_log_mgr_op_log_page", Type=2, Permission="sysOpLog:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918738, Pid=142307070918736, Pids="[0],[142307070918732],[142307070918736],", Name="操作日志清空", Code="sys_log_mgr_op_log_delete", Type=2, Permission="sysOpLog:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070918739, Pid=0, Pids="[0],", Name="系统监控", Code="sys_monitor_mgr", Type=0, Icon="deployment-unit", Router="/monitor", Component="PageView", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918740, Pid=142307070918739, Pids="[0],[142307070918739],", Name="服务监控", Code="sys_monitor_mgr_machine_monitor", Type=1, Router="/machine", Component="system/machine/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918741, Pid=142307070918740, Pids="[0],[142307070918739],[142307070918740],", Name="服务监控查询", Code="sys_monitor_mgr_machine_monitor_query", Type=2, Permission="sysMachine:query", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918742, Pid=142307070918739, Pids="[0],[142307070918739],", Name="在线用户", Code="sys_monitor_mgr_online_user", Type=1, Router="/onlineUser", Component="system/onlineUser/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070918743, Pid=142307070918742, Pids="[0],[142307070918739],[142307070918742],", Name="在线用户列表", Code="sys_monitor_mgr_online_user_list", Type=2, Permission="sysOnlineUser:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918744, Pid=142307070918742, Pids="[0],[142307070918739],[142307070918742],", Name="在线用户强退", Code="sys_monitor_mgr_online_user_force_exist", Type=2, Permission="sysOnlineUser:forceExist", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918745, Pid=142307070918739, Pids="[0],[142307070918739],", Name="数据监控", Code="sys_monitor_mgr_druid", Type=1, Router="/druid", Component="Iframe", Application="system", OpenType=2, Visible="N", Link="http://localhost:82/druid/login.html", Weight=1, Sort=100, Status=0},
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070918746, Pid=0, Pids="[0],", Name="通知公告", Code="sys_notice", Type=0, Icon="sound", Router="/notice", Component="PageView", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918747, Pid=142307070918746, Pids="[0],[142307070918746],", Name="公告管理", Code="sys_notice_mgr", Type=1, Router="/notice", Component="system/notice/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918748, Pid=142307070918747, Pids="[0],[142307070918746],[142307070918747],", Name="公告查询", Code="sys_notice_mgr_page", Type=2, Permission="sysNotice:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918749, Pid=142307070918747, Pids="[0],[142307070918746],[142307070918747],", Name="公告增加", Code="sys_notice_mgr_add", Type=2, Permission="sysNotice:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918750, Pid=142307070918747, Pids="[0],[142307070918746],[142307070918747],", Name="公告编辑", Code="sys_notice_mgr_edit", Type=2, Permission="sysNotice:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918751, Pid=142307070918747, Pids="[0],[142307070918746],[142307070918747],", Name="公告删除", Code="sys_notice_mgr_delete", Type=2, Permission="sysNotice:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918752, Pid=142307070918747, Pids="[0],[142307070918746],[142307070918747],", Name="公告查看", Code="sys_notice_mgr_detail", Type=2, Permission="sysNotice:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918753, Pid=142307070918747, Pids="[0],[142307070918746],[142307070918747],", Name="公告修改状态", Code="sys_notice_mgr_changeStatus", Type=2, Permission="sysNotice:changeStatus", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918754, Pid=142307070918746, Pids="[0],[142307070918746],", Name="已收公告", Code="sys_notice_mgr_received", Type=1, Router="/noticeReceived", Component="system/noticeReceived/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0},
|
||||||
|
new SysMenu{Id=142307070918755, Pid=142307070918754, Pids="[0],[142307070918746],[142307070918754],", Name="已收公告查询", Code="sys_notice_mgr_received_page", Type=2, Permission="sysNotice:received", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070918756, Pid=0, Pids="[0],", Name="文件管理", Code="sys_file_mgr", Type=0, Icon="file", Router="/file", Component="PageView", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918757, Pid=142307070918756, Pids="[0],[142307070918756],", Name="系统文件", Code="sys_file_mgr_sys_file", Type=1, Router="/file", Component="system/file/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918758, Pid=142307070918757, Pids="[0],[142307070918756],[142307070918757],", Name="文件查询", Code="sys_file_mgr_sys_file_page", Type=2, Permission="sysFileInfo:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918759, Pid=142307070918757, Pids="[0],[142307070918756],[142307070918757],", Name="文件列表", Code="sys_file_mgr_sys_file_list", Type=2, Permission="sysFileInfo:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918760, Pid=142307070918757, Pids="[0],[142307070918756],[142307070918757],", Name="文件删除", Code="sys_file_mgr_sys_file_delete", Type=2, Permission="sysFileInfo:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918761, Pid=142307070918757, Pids="[0],[142307070918756],[142307070918757],", Name="文件详情", Code="sys_file_mgr_sys_file_detail", Type=2, Permission="sysFileInfo:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918762, Pid=142307070918757, Pids="[0],[142307070918756],[142307070918757],", Name="文件上传", Code="sys_file_mgr_sys_file_upload", Type=2, Permission="sysFileInfo:upload", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918763, Pid=142307070918757, Pids="[0],[142307070918756],[142307070918757],", Name="文件下载", Code="sys_file_mgr_sys_file_download", Type=2, Permission="sysFileInfo:download", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918764, Pid=142307070918757, Pids="[0],[142307070918756],[142307070918757],", Name="图片预览", Code="sys_file_mgr_sys_file_preview", Type=2, Permission="sysFileInfo:preview", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070918765, Pid=0, Pids="[0],", Name="定时任务", Code="sys_timers", Type=0, Icon="dashboard", Router="/timers", Component="PageView", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918766, Pid=142307070918765, Pids="[0],[142307070918765],", Name="任务管理", Code="sys_timers_mgr", Type=1, Router="/timers", Component="system/timers/index", Application="system", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918767, Pid=142307070918766, Pids="[0],[142307070918765],[142307070918766],", Name="定时任务查询", Code="sys_timers_mgr_page", Type=2, Permission="sysTimers:page", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918768, Pid=142307070918766, Pids="[0],[142307070918765],[142307070918766],", Name="定时任务列表", Code="sys_timers_mgr_list", Type=2, Permission="sysTimers:list", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918769, Pid=142307070918766, Pids="[0],[142307070918765],[142307070918766],", Name="定时任务详情", Code="sys_timers_mgr_detail", Type=2, Permission="sysTimers:detail", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918770, Pid=142307070918766, Pids="[0],[142307070918765],[142307070918766],", Name="定时任务增加", Code="sys_timers_mgr_add", Type=2, Permission="sysTimers:add", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918771, Pid=142307070918766, Pids="[0],[142307070918765],[142307070918766],", Name="定时任务删除", Code="sys_timers_mgr_delete", Type=2, Permission="sysTimers:delete", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918772, Pid=142307070918766, Pids="[0],[142307070918765],[142307070918766],", Name="定时任务编辑", Code="sys_timers_mgr_edit", Type=2, Permission="sysTimers:edit", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918773, Pid=142307070918766, Pids="[0],[142307070918765],[142307070918766],", Name="定时任务可执行列表", Code="sys_timers_mgr_get_action_classes", Type=2, Permission="sysTimers:getActionClasses", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918774, Pid=142307070918766, Pids="[0],[142307070918765],[142307070918766],", Name="定时任务启动", Code="sys_timers_mgr_start", Type=2, Permission="sysTimers:start", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918775, Pid=142307070918766, Pids="[0],[142307070918765],[142307070918766],", Name="定时任务关闭", Code="sys_timers_mgr_stop", Type=2, Permission="sysTimers:stop", Application="system", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070918776, Pid=0, Pids="[0],", Name="代码生成", Code="code_gen", Type=1, Icon="thunderbolt", Router="/codeGenerate/index", Component="gen/codeGenerate/index", Application="system_tool", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070922870, Pid=0, Pids="[0],", Name="表单设计", Code="form_design", Type=1, Icon="robot", Router="/formDesign/index", Component="system/formDesign/index", Application="system_tool", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
|
||||||
|
new SysMenu{Id=142307070918782, Pid=0, Pids="[0],", Name="SaaS租户", Code="sys_tenant", Type=1, Icon="switcher", Router="/tenant", Component="PageView", Application="advanced", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070918783, Pid=142307070918782, Pids="[0],[142307070918782],", Name="租户管理", Code="sys_tenant_mgr", Type=1, Router="/tenant", Component="system/tenant/index", Application="advanced", OpenType=1, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070922821, Pid=142307070918783, Pids="[0],[142307070918782],[142307070918783],", Name="租户查询", Code="sys_tenant_mgr_page", Type=2, Permission="sysTenant:page", Application="advanced", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070922822, Pid=142307070918783, Pids="[0],[142307070918782],[142307070918783],", Name="租户详情", Code="sys_tenant_mgr_detail", Type=2, Permission="sysTenant:detail", Application="advanced", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070922823, Pid=142307070918783, Pids="[0],[142307070918782],[142307070918783],", Name="租户增加", Code="sys_tenant_mgr_add", Type=2, Permission="sysTenant:add", Application="advanced", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070922824, Pid=142307070918783, Pids="[0],[142307070918782],[142307070918783],", Name="租户删除", Code="sys_tenant_mgr_delete", Type=2, Permission="sysTenant:delete", Application="advanced", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
new SysMenu{Id=142307070922825, Pid=142307070918783, Pids="[0],[142307070918782],[142307070918783],", Name="租户编辑", Code="sys_tenant_mgr_edit", Type=2, Permission="sysTenant:edit", Application="advanced", OpenType=0, Visible="Y", Weight=1, Sort=100, Status=0 },
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
34
Api/Dilon.Core/SeedData/SysOrgSeedData.cs
Normal file
34
Api/Dilon.Core/SeedData/SysOrgSeedData.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统机构表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysOrgSeedData : IEntitySeedData<SysOrg>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysOrg> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysOrg{Id=142307070910539, Pid=0, Pids="[0],", Name="华夏集团", Code="hxjt", Sort=100, Remark="华夏集团", Status=0 },
|
||||||
|
new SysOrg{Id=142307070910540, Pid=142307070910539, Pids="[0],[142307070910539],", Name="华夏集团北京分公司", Code="hxjt_bj", Sort=100, Remark="华夏集团北京分公司", Status=0 },
|
||||||
|
new SysOrg{Id=142307070910541, Pid=142307070910539, Pids="[0],[142307070910539],", Name="华夏集团成都分公司", Code="hxjt_cd", Sort=100, Remark="华夏集团成都分公司", Status=0 },
|
||||||
|
new SysOrg{Id=142307070910542, Pid=142307070910540, Pids="[0],[142307070910539],[142307070910540],", Name="研发部", Code="hxjt_bj_yfb", Sort=100, Remark="华夏集团北京分公司研发部", Status=0 },
|
||||||
|
new SysOrg{Id=142307070910543, Pid=142307070910540, Pids="[0],[142307070910539],[142307070910540],", Name="企划部", Code="hxjt_bj_qhb", Sort=100, Remark="华夏集团北京分公司企划部", Status=0 },
|
||||||
|
new SysOrg{Id=142307070910544, Pid=142307070910541, Pids="[0],[142307070910539],[142307070910541],", Name="市场部", Code="hxjt_cd_scb", Sort=100, Remark="华夏集团成都分公司市场部", Status=0 },
|
||||||
|
new SysOrg{Id=142307070910545, Pid=142307070910541, Pids="[0],[142307070910539],[142307070910541],", Name="财务部", Code="hxjt_cd_cwb", Sort=100, Remark="华夏集团成都分公司财务部", Status=0 },
|
||||||
|
new SysOrg{Id=142307070910546, Pid=142307070910544, Pids="[0],[142307070910539],[142307070910541],[142307070910544],", Name="市场部二部", Code="hxjt_cd_scb_2b", Sort=100, Remark="华夏集团成都分公司市场部二部", Status=0 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Api/Dilon.Core/SeedData/SysPosSeedData.cs
Normal file
30
Api/Dilon.Core/SeedData/SysPosSeedData.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统职位表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysPosSeedData : IEntitySeedData<SysPos>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysPos> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysPos{Id=142307070910547, Name="总经理", Code="zjl", Sort=100, Remark="总经理", Status=0 },
|
||||||
|
new SysPos{Id=142307070910548, Name="副总经理", Code="fzjl", Sort=101, Remark="副总经理", Status=0 },
|
||||||
|
new SysPos{Id=142307070910549, Name="部门经理", Code="bmjl", Sort=102, Remark="部门经理", Status=0 },
|
||||||
|
new SysPos{Id=142307070910550, Name="工作人员", Code="gzry", Sort=103, Remark="工作人员", Status=0 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
Api/Dilon.Core/SeedData/SysRoleSeedData.cs
Normal file
28
Api/Dilon.Core/SeedData/SysRoleSeedData.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统角色表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysRoleSeedData : IEntitySeedData<SysRole>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysRole> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysRole{Id=142307070910554, Name="系统管理员", Code="sys_manager_role", Sort=100, DataScopeType=1, Remark="系统管理员", Status=0 },
|
||||||
|
new SysRole{Id=142307070910555, Name="普通用户", Code="common_role", Sort=101, DataScopeType=5, Remark="普通用户", Status=0 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
Api/Dilon.Core/SeedData/SysTenantSeedData.cs
Normal file
35
Api/Dilon.Core/SeedData/SysTenantSeedData.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
public class SysTenantSeedData : IEntitySeedData<SysTenant, MultiTenantDbContextLocator>
|
||||||
|
{
|
||||||
|
public IEnumerable<SysTenant> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new List<SysTenant>
|
||||||
|
{
|
||||||
|
new SysTenant
|
||||||
|
{
|
||||||
|
Id = 142307070918780,
|
||||||
|
Name = "默认租户",
|
||||||
|
Host = "localhost:5566",
|
||||||
|
CreatedTime = DateTime.Parse("2021-04-03 00:00:00"),
|
||||||
|
Connection = "Data Source=./Dilon.db",
|
||||||
|
Email = "zuohuaijun@163.com",
|
||||||
|
Phone = "18020030720"
|
||||||
|
},
|
||||||
|
new SysTenant
|
||||||
|
{
|
||||||
|
Id = 142307070918781,
|
||||||
|
Name = "其他租户",
|
||||||
|
Host = "localhost:5588",
|
||||||
|
CreatedTime = DateTime.Parse("2021-04-03 00:00:00"),
|
||||||
|
Connection = "Data Source=./Dilon_1.db"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
Api/Dilon.Core/SeedData/SysTimerSeedData.cs
Normal file
28
Api/Dilon.Core/SeedData/SysTimerSeedData.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using Dilon.Core.Service;
|
||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统任务调度表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysTimerSeedData : IEntitySeedData<SysTimer>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysTimer> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysTimer{Id=142307070910556, JobName="百度api", JobGroup="默认分组", BeginTime=DateTimeOffset.Parse("2021-03-21 00:00:00+08:00"), Interval=30, TriggerType=TriggerTypeEnum.Simple, RequestUrl="https://www.baidu.com", RequestType=RequestTypeEnum.Post, IsDeleted=false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Api/Dilon.Core/SeedData/SysUserSeedData.cs
Normal file
29
Api/Dilon.Core/SeedData/SysUserSeedData.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统用户表种子数据
|
||||||
|
/// </summary>
|
||||||
|
public class SysUserSeedData : IEntitySeedData<SysUser>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="dbContextLocator"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysUser> HasData(DbContext dbContext, Type dbContextLocator)
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new SysUser{Id=142307070910551, Account="superAdmin", Name="superAdmin", Password="e10adc3949ba59abbe56e057f20f883e", AdminType=AdminType.SuperAdmin, Birthday=DateTimeOffset.Parse("1986-07-26 00:00:00"), Phone="18020030720", Sex=1, IsDeleted=false },
|
||||||
|
new SysUser{Id=142307070910552, Account="admin", Name="admin", Password="e10adc3949ba59abbe56e057f20f883e", AdminType=AdminType.SuperAdmin, Birthday=DateTimeOffset.Parse("1986-07-26 00:00:00"), Phone="18020030720", Sex=2, IsDeleted=false },
|
||||||
|
new SysUser{Id=142307070910553, Account="zuohuaijun", Name="zuohuaijun", Password="e10adc3949ba59abbe56e057f20f883e", AdminType=AdminType.None, Birthday=DateTimeOffset.Parse("1986-07-26 00:00:00"), Phone="18020030720", Sex=1, IsDeleted=false }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
100
Api/Dilon.Core/Service/App/Dto/AppInput.cs
Normal file
100
Api/Dilon.Core/Service/App/Dto/AppInput.cs
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Dilon.Core.Service
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统应用参数
|
||||||
|
/// </summary>
|
||||||
|
public class AppInput : PageInputBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public virtual string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
public virtual string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图标
|
||||||
|
/// </summary>
|
||||||
|
public virtual string Icon { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图标颜色
|
||||||
|
/// </summary>
|
||||||
|
public virtual string Color { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否默认激活(Y-是,N-否),只能有一个系统默认激活
|
||||||
|
/// 用户登录后默认展示此系统菜单
|
||||||
|
/// </summary>
|
||||||
|
public string Active { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态(字典 0正常 1停用 2删除)
|
||||||
|
/// </summary>
|
||||||
|
public CommonStatus Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
public int Sort { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AddAppInput : AppInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "应用名称不能为空")]
|
||||||
|
public override string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "应用编码不能为空")]
|
||||||
|
public override string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图标
|
||||||
|
/// </summary>
|
||||||
|
public override string Icon { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图标颜色
|
||||||
|
/// </summary>
|
||||||
|
[RegularExpression("^#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}$", ErrorMessage = "颜色格式不正确")]
|
||||||
|
public override string Color { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeleteAppInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 应用Id
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "应用Id不能为空")]
|
||||||
|
public long Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UpdateAppInput : AppInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 应用Id
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "应用Id不能为空")]
|
||||||
|
public long Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class QueryAppInput : DeleteAppInput
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetDefaultAppInput : DeleteAppInput
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
33
Api/Dilon.Core/Service/App/Dto/AppOutput.cs
Normal file
33
Api/Dilon.Core/Service/App/Dto/AppOutput.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
namespace Dilon.Core.Service
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统应用参数
|
||||||
|
/// </summary>
|
||||||
|
public class AppOutput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 应用Id
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否默认
|
||||||
|
/// </summary>
|
||||||
|
public string Active { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
public int Sort { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Api/Dilon.Core/Service/App/ISysAppService.cs
Normal file
18
Api/Dilon.Core/Service/App/ISysAppService.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core.Service
|
||||||
|
{
|
||||||
|
public interface ISysAppService
|
||||||
|
{
|
||||||
|
Task AddApp(AddAppInput input);
|
||||||
|
Task DeleteApp(DeleteAppInput input);
|
||||||
|
Task<SysApp> GetApp([FromQuery] QueryAppInput input);
|
||||||
|
Task<dynamic> GetAppList([FromQuery] AppInput input);
|
||||||
|
Task<dynamic> GetLoginApps(long userId);
|
||||||
|
Task<dynamic> QueryAppPageList([FromQuery] AppInput input);
|
||||||
|
Task SetAsDefault(SetDefaultAppInput input);
|
||||||
|
Task UpdateApp(UpdateAppInput input);
|
||||||
|
Task ChangeUserAppStatus(UpdateAppInput input);
|
||||||
|
}
|
||||||
|
}
|
||||||
198
Api/Dilon.Core/Service/App/SysAppService.cs
Normal file
198
Api/Dilon.Core/Service/App/SysAppService.cs
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Furion.DatabaseAccessor.Extensions;
|
||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.DynamicApiController;
|
||||||
|
using Furion.FriendlyException;
|
||||||
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dilon.Core.Service
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统应用服务
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Name = "App", Order = 100)]
|
||||||
|
public class SysAppService : ISysAppService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private readonly IRepository<SysApp> _sysAppRep; // 应用表仓储
|
||||||
|
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly ISysMenuService _sysMenuService;
|
||||||
|
|
||||||
|
public SysAppService(IRepository<SysApp> sysAppRep,
|
||||||
|
IUserManager userManager,
|
||||||
|
ISysMenuService sysMenuService)
|
||||||
|
{
|
||||||
|
_sysAppRep = sysAppRep;
|
||||||
|
_userManager = userManager;
|
||||||
|
_sysMenuService = sysMenuService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取用户应用相关信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[NonAction]
|
||||||
|
public async Task<dynamic> GetLoginApps(long userId)
|
||||||
|
{
|
||||||
|
var apps = _sysAppRep.DetachedEntities.Where(u => u.Status == (int)CommonStatus.ENABLE);
|
||||||
|
if (!_userManager.SuperAdmin)
|
||||||
|
{
|
||||||
|
var appCodeList = await _sysMenuService.GetUserMenuAppCodeList(userId);
|
||||||
|
apps = apps.Where(u => appCodeList.Contains(u.Code));
|
||||||
|
}
|
||||||
|
var appList = await apps.OrderBy(u => u.Sort).Select(u => new AppOutput
|
||||||
|
{
|
||||||
|
Code = u.Code,
|
||||||
|
Name = u.Name,
|
||||||
|
Active = u.Active
|
||||||
|
}).ToListAsync(); // .OrderByDescending(u => u.Active) // 将激活的放到第一个
|
||||||
|
|
||||||
|
//// 默认激活第一个应用
|
||||||
|
//if (appList != null && appList.Count > 0 && appList[0].Active != YesOrNot.Y.ToString())
|
||||||
|
// appList[0].Active = YesOrNot.Y.ToString();
|
||||||
|
return appList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分页查询系统应用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("/sysApp/page")]
|
||||||
|
public async Task<dynamic> QueryAppPageList([FromQuery] AppInput input)
|
||||||
|
{
|
||||||
|
var name = !string.IsNullOrEmpty(input.Name?.Trim());
|
||||||
|
var code = !string.IsNullOrEmpty(input.Code?.Trim());
|
||||||
|
var apps = await _sysAppRep.DetachedEntities
|
||||||
|
.Where((name, u => EF.Functions.Like(u.Name, $"%{input.Name.Trim()}%")),
|
||||||
|
(code, u => EF.Functions.Like(u.Code, $"%{input.Code.Trim()}%")))
|
||||||
|
//.Where(u => u.Status == (int)CommonStatus.ENABLE)
|
||||||
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
||||||
|
return XnPageResult<SysApp>.PageResult(apps);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 增加系统应用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("/sysApp/add")]
|
||||||
|
public async Task AddApp(AddAppInput input)
|
||||||
|
{
|
||||||
|
var isExist = await _sysAppRep.DetachedEntities.AnyAsync(u => u.Name == input.Name || u.Code == input.Code);
|
||||||
|
if (isExist)
|
||||||
|
throw Oops.Oh(ErrorCode.D5000);
|
||||||
|
|
||||||
|
if (input.Active == YesOrNot.Y.ToString())
|
||||||
|
{
|
||||||
|
isExist = await _sysAppRep.DetachedEntities.AnyAsync(u => u.Active == input.Active);
|
||||||
|
if (isExist)
|
||||||
|
throw Oops.Oh(ErrorCode.D5001);
|
||||||
|
}
|
||||||
|
|
||||||
|
var app = input.Adapt<SysApp>();
|
||||||
|
await app.InsertAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除系统应用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("/sysApp/delete")]
|
||||||
|
public async Task DeleteApp(DeleteAppInput input)
|
||||||
|
{
|
||||||
|
var app = await _sysAppRep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
||||||
|
// 该应用下是否有状态为正常的菜单
|
||||||
|
var hasMenu = await _sysMenuService.HasMenu(app.Code);
|
||||||
|
if (hasMenu)
|
||||||
|
throw Oops.Oh(ErrorCode.D5002);
|
||||||
|
|
||||||
|
await app.DeleteAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新系统应用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("/sysApp/edit")]
|
||||||
|
public async Task UpdateApp(UpdateAppInput input)
|
||||||
|
{
|
||||||
|
var isExist = await _sysAppRep.DetachedEntities.AnyAsync(u => (u.Name == input.Name || u.Code == input.Code) && u.Id != input.Id);
|
||||||
|
if (isExist)
|
||||||
|
throw Oops.Oh(ErrorCode.D5000);
|
||||||
|
|
||||||
|
if (input.Active == YesOrNot.Y.ToString())
|
||||||
|
{
|
||||||
|
isExist = await _sysAppRep.DetachedEntities.AnyAsync(u => u.Active == input.Active);
|
||||||
|
if (isExist)
|
||||||
|
throw Oops.Oh(ErrorCode.D5001);
|
||||||
|
}
|
||||||
|
|
||||||
|
var app = input.Adapt<SysApp>();
|
||||||
|
await app.UpdateExcludeAsync(new[] { nameof(SysApp.Status) }, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取系统应用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("/sysApp/detail")]
|
||||||
|
public async Task<SysApp> GetApp([FromQuery] QueryAppInput input)
|
||||||
|
{
|
||||||
|
return await _sysAppRep.DetachedEntities.FirstOrDefaultAsync(u => u.Id == input.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取系统应用列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("/sysApp/list")]
|
||||||
|
public async Task<dynamic> GetAppList([FromQuery] AppInput input)
|
||||||
|
{
|
||||||
|
return await _sysAppRep.DetachedEntities.Where(u => u.Status == (int)CommonStatus.ENABLE).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设为默认应用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("/sysApp/setAsDefault")]
|
||||||
|
public async Task SetAsDefault(SetDefaultAppInput input)
|
||||||
|
{
|
||||||
|
var apps = await _sysAppRep.Where(u => u.Status == (int)CommonStatus.ENABLE).ToListAsync();
|
||||||
|
apps.ForEach(u =>
|
||||||
|
{
|
||||||
|
u.Active = YesOrNot.N.ToString();
|
||||||
|
});
|
||||||
|
|
||||||
|
var app = await _sysAppRep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
||||||
|
app.Active = YesOrNot.Y.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("/sysApp/changeStatus")]
|
||||||
|
public async Task ChangeUserAppStatus(UpdateAppInput input)
|
||||||
|
{
|
||||||
|
if (!Enum.IsDefined(typeof(CommonStatus), input.Status))
|
||||||
|
throw Oops.Oh(ErrorCode.D3005);
|
||||||
|
|
||||||
|
var app = await _sysAppRep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
||||||
|
app.Status = input.Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
227
Api/Dilon.Core/Service/Auth/AuthService.cs
Normal file
227
Api/Dilon.Core/Service/Auth/AuthService.cs
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
using Furion;
|
||||||
|
using Furion.DatabaseAccessor;
|
||||||
|
using Furion.DatabaseAccessor.Extensions;
|
||||||
|
using Furion.DataEncryption;
|
||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.DynamicApiController;
|
||||||
|
using Furion.FriendlyException;
|
||||||
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UAParser;
|
||||||
|
|
||||||
|
namespace Dilon.Core.Service
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 登录授权相关服务
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Name = "Auth", Order = 160)]
|
||||||
|
public class AuthService : IAuthService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private readonly IRepository<SysUser> _sysUserRep; // 用户表仓储
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IUserManager _userManager; // 用户管理
|
||||||
|
|
||||||
|
private readonly ISysUserService _sysUserService; // 系统用户服务
|
||||||
|
private readonly ISysEmpService _sysEmpService; // 系统员工服务
|
||||||
|
private readonly ISysRoleService _sysRoleService; // 系统角色服务
|
||||||
|
private readonly ISysMenuService _sysMenuService; // 系统菜单服务
|
||||||
|
private readonly ISysAppService _sysAppService; // 系统应用服务
|
||||||
|
private readonly IClickWordCaptcha _captchaHandle;// 验证码服务
|
||||||
|
private readonly ISysConfigService _sysConfigService; // 验证码服务
|
||||||
|
|
||||||
|
public AuthService(IRepository<SysUser> sysUserRep,
|
||||||
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
IUserManager userManager,
|
||||||
|
ISysUserService sysUserService,
|
||||||
|
ISysEmpService sysEmpService,
|
||||||
|
ISysRoleService sysRoleService,
|
||||||
|
ISysMenuService sysMenuService,
|
||||||
|
ISysAppService sysAppService,
|
||||||
|
IClickWordCaptcha captchaHandle,
|
||||||
|
ISysConfigService sysConfigService)
|
||||||
|
{
|
||||||
|
_sysUserRep = sysUserRep;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_userManager = userManager;
|
||||||
|
_sysUserService = sysUserService;
|
||||||
|
_sysEmpService = sysEmpService;
|
||||||
|
_sysRoleService = sysRoleService;
|
||||||
|
_sysMenuService = sysMenuService;
|
||||||
|
_sysAppService = sysAppService;
|
||||||
|
_captchaHandle = captchaHandle;
|
||||||
|
_sysConfigService = sysConfigService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户登录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <remarks>默认用户名/密码:admin/admin</remarks>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("/login")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<string> LoginAsync([Required] LoginInput input)
|
||||||
|
{
|
||||||
|
// 获取加密后的密码
|
||||||
|
var encryptPasswod = MD5Encryption.Encrypt(input.Password);
|
||||||
|
|
||||||
|
// 判断用户名和密码是否正确
|
||||||
|
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Account.Equals(input.Account) && u.Password.Equals(encryptPasswod));
|
||||||
|
_ = user ?? throw Oops.Oh(ErrorCode.D1000);
|
||||||
|
|
||||||
|
// 验证账号是否被冻结
|
||||||
|
if (user.Status == CommonStatus.DISABLE)
|
||||||
|
throw Oops.Oh(ErrorCode.D1017);
|
||||||
|
|
||||||
|
// 生成Token令牌
|
||||||
|
//var accessToken = await _jwtBearerManager.CreateTokenAdmin(user);
|
||||||
|
var accessToken = JWTEncryption.Encrypt(new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{ ClaimConst.CLAINM_USERID, user.Id },
|
||||||
|
{ ClaimConst.CLAINM_ACCOUNT, user.Account },
|
||||||
|
{ ClaimConst.CLAINM_NAME, user.Name },
|
||||||
|
{ ClaimConst.CLAINM_SUPERADMIN, user.AdminType },
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设置Swagger自动登录
|
||||||
|
_httpContextAccessor.SigninToSwagger(accessToken);
|
||||||
|
|
||||||
|
// 生成刷新Token令牌
|
||||||
|
var refreshToken = JWTEncryption.GenerateRefreshToken(accessToken, 30);
|
||||||
|
|
||||||
|
// 设置刷新Token令牌
|
||||||
|
_httpContextAccessor.HttpContext.Response.Headers["x-access-token"] = refreshToken;
|
||||||
|
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前登录用户信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("/getLoginUser")]
|
||||||
|
public async Task<LoginOutput> GetLoginUserAsync()
|
||||||
|
{
|
||||||
|
var user = _userManager.User;
|
||||||
|
var userId = user.Id;
|
||||||
|
|
||||||
|
var httpContext = App.GetService<IHttpContextAccessor>().HttpContext;
|
||||||
|
var loginOutput = user.Adapt<LoginOutput>();
|
||||||
|
|
||||||
|
loginOutput.LastLoginTime = user.LastLoginTime = DateTimeOffset.Now;
|
||||||
|
var ip = httpContext.Request.Headers["X-Real-IP"].FirstOrDefault();
|
||||||
|
loginOutput.LastLoginIp = user.LastLoginIp = string.IsNullOrEmpty(user.LastLoginIp) ? httpContext.GetRemoteIpAddressToIPv4() : ip;
|
||||||
|
|
||||||
|
//var ipInfo = IpTool.Search(loginOutput.LastLoginIp);
|
||||||
|
//loginOutput.LastLoginAddress = ipInfo.Country + ipInfo.Province + ipInfo.City + "[" + ipInfo.NetworkOperator + "][" + ipInfo.Latitude + ipInfo.Longitude + "]";
|
||||||
|
|
||||||
|
var clent = Parser.GetDefault().Parse(httpContext.Request.Headers["User-Agent"]);
|
||||||
|
loginOutput.LastLoginBrowser = clent.UA.Family + clent.UA.Major;
|
||||||
|
loginOutput.LastLoginOs = clent.OS.Family + clent.OS.Major;
|
||||||
|
|
||||||
|
// 员工信息
|
||||||
|
loginOutput.LoginEmpInfo = await _sysEmpService.GetEmpInfo(userId);
|
||||||
|
|
||||||
|
// 角色信息
|
||||||
|
loginOutput.Roles = await _sysRoleService.GetUserRoleList(userId);
|
||||||
|
|
||||||
|
// 权限信息
|
||||||
|
loginOutput.Permissions = await _sysMenuService.GetLoginPermissionList(userId);
|
||||||
|
|
||||||
|
// 数据范围信息(机构Id集合)
|
||||||
|
loginOutput.DataScopes = await _sysUserService.GetUserDataScopeIdList(userId);
|
||||||
|
|
||||||
|
// 具备应用信息(多系统,默认激活一个,可根据系统切换菜单),返回的结果中第一个为激活的系统
|
||||||
|
loginOutput.Apps = await _sysAppService.GetLoginApps(userId);
|
||||||
|
|
||||||
|
// 菜单信息
|
||||||
|
if (loginOutput.Apps.Count > 0)
|
||||||
|
{
|
||||||
|
var defaultActiveAppCode = loginOutput.Apps.FirstOrDefault(u => u.Active == YesOrNot.Y.ToString()).Code; // loginOutput.Apps[0].Code;
|
||||||
|
loginOutput.Menus = await _sysMenuService.GetLoginMenusAntDesign(userId, defaultActiveAppCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 增加登录日志
|
||||||
|
await new SysLogVis
|
||||||
|
{
|
||||||
|
Name = "登录",
|
||||||
|
Success = YesOrNot.Y.ToString(),
|
||||||
|
Message = "登录成功",
|
||||||
|
Ip = loginOutput.LastLoginIp,
|
||||||
|
Browser = loginOutput.LastLoginBrowser,
|
||||||
|
Os = loginOutput.LastLoginOs,
|
||||||
|
VisType = 1,
|
||||||
|
VisTime = loginOutput.LastLoginTime,
|
||||||
|
Account = loginOutput.Account
|
||||||
|
}.InsertAsync();
|
||||||
|
|
||||||
|
return loginOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 退出
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("/logout")]
|
||||||
|
public async Task LogoutAsync()
|
||||||
|
{
|
||||||
|
_httpContextAccessor.SignoutToSwagger();
|
||||||
|
//_httpContextAccessor.HttpContext.Response.Headers["access-token"] = "invalid token";
|
||||||
|
|
||||||
|
// 增加退出日志
|
||||||
|
await new SysLogVis
|
||||||
|
{
|
||||||
|
Name = "退出",
|
||||||
|
Success = YesOrNot.Y.ToString(),
|
||||||
|
Message = "退出成功",
|
||||||
|
VisType = 2
|
||||||
|
}.InsertAsync();
|
||||||
|
|
||||||
|
await Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取验证码开关
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("/getCaptchaOpen")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<bool> GetCaptchaOpen()
|
||||||
|
{
|
||||||
|
return await _sysConfigService.GetCaptchaOpenFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取验证码(默认点选模式)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("/captcha/get")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[NonUnify]
|
||||||
|
public async Task<dynamic> GetCaptcha()
|
||||||
|
{
|
||||||
|
// 图片大小要与前端保持一致(坐标范围)
|
||||||
|
return await Task.FromResult(_captchaHandle.CreateCaptchaImage(_captchaHandle.RandomCode(6), 310, 155));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 校验验证码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("/captcha/check")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
[NonUnify]
|
||||||
|
public async Task<dynamic> VerificationCode(ClickWordCaptchaInput input)
|
||||||
|
{
|
||||||
|
return await Task.FromResult(_captchaHandle.CheckCode(input));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
Api/Dilon.Core/Service/Auth/Dto/LoginInput.cs
Normal file
26
Api/Dilon.Core/Service/Auth/Dto/LoginInput.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using Furion.DependencyInjection;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Dilon.Core.Service
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 登录输入参数
|
||||||
|
/// </summary>
|
||||||
|
[SkipScan]
|
||||||
|
public class LoginInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户名
|
||||||
|
/// </summary>
|
||||||
|
/// <example>superAdmin</example>
|
||||||
|
[Required(ErrorMessage = "用户名不能为空"), MinLength(3, ErrorMessage = "用户名不能少于3位字符")]
|
||||||
|
public string Account { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 密码
|
||||||
|
/// </summary>
|
||||||
|
/// <example>123456</example>
|
||||||
|
[Required(ErrorMessage = "密码不能为空"), MinLength(5, ErrorMessage = "密码不能少于5位字符")]
|
||||||
|
public string Password { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
163
Api/Dilon.Core/Service/Auth/Dto/LoginOutput.cs
Normal file
163
Api/Dilon.Core/Service/Auth/Dto/LoginOutput.cs
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
using Furion.DependencyInjection;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Dilon.Core.Service
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户登录输出参数
|
||||||
|
/// </summary>
|
||||||
|
[SkipScan]
|
||||||
|
public class LoginOutput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主键
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 账号
|
||||||
|
/// </summary>
|
||||||
|
public string Account { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 昵称
|
||||||
|
/// </summary>
|
||||||
|
public string NickName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 姓名
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 头像
|
||||||
|
/// </summary>
|
||||||
|
public string Avatar { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生日
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset Birthday { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 性别(字典 1男 2女)
|
||||||
|
/// </summary>
|
||||||
|
public int Sex { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 邮箱
|
||||||
|
/// </summary>
|
||||||
|
public String Email { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 手机
|
||||||
|
/// </summary>
|
||||||
|
public String Phone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电话
|
||||||
|
/// </summary>
|
||||||
|
public String Tel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 管理员类型(0超级管理员 1非管理员)
|
||||||
|
/// </summary>
|
||||||
|
public int AdminType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后登陆IP
|
||||||
|
/// </summary>
|
||||||
|
public string LastLoginIp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后登陆时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset LastLoginTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后登陆地址
|
||||||
|
/// </summary>
|
||||||
|
public string LastLoginAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后登陆所用浏览器
|
||||||
|
/// </summary>
|
||||||
|
public string LastLoginBrowser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后登陆所用系统
|
||||||
|
/// </summary>
|
||||||
|
public string LastLoginOs { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 员工信息
|
||||||
|
/// </summary>
|
||||||
|
public EmpOutput LoginEmpInfo { get; set; } = new EmpOutput();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 具备应用信息
|
||||||
|
/// </summary>
|
||||||
|
public List<AppOutput> Apps { get; set; } = new List<AppOutput>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 角色信息
|
||||||
|
/// </summary>
|
||||||
|
public List<RoleOutput> Roles { get; set; } = new List<RoleOutput>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 权限信息
|
||||||
|
/// </summary>
|
||||||
|
public List<string> Permissions { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 登录菜单信息---AntDesign版本菜单
|
||||||
|
/// </summary>
|
||||||
|
public List<AntDesignTreeNode> Menus { get; set; } = new List<AntDesignTreeNode>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据范围(机构)信息
|
||||||
|
/// </summary>
|
||||||
|
public List<long> DataScopes { get; set; } = new List<long>();
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 租户信息
|
||||||
|
///// </summary>
|
||||||
|
//public List<long> Tenants { get; set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 密码
|
||||||
|
///// </summary>
|
||||||
|
//public string Password { get; set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 账户过期
|
||||||
|
///// </summary>
|
||||||
|
//public string AccountNonExpired { get; set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 凭证过期
|
||||||
|
///// </summary>
|
||||||
|
//public string CredentialsNonExpired { get; set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 账户锁定
|
||||||
|
///// </summary>
|
||||||
|
//public bool AccountNonLocked { get; set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 用户名称
|
||||||
|
///// </summary>
|
||||||
|
//public string UserName { get; set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 权限
|
||||||
|
///// </summary>
|
||||||
|
//public List<long> Authorities { get; set; } = new List<long>();
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 是否启动
|
||||||
|
///// </summary>
|
||||||
|
//public bool Enabled { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user