初始化

This commit is contained in:
cli 2025-03-11 10:24:11 +08:00
commit eaabdc3593
165 changed files with 10196 additions and 0 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
**/bin
**/obj
**/logs

271
.gitignore vendored Normal file
View File

@ -0,0 +1,271 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
.DS_Store
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/logs
/aspnet-core/services/host/Lion.AbpPro.IdentityServer/Logs
/aspnet-core/services/host/Lion.AbpPro.IdentityServer/Logs
/aspnet-core/gateways/Lion.AbpPro.WebGateway/appsettings.Production.json
/aspnet-core/services/host/Lion.AbpPro.IdentityServer/appsettings.Production.json
/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Logs/logs.txt
/nupkgs
/aspnet-core/Lion.AbpPro.sln.DotSettings
/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/logs
/docs/site
/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/Logs
/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Logs
/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/wwwroot/libs
/templates/abp-vnext-pro-nuget-all/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/logs
/templates/abp-vnext-pro-nuget-simplify/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/logs
/vben28/pnpm-lock.yaml
/host/JiShe.IOT.HttpApi.Host/logs

View File

@ -0,0 +1,20 @@
@ECHO off
cls
ECHO Deleting all BIN and OBJ folders...
ECHO.
FOR /d /r . %%d in (bin,obj) DO (
IF EXIST "%%d" (
ECHO %%d | FIND /I "\node_modules\" > Nul && (
ECHO.Skipping: %%d
) || (
ECHO.Deleting: %%d
rd /s/q "%%d"
)
)
)
ECHO.
ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit.
pause > nul

View File

@ -0,0 +1,41 @@
<Project>
<!-- Lion.AbpPro包-->
<ItemGroup>
<PackageReference Update="Lion.AbpPro.Core" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.Shared.Hosting.Microservices" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.Shared.Hosting.Gateways" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.BasicManagement.Application" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.BasicManagement.Application.Contracts" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.BasicManagement.Domain" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.BasicManagement.Domain.Shared" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.BasicManagement.EntityFrameworkCore" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.BasicManagement.HttpApi" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.BasicManagement.HttpApi.Client" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.NotificationManagement.Application" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.NotificationManagement.Application.Contracts" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.NotificationManagement.Domain" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.NotificationManagement.Domain.Shared" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.NotificationManagement.EntityFrameworkCore" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.NotificationManagement.HttpApi" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.NotificationManagement.HttpApi.Client" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.DataDictionaryManagement.Application" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.DataDictionaryManagement.Application.Contracts" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.DataDictionaryManagement.Domain" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.DataDictionaryManagement.Domain.Shared" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.DataDictionaryManagement.EntityFrameworkCore" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.DataDictionaryManagement.HttpApi" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.DataDictionaryManagement.HttpApi.Client" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.LanguageManagement.Application" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.LanguageManagement.Application.Contracts" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.LanguageManagement.Domain" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.LanguageManagement.Domain.Shared" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.LanguageManagement.EntityFrameworkCore" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.LanguageManagement.HttpApi" Version="9.0.6.10"/>
<PackageReference Update="Lion.AbpPro.LanguageManagement.HttpApi.Client" Version="9.0.6.10"/>
</ItemGroup>
</Project>

View File

@ -0,0 +1,26 @@
<Project>
<ItemGroup>
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.0"/>
<PackageReference Update="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0"/>
<PackageReference Update="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0"/>
<PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0" />
<PackageReference Update="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="9.0.0"/>
<PackageReference Update="Microsoft.EntityFrameworkCore.Proxies" Version="9.0.0"/>
<PackageReference Update="Microsoft.AspNetCore.SignalR.StackExchangeRedis" Version="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.Http.Polly" Version="9.0.0"/>
<PackageReference Update="Microsoft.EntityFrameworkCore.Abstractions" Version="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0"/>
<PackageReference Update="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.Http" Version="9.0.0"/>
<PackageReference Update="Microsoft.AspNetCore.Mvc.Core" Version="2.2.0"/>
<PackageReference Update="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0"/>
<PackageReference Update="Microsoft.CSharp" Version="4.12.0"/>
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="4.12.0"/>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
</ItemGroup>
</Project>

View File

@ -0,0 +1,94 @@
<Project>
<ItemGroup>
<PackageReference Update="Volo.Abp.Autofac" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Threading" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Json" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Validation" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Ddd.Domain" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AutoMapper" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.ObjectMapping" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Identity.AspNetCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Caching" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.BlobStoring.Aliyun" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.BackgroundJobs" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Authorization.Abstractions" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.BackgroundJobs.HangFire" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore.SignalR" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.TestBase" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.EntityFrameworkCore.MySQL" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Identity.EntityFrameworkCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore.Mvc.Contracts" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Account.Web" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Caching.StackExchangeRedis" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.EntityFrameworkCore.PostgreSql" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore.Serilog" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Swashbuckle" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Ddd.Application" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Ddd.Application.Contracts" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Authorization" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Dapper" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore.Mvc" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Http.Client" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.MongoDB" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.EntityFrameworkCore.Sqlite" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Http.Client.IdentityModel" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore.MultiTenancy" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Account.Application" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Identity.Application" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.PermissionManagement.Application" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.TenantManagement.Application" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.FeatureManagement.Application" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.SettingManagement.Application" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.ObjectExtending" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Account.Application.Contracts" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Identity.Application.Contracts" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.PermissionManagement.Application.Contracts" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.TenantManagement.Application.Contracts" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.FeatureManagement.Application.Contracts" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.SettingManagement.Application.Contracts" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Emailing" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.PermissionManagement.Domain.Identity" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.BackgroundJobs.Domain" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AuditLogging.Domain" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.TenantManagement.Domain" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.FeatureManagement.Domain" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.SettingManagement.Domain" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Identity.Domain" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Identity.Domain.Shared" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.BackgroundJobs.Domain.Shared" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AuditLogging.Domain.Shared" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.TenantManagement.Domain.Shared" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.FeatureManagement.Domain.Shared" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.PermissionManagement.Domain.Shared" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.SettingManagement.Domain.Shared" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Account.HttpApi" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Identity.HttpApi" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.PermissionManagement.HttpApi" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.TenantManagement.HttpApi" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.FeatureManagement.HttpApi" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.SettingManagement.HttpApi" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Account.HttpApi.Client" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Identity.HttpApi.Client" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.PermissionManagement.HttpApi.Client" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.TenantManagement.HttpApi.Client" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.FeatureManagement.HttpApi.Client" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.SettingManagement.HttpApi.Client" Version="9.0.4"/>
<PackageReference Update="Volo.Abp" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Core" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.EntityFrameworkCore" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore.TestBase" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.EventBus" Version="9.0.4"/>
<PackageReference Update="Volo.Abp.Localization" Version="9.0.4" />
<PackageReference Update="Volo.Abp.DistributedLocking" Version="9.0.4" />
</ItemGroup>
</Project>

103
Directory.Build.targets Normal file
View File

@ -0,0 +1,103 @@
<Project>
<Import Project="Directory.Build.Microsoft.targets"/>
<Import Project="Directory.Build.Volo.targets"/>
<Import Project="Directory.Build.Lion.targets"/>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>1.0.0</Version>
<Description>Abp vNext Pro</Description>
<NoWarn>$(NoWarn);CS1591;CS0436;NU1504</NoWarn>
<AbpProjectType>app</AbpProjectType>
<ImplicitUsings>true</ImplicitUsings>
<Authors>WangJunZzz</Authors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RepositoryUrl>https://github.com/WangJunZzz/abp-vnext-pro</RepositoryUrl>
<PackageIcon>icon.png</PackageIcon>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath=""/>
</ItemGroup>
<ItemGroup>
<!-- Ocelot 网关-->
<PackageReference Update="Ocelot" Version="18.0.0"/>
<PackageReference Update="Ocelot.Provider.Consul" Version="18.0.0"/>
<PackageReference Update="Ocelot.Provider.Polly" Version="18.0.0"/>
<!-- FreeSql-->
<PackageReference Update="FreeSql" Version="3.5.104"/>
<PackageReference Update="FreeSql.Provider.MysqlConnector" Version="3.5.104"/>
<PackageReference Update="FreeSql.Provider.Sqlite" Version="3.2.806"/>
<!-- 单元测试包-->
<PackageReference Update="xunit" Version="2.9.2"/>
<PackageReference Update="xunit.extensibility.execution" Version="2.9.2"/>
<PackageReference Update="xunit.runner.visualstudio" Version="2.8.2"/>
<PackageReference Update="NSubstitute" Version="5.1.0"/>
<PackageReference Update="Shouldly" Version="4.2.1"/>
<PackageReference Update="coverlet.collector" Version="6.0.0"/>
<PackageReference Update="JunitXml.TestLogger" Version="3.0.134"/>
<PackageReference Update="AutoFixture.Xunit2" Version="4.18.1"/>
<!-- Hangfire 后台任务-->
<PackageReference Update="Hangfire.Redis.StackExchange" Version="1.9.3"/>
<!-- CAP 分布式事务-->
<PackageReference Update="DotNetCore.CAP" Version="8.0.0"/>
<PackageReference Update="DotNetCore.CAP.Dashboard" Version="8.0.0"/>
<PackageReference Update="DotNetCore.CAP.Mysql" Version="8.0.0"/>
<PackageReference Update="DotNetCore.CAP.RabbitMQ" Version="8.0.0"/>
<PackageReference Update="DotNetCore.CAP.InMemoryStorage" Version="8.0.0"/>
<PackageReference Update="Savorboard.CAP.InMemoryMessageQueue" Version="7.0.0"/>
<!-- Swagger-->
<PackageReference Update="Swashbuckle.AspNetCore.SwaggerUI" Version="6.8.1"/>
<PackageReference Update="Swashbuckle.AspNetCore" Version="6.8.1"/>
<PackageReference Update="Swashbuckle.AspNetCore.Annotations" Version="6.5.0"/>
<!-- Serilog 日志-->
<PackageReference Update="Serilog" Version="4.0.2"/>
<PackageReference Update="Serilog.Extensions.Logging" Version="8.0.0"/>
<PackageReference Update="Serilog.Sinks.Async" Version="2.0.0"/>
<PackageReference Update="Serilog.Sinks.File" Version="6.0.0"/>
<PackageReference Update="Serilog.Sinks.Console" Version="6.0.0"/>
<PackageReference Update="Serilog.AspNetCore" Version="8.0.2"/>
<PackageReference Update="Serilog.Exceptions" Version="8.4.0"/>
<PackageReference Update="Serilog.Settings.Configuration" Version="8.0.2"/>
<PackageReference Update="Serilog.Sinks.Elasticsearch" Version="9.0.3"/>
<!-- Magicodes 导入导出Excel-->
<PackageReference Update="Magicodes.IE.Excel" Version="2.7.4.5"/>
<PackageReference Update="Magicodes.IE.Excel.AspNetCore" Version="2.7.4.5"/>
<!-- MiniProfiler 查看接口耗时,sql耗时-->
<PackageReference Update="MiniProfiler.AspNetCore.Mvc" Version="4.3.8"/>
<PackageReference Update="MiniProfiler.EntityFrameworkCore" Version="4.3.8"/>
<PackageReference Update="MiniProfiler.Shared" Version="4.3.8"/>
<!-- Polly 重试机制-->
<PackageReference Update="Polly" Version="8.5.0"/>
<!-- Octokit 邮件-->
<PackageReference Update="Octokit" Version="9.0.0"/>
<!-- Humanizer 中文格式包-->
<PackageReference Update="Humanizer.Core.zh-Hans" Version="2.14.1"/>
<!-- NEST ElasticSearch-->
<PackageReference Update="NEST" Version="7.17.5"/>
<PackageReference Update="WebApiClientCore" Version="2.1.5" />
<!-- redis分布式锁-->
<PackageReference Update="DistributedLock.Redis" Version="1.0.3" />
</ItemGroup>
</Project>

46
Dockerfile Normal file
View File

@ -0,0 +1,46 @@
# FROM mcr.microsoft.com/dotnet/aspnet:8.0
# # 创建目录
# RUN mkdir /app
# COPY publish /app
# # 设置工作目录
# WORKDIR /app
# # 暴露80端口
# EXPOSE 80
# # 设置时区 .net6 才有这个问题
# ENV TZ=Asia/Shanghai
# # 设置环境变量
# ENV ASPNETCORE_ENVIRONMENT=Production
# ENTRYPOINT ["dotnet", "JiShe.IOT.HttpApi.Host.dll"]
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
ENV TZ=Asia/Shanghai
ENV ASPNETCORE_ENVIRONMENT=Production
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY . .
WORKDIR "/src/host/JiShe.IOT.HttpApi.Host"
RUN dotnet build "JiShe.IOT.HttpApi.Host.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "JiShe.IOT.HttpApi.Host.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "JiShe.IOT.HttpApi.Host.dll"]

147
JiShe.IOT.sln Normal file
View File

@ -0,0 +1,147 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31410.414
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.Domain", "src\JiShe.IOT.Domain\JiShe.IOT.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.Application", "src\JiShe.IOT.Application\JiShe.IOT.Application.csproj", "{1A94A50E-06DC-43C1-80B5-B662820EC3EB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.EntityFrameworkCore", "src\JiShe.IOT.EntityFrameworkCore\JiShe.IOT.EntityFrameworkCore.csproj", "{C956DD76-69C8-4A9C-83EA-D17DF83340FD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA9AC87F-097E-4F15-8393-4BC07735A5B0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{04DBDB01-70F4-4E06-B468-8F87850B22BE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.Application.Tests", "test\JiShe.IOT.Application.Tests\JiShe.IOT.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.Domain.Shared", "src\JiShe.IOT.Domain.Shared\JiShe.IOT.Domain.Shared.csproj", "{42F719ED-8413-4895-B5B4-5AB56079BC66}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.Application.Contracts", "src\JiShe.IOT.Application.Contracts\JiShe.IOT.Application.Contracts.csproj", "{520659C8-C734-4298-A3DA-B539DB9DFC0B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.HttpApi", "src\JiShe.IOT.HttpApi\JiShe.IOT.HttpApi.csproj", "{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.HttpApi.Client", "src\JiShe.IOT.HttpApi.Client\JiShe.IOT.HttpApi.Client.csproj", "{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.EntityFrameworkCore.Tests", "test\JiShe.IOT.EntityFrameworkCore.Tests\JiShe.IOT.EntityFrameworkCore.Tests.csproj", "{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.TestBase", "test\JiShe.IOT.TestBase\JiShe.IOT.TestBase.csproj", "{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.Domain.Tests", "test\JiShe.IOT.Domain.Tests\JiShe.IOT.Domain.Tests.csproj", "{E512F4D9-9375-480F-A2F6-A46509F9D824}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.HttpApi.Client.ConsoleTestApp", "test\JiShe.IOT.HttpApi.Client.ConsoleTestApp\JiShe.IOT.HttpApi.Client.ConsoleTestApp.csproj", "{EF480016-9127-4916-8735-D2466BDBC582}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.DbMigrator", "src\JiShe.IOT.DbMigrator\JiShe.IOT.DbMigrator.csproj", "{AA94D832-1CCC-4715-95A9-A483F23A1A5D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0.Solution Items", "0.Solution Items", "{2C4A6DB8-8D9E-42E6-B7C3-1EDB7B3DE22E}"
ProjectSection(SolutionItems) = preProject
NuGet.Config = NuGet.Config
Directory.Build.Microsoft.targets = Directory.Build.Microsoft.targets
Directory.Build.targets = Directory.Build.targets
Directory.Build.Volo.targets = Directory.Build.Volo.targets
Directory.Build.Lion.targets = Directory.Build.Lion.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{8C1B8C6C-C518-4290-B070-622CCA6004DA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.HttpApi.Host", "host\JiShe.IOT.HttpApi.Host\JiShe.IOT.HttpApi.Host.csproj", "{FB20372D-6C96-4733-9AAC-12522F15CAA6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IOT.FreeSqlRepository", "src\JiShe.IOT.FreeSqlRepository\JiShe.IOT.FreeSqlRepository.csproj", "{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.IOT.WebGateway", "host\JiShe.IOT.WebGateway\JiShe.IOT.WebGateway.csproj", "{9C009501-0ED2-4930-B020-C8D06FE28E44}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.Build.0 = Release|Any CPU
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.Build.0 = Release|Any CPU
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.Build.0 = Release|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.Build.0 = Release|Any CPU
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.Build.0 = Release|Any CPU
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Release|Any CPU.Build.0 = Release|Any CPU
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Release|Any CPU.Build.0 = Release|Any CPU
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.Build.0 = Release|Any CPU
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.Build.0 = Release|Any CPU
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.Build.0 = Release|Any CPU
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.Build.0 = Release|Any CPU
{EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF480016-9127-4916-8735-D2466BDBC582}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF480016-9127-4916-8735-D2466BDBC582}.Release|Any CPU.Build.0 = Release|Any CPU
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Release|Any CPU.Build.0 = Release|Any CPU
{FB20372D-6C96-4733-9AAC-12522F15CAA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB20372D-6C96-4733-9AAC-12522F15CAA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB20372D-6C96-4733-9AAC-12522F15CAA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB20372D-6C96-4733-9AAC-12522F15CAA6}.Release|Any CPU.Build.0 = Release|Any CPU
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}.Release|Any CPU.Build.0 = Release|Any CPU
{9C009501-0ED2-4930-B020-C8D06FE28E44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C009501-0ED2-4930-B020-C8D06FE28E44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C009501-0ED2-4930-B020-C8D06FE28E44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C009501-0ED2-4930-B020-C8D06FE28E44}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{1A94A50E-06DC-43C1-80B5-B662820EC3EB} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{C956DD76-69C8-4A9C-83EA-D17DF83340FD} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{50B2631D-129C-47B3-A587-029CCD6099BC} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{42F719ED-8413-4895-B5B4-5AB56079BC66} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{520659C8-C734-4298-A3DA-B539DB9DFC0B} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{E512F4D9-9375-480F-A2F6-A46509F9D824} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{EF480016-9127-4916-8735-D2466BDBC582} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{AA94D832-1CCC-4715-95A9-A483F23A1A5D} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{FB20372D-6C96-4733-9AAC-12522F15CAA6} = {8C1B8C6C-C518-4290-B070-622CCA6004DA}
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{9C009501-0ED2-4930-B020-C8D06FE28E44} = {8C1B8C6C-C518-4290-B070-622CCA6004DA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}
EndGlobalSection
EndGlobal

7
NuGet.Config Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

View File

@ -0,0 +1,10 @@
namespace JiShe.IOT.Controllers
{
public class HomeController : AbpController
{
public ActionResult Index()
{
return Redirect("/Login");
}
}
}

View File

@ -0,0 +1,21 @@
namespace JiShe.IOT.Extensions.Hangfire;
public class AutoDeleteAfterSuccessAttributer : JobFilterAttribute, IApplyStateFilter
{
private readonly TimeSpan _deleteAfter;
public AutoDeleteAfterSuccessAttributer(TimeSpan timeSpan)
{
_deleteAfter = timeSpan;
}
public void OnStateApplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
{
context.JobExpirationTimeout = _deleteAfter;
}
public void OnStateUnapplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
{
}
}

View File

@ -0,0 +1,78 @@
namespace JiShe.IOT.Extensions.Hangfire
{
/// <summary>
/// Cron类型
/// </summary>
public static class CronType
{
/// <summary>
/// 周期性为分钟的任务
/// </summary>
/// <param name="interval">执行周期的间隔,默认为每分钟一次</param>
/// <returns></returns>
public static string Minute(int interval = 1)
{
return "1 0/" + interval.ToString() + " * * * ? ";
}
/// <summary>
/// 周期性为小时的任务
/// </summary>
/// <param name="minute">第几分钟开始,默认为第一分钟</param>
/// <param name="interval">执行周期的间隔,默认为每小时一次</param>
/// <returns></returns>
public static string Hour(int minute = 1, int interval = 1)
{
return "1 " + minute + " 0/" + interval.ToString() + " * * ? ";
}
/// <summary>
/// 周期性为天的任务
/// </summary>
/// <param name="hour">第几小时开始默认从1点开始</param>
/// <param name="minute">第几分钟开始默认从第1分钟开始</param>
/// <param name="interval">执行周期的间隔,默认为每天一次</param>
/// <returns></returns>
public static string Day(int hour = 1, int minute = 1, int interval = 1)
{
return "1 " + minute.ToString() + " " + hour.ToString() + " 1/" + interval.ToString() + " * ? ";
}
/// <summary>
/// 周期性为周的任务
/// </summary>
/// <param name="dayOfWeek">星期几开始,默认从星期一点开始</param>
/// <param name="hour">第几小时开始默认从1点开始</param>
/// <param name="minute">第几分钟开始默认从第1分钟开始</param>
/// <returns></returns>
public static string Week(DayOfWeek dayOfWeek = DayOfWeek.Monday, int hour = 1, int minute = 1)
{
return Cron.Weekly(dayOfWeek, hour, minute);
}
/// <summary>
/// 周期性为月的任务
/// </summary>
/// <param name="day">几号开始,默认从一号开始</param>
/// <param name="hour">第几小时开始默认从1点开始</param>
/// <param name="minute">第几分钟开始默认从第1分钟开始</param>
/// <returns></returns>
public static string Month(int day = 1, int hour = 1, int minute = 1)
{
return Cron.Monthly(day, hour, minute);
}
/// <summary>
/// 周期性为年的任务
/// </summary>
/// <param name="month">几月开始,默认从一月开始</param>
/// <param name="day">几号开始,默认从一号开始</param>
/// <param name="hour">第几小时开始默认从1点开始</param>
/// <param name="minute">第几分钟开始默认从第1分钟开始</param>
/// <returns></returns>
public static string Year(int month = 1, int day = 1, int hour = 1, int minute = 1)
{
return Cron.Yearly(month, day, hour, minute);
}
}
}

View File

@ -0,0 +1,11 @@
namespace JiShe.IOT.Extensions.Hangfire
{
public class CustomHangfireAuthorizeFilter : IDashboardAuthorizationFilter
{
public bool Authorize(DashboardContext context)
{
var _currentUser = context.GetHttpContext().RequestServices.GetRequiredService<ICurrentUser>();
return _currentUser.IsAuthenticated;
}
}
}

View File

@ -0,0 +1,24 @@
namespace JiShe.IOT.Extensions.Hangfire;
/// <summary>
/// 重试最后一次
/// </summary>
public class JobRetryLastFilter : JobFilterAttribute, IElectStateFilter
{
private int RetryCount { get; }
public JobRetryLastFilter(int retryCount)
{
RetryCount = retryCount;
}
public void OnStateElection(ElectStateContext context)
{
var retryAttempt = context.GetJobParameter<int>("RetryCount");
if (RetryCount == retryAttempt)
{
Log.Error("最后一次重试");
}
}
}

View File

@ -0,0 +1,15 @@
using JiShe.IOT.Jobs;
namespace JiShe.IOT.Extensions.Hangfire
{
public static class RecurringJobsExtensions
{
public static void CreateRecurringJob(this ApplicationInitializationContext context)
{
RecurringJob.AddOrUpdate<TestJob>("测试Job", e => e.ExecuteAsync(), CronType.Minute(1), new RecurringJobOptions()
{
TimeZone = TimeZoneInfo.Local
});
}
}
}

View File

@ -0,0 +1,65 @@
// Global using directives
global using System;
global using System.Collections.Generic;
global using System.IO;
global using System.Linq;
global using System.Text;
global using System.Text.RegularExpressions;
global using System.Threading.Tasks;
global using Hangfire;
global using Hangfire.Common;
global using Hangfire.Dashboard;
global using Hangfire.States;
global using Hangfire.Storage;
global using Lion.AbpPro;
global using JiShe.IOT.EntityFrameworkCore;
global using JiShe.IOT.Extensions;
global using JiShe.IOT.Extensions.Hangfire;
global using JiShe.IOT.MultiTenancy;
global using Microsoft.AspNetCore.Authentication.JwtBearer;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.DataProtection;
global using Microsoft.AspNetCore.Hosting;
global using Microsoft.AspNetCore.Http;
global using Microsoft.AspNetCore.Identity;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.AspNetCore.Mvc.Abstractions;
global using Microsoft.AspNetCore.Mvc.Filters;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Localization;
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Logging.Abstractions;
global using Microsoft.Extensions.Options;
global using Microsoft.IdentityModel.Tokens;
global using Microsoft.OpenApi.Models;
global using Serilog;
global using StackExchange.Redis;
global using Swagger;
global using Swashbuckle.AspNetCore.SwaggerUI;
global using Volo.Abp;
global using Volo.Abp.Account.Web;
global using Volo.Abp.AspNetCore.Auditing;
global using Volo.Abp.AspNetCore.Authentication.JwtBearer;
global using Volo.Abp.AspNetCore.ExceptionHandling;
global using Volo.Abp.AspNetCore.Mvc;
global using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
global using Volo.Abp.AspNetCore.Serilog;
global using Volo.Abp.Auditing;
global using Volo.Abp.Authorization;
global using Volo.Abp.BackgroundJobs;
global using Volo.Abp.BackgroundJobs.Hangfire;
global using Volo.Abp.Caching;
global using Volo.Abp.Caching.StackExchangeRedis;
global using Volo.Abp.DependencyInjection;
global using Volo.Abp.Domain.Entities;
global using Volo.Abp.ExceptionHandling;
global using Volo.Abp.Http;
global using Volo.Abp.Json;
global using Volo.Abp.Modularity;
global using Volo.Abp.MultiTenancy;
global using Volo.Abp.Users;
global using Volo.Abp.Validation;

View File

@ -0,0 +1,40 @@
namespace JiShe.IOT
{
public static class IOTHttpApiHostConst
{
/// <summary>
/// 跨域策略名
/// </summary>
public const string DefaultCorsPolicyName = "Default";
/// <summary>
/// Cookies名称
/// </summary>
public const string DefaultCookieName = "JiShe.IOT.Http.Api";
/// <summary>
/// SwaggerUi 端点
/// </summary>
public const string SwaggerUiEndPoint = "/swagger";
/// <summary>
/// Hangfire 端点
/// </summary>
public const string HangfireDashboardEndPoint = "/hangfire";
/// <summary>
/// CAP 端点
/// </summary>
public const string CapDashboardEndPoint = "/cap";
public const string MoreEndPoint = "https://doc.cncore.club/";
/// <summary>
/// HMiniprofiler端点
/// </summary>
public const string MiniprofilerEndPoint = "/profiler/results-index";
}
}

View File

@ -0,0 +1,290 @@
namespace JiShe.IOT
{
[DependsOn(
typeof(IOTHttpApiModule),
typeof(AbpProSharedHostingMicroserviceModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(IOTEntityFrameworkCoreModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebModule),
typeof(IOTApplicationModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpCachingStackExchangeRedisModule)
)]
public class IOTHttpApiHostModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
ConfigureCache(context);
ConfigureSwaggerServices(context);
ConfigureJwtAuthentication(context, configuration);
ConfigureMiniProfiler(context);
ConfigureIdentity(context);
ConfigureAuditLog(context);
ConfigurationSignalR(context);
ConfigurationMultiTenancy();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var configuration = context.GetConfiguration();
app.UseAbpProRequestLocalization();
app.UseCorrelationId();
app.UseStaticFiles();
app.UseMiniProfiler();
app.UseRouting();
app.UseCors(IOTHttpApiHostConst.DefaultCorsPolicyName);
app.UseAuthentication();
if (MultiTenancyConsts.IsEnabled)
{
app.UseMultiTenancy();
}
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/IOT/swagger.json", "IOT API");
options.DocExpansion(DocExpansion.None);
options.DefaultModelsExpandDepth(-1);
});
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseUnitOfWork();
app.UseConfiguredEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health");
// endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions()
// {
// Authorization = new[] { new CustomHangfireAuthorizeFilter() },
// IgnoreAntiforgeryToken = true
// });
});
if (configuration.GetValue("Consul:Enabled", false))
{
app.UseConsul();
}
}
private void ConfigurationSignalR(ServiceConfigurationContext context)
{
var redisConnection = context.Services.GetConfiguration().GetValue<string>("Redis:Configuration");
if (redisConnection.IsNullOrWhiteSpace())
{
throw new UserFriendlyException(message: "Redis连接字符串未配置.");
}
context.Services.AddSignalR().AddStackExchangeRedis(redisConnection, options => { options.Configuration.ChannelPrefix = "Lion.AbpPro"; });
}
/// <summary>
/// 配置MiniProfiler
/// </summary>
private void ConfigureMiniProfiler(ServiceConfigurationContext context)
{
context.Services.AddMiniProfiler(options => options.RouteBasePath = "/profiler").AddEntityFramework();
}
/// <summary>
/// 配置JWT
/// </summary>
private void ConfigureJwtAuthentication(ServiceConfigurationContext context,
IConfiguration configuration)
{
context.Services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.TokenValidationParameters =
new TokenValidationParameters()
{
// 是否开启签名认证
ValidateIssuerSigningKey = true,
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
//ClockSkew = TimeSpan.Zero,
ValidIssuer = configuration["Jwt:Issuer"],
ValidAudience = configuration["Jwt:Audience"],
IssuerSigningKey =
new SymmetricSecurityKey(
Encoding.ASCII.GetBytes(configuration["Jwt:SecurityKey"]))
};
options.Events = new JwtBearerEvents
{
OnMessageReceived = currentContext =>
{
var path = currentContext.HttpContext.Request.Path;
if (path.StartsWithSegments("/login"))
{
return Task.CompletedTask;
}
var accessToken = string.Empty;
if (currentContext.HttpContext.Request.Headers.ContainsKey("Authorization"))
{
accessToken = currentContext.HttpContext.Request.Headers["Authorization"];
if (!string.IsNullOrWhiteSpace(accessToken))
{
accessToken = accessToken.Split(" ").LastOrDefault();
}
}
if (accessToken.IsNullOrWhiteSpace())
{
accessToken = currentContext.Request.Query["access_token"].FirstOrDefault();
}
if (accessToken.IsNullOrWhiteSpace())
{
accessToken = currentContext.Request.Cookies[IOTHttpApiHostConst.DefaultCookieName];
}
currentContext.Token = accessToken;
currentContext.Request.Headers.Remove("Authorization");
currentContext.Request.Headers.Add("Authorization", $"Bearer {accessToken}");
return Task.CompletedTask;
}
};
});
}
/// <summary>
/// Redis缓存
/// </summary>
private void ConfigureCache(ServiceConfigurationContext context)
{
Configure<AbpDistributedCacheOptions>(
options => { options.KeyPrefix = "IOT:"; });
var configuration = context.Services.GetConfiguration();
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "IOT-Protection-Keys");
}
/// <summary>
/// 配置Identity
/// </summary>
private void ConfigureIdentity(ServiceConfigurationContext context)
{
context.Services.Configure<IdentityOptions>(options => { options.Lockout = new LockoutOptions() { AllowedForNewUsers = false }; });
}
private static void ConfigureSwaggerServices(ServiceConfigurationContext context)
{
context.Services.AddSwaggerGen(
options =>
{
// 文件下载类型
options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = "file" });
options.SwaggerDoc("IOT",
new OpenApiInfo { Title = "JiSheIOT API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.EnableAnnotations(); // 启用注解
options.DocumentFilter<HiddenAbpDefaultApiFilter>();
options.SchemaFilter<EnumSchemaFilter>();
// 加载所有xml注释这里会导致swagger加载有点缓慢
var xmlPaths = Directory.GetFiles(AppContext.BaseDirectory, "*.xml");
foreach (var xml in xmlPaths)
{
options.IncludeXmlComments(xml, true);
}
options.AddSecurityDefinition(JwtBearerDefaults.AuthenticationScheme,
new OpenApiSecurityScheme()
{
Description = "直接在下框输入JWT生成的Token",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.Http,
Scheme = JwtBearerDefaults.AuthenticationScheme,
BearerFormat = "JWT"
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme, Id = "Bearer"
}
},
new List<string>()
}
});
options.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme()
{
Type = SecuritySchemeType.ApiKey,
In = ParameterLocation.Header,
Name = "Accept-Language",
Description = "多语言设置系统预设语言有zh-Hans、en默认为zh-Hans",
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{ Type = ReferenceType.SecurityScheme, Id = "ApiKey" }
},
Array.Empty<string>()
}
});
});
}
/// <summary>
/// 审计日志
/// </summary>
private void ConfigureAuditLog(ServiceConfigurationContext context)
{
Configure<AbpAuditingOptions>
(
options =>
{
options.IsEnabled = true;
options.EntityHistorySelectors.AddAllEntities();
options.ApplicationName = "JiShe.IOT";
}
);
Configure<AbpAspNetCoreAuditingOptions>(
options =>
{
options.IgnoredUrls.Add("/AuditLogs/page");
options.IgnoredUrls.Add("/hangfire/stats");
options.IgnoredUrls.Add("/cap");
});
}
private void ConfigurationMultiTenancy()
{
Configure<AbpMultiTenancyOptions>(options => { options.IsEnabled = MultiTenancyConsts.IsEnabled; });
}
}
}

View File

@ -0,0 +1,65 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>JiShe.IOT</RootNamespace>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>JiShe.IOT-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer"/>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis"/>
<PackageReference Include="Volo.Abp.Account.Web"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy"/>
<PackageReference Include="Volo.Abp.Autofac"/>
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis"/>
<PackageReference Include="Volo.Abp.AspNetCore.Serilog"/>
<PackageReference Include="Volo.Abp.Swashbuckle"/>
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic"/>
<PackageReference Include="Serilog"/>
<PackageReference Include="Serilog.AspNetCore"/>
<PackageReference Include="Serilog.Exceptions"/>
<PackageReference Include="Serilog.Extensions.Logging"/>
<PackageReference Include="Serilog.Settings.Configuration"/>
<PackageReference Include="Serilog.Sinks.Console"/>
<PackageReference Include="Serilog.Sinks.Elasticsearch"/>
<PackageReference Include="Serilog.Sinks.File"/>
<PackageReference Include="Serilog.Sinks.Async"/>
<PackageReference Include="Hangfire.Redis.StackExchange"/>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks"/>
<PackageReference Include="MiniProfiler.AspNetCore.Mvc"/>
<PackageReference Include="DotNetCore.CAP.MySql"/>
<PackageReference Include="DotNetCore.CAP.RabbitMQ"/>
<PackageReference Include="DotNetCore.CAP.Dashboard"/>
<PackageReference Include="DotNetCore.CAP.InMemoryStorage"/>
<PackageReference Include="Savorboard.CAP.InMemoryMessageQueue"/>
<PackageReference Include="MiniProfiler.AspNetCore.Mvc"/>
<PackageReference Include="MiniProfiler.EntityFrameworkCore"/>
<PackageReference Include="MiniProfiler.Shared"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\JiShe.IOT.Application\JiShe.IOT.Application.csproj"/>
<ProjectReference Include="..\..\src\JiShe.IOT.EntityFrameworkCore\JiShe.IOT.EntityFrameworkCore.csproj"/>
<ProjectReference Include="..\..\src\JiShe.IOT.HttpApi\JiShe.IOT.HttpApi.csproj"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lion.AbpPro.Shared.Hosting.Microservices"/>
</ItemGroup>
<ItemGroup>
<Compile Remove="Logs\**"/>
<Content Remove="Logs\**"/>
<EmbeddedResource Remove="Logs\**"/>
<None Remove="Logs\**"/>
</ItemGroup>
<ItemGroup>
<Content Remove="$(UserProfile)\.nuget\packages\*\*\contentFiles\any\*\*.abppkg*.json"/>
</ItemGroup>
</Project>

View File

@ -0,0 +1,158 @@
@page
@model JiShe.IOT.Pages.Login
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>后台服务登录</title>
<link href="libs/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-offset-3 col-md-6">
<form class="form-horizontal" method="post">
@Html.AntiForgeryToken()
<span class="heading">后台服务登录</span>
<div class="form-group">
<input type="text" class="form-control" name="userName" placeholder="用户名">
</div>
<div class="form-group help">
<input type="password" class="form-control" name="password" placeholder="密码">
</div>
<div class="form-group">
<button type="submit" class="btn btn-default">登录</button>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
<style>
.row {
width: 800 px;
height: auto;
margin: auto;
box-sizing: border-box;
transform: translate(0, 50%);
}
.form-horizontal {
background: #fff;
padding-bottom: 40px;
border-radius: 15px;
text-align: center;
}
.form-horizontal .heading {
display: block;
font-size: 35px;
font-weight: 700;
padding: 35px 0;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 30px;
}
.form-horizontal .form-group {
padding: 0 40px;
margin: 0 0 25px 0;
position: relative;
}
.form-horizontal .form-control {
background: #f0f0f0;
border: none;
border-radius: 20px;
box-shadow: none;
padding: 0 20px 0 45px;
height: 40px;
transition: all 0.3s ease 0s;
}
.form-horizontal .form-control:focus {
background: #e0e0e0;
box-shadow: none;
outline: 0 none;
}
.form-horizontal .form-group i {
position: absolute;
top: 12px;
left: 60px;
font-size: 17px;
color: #c8c8c8;
transition: all 0.5s ease 0s;
}
.form-horizontal .form-control:focus + i {
color: #00b4ef;
}
.form-horizontal .fa-question-circle {
display: inline-block;
position: absolute;
top: 12px;
right: 60px;
font-size: 20px;
color: #808080;
transition: all 0.5s ease 0s;
}
.form-horizontal .fa-question-circle:hover {
color: #000;
}
.form-horizontal .main-checkbox {
float: left;
width: 20px;
height: 20px;
background: #11a3fc;
border-radius: 50%;
position: relative;
margin: 5px 0 0 5px;
border: 1px solid #11a3fc;
}
.form-horizontal .main-checkbox label {
width: 20px;
height: 20px;
position: absolute;
top: 0;
left: 0;
cursor: pointer;
}
.form-horizontal .main-checkbox label:after {
content: "";
width: 10px;
height: 5px;
position: absolute;
top: 5px;
left: 4px;
border: 3px solid #fff;
border-top: none;
border-right: none;
background: transparent;
opacity: 0;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.form-horizontal .main-checkbox input[type="checkbox"] {
visibility: hidden;
}
.form-horizontal .main-checkbox input[type="checkbox"]:checked + label:after {
opacity: 1;
}
.form-horizontal .text {
float: left;
margin-left: 7px;
line-height: 20px;
padding-top: 5px;
text-transform: capitalize;
}
.form-horizontal .btn {
text-align: center;
font-size: 14px;
color: #fff;
background: #00b4ef;
border-radius: 30px;
padding: 10px 25px;
border: none;
text-transform: capitalize;
transition: all 0.5s ease 0s;
}
</style>

View File

@ -0,0 +1,69 @@
using Lion.AbpPro.BasicManagement.ConfigurationOptions;
using Lion.AbpPro.BasicManagement.Users;
using Lion.AbpPro.BasicManagement.Users.Dtos;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace JiShe.IOT.Pages
{
public class Login : PageModel
{
private readonly IAccountAppService _accountAppService;
private readonly ILogger<Login> _logger;
private readonly IHostEnvironment _hostEnvironment;
private readonly JwtOptions _jwtOptions;
public Login(IAccountAppService accountAppService,
ILogger<Login> logger,
IHostEnvironment hostEnvironment,
IOptionsSnapshot<JwtOptions> jwtOptions)
{
_accountAppService = accountAppService;
_logger = logger;
_hostEnvironment = hostEnvironment;
_jwtOptions = jwtOptions.Value;
}
public void OnGet()
{
}
public async Task OnPost()
{
string userName = Request.Form["userName"];
string password = Request.Form["password"];
if (userName.IsNullOrWhiteSpace() || password.IsNullOrWhiteSpace())
{
Response.Redirect("/Login");
return;
}
try
{
var options = new CookieOptions
{
Expires = DateTime.Now.AddHours(_jwtOptions.ExpirationTime),
SameSite = SameSiteMode.Unspecified,
};
// 设置cookies domain
//options.Domain = "IOT.cn";
var result = await _accountAppService.LoginAsync(new LoginInput()
{ Name = userName, Password = password });
Response.Cookies.Append(IOTHttpApiHostConst.DefaultCookieName,
result.Token, options);
}
catch (Exception e)
{
_logger.LogError($"登录失败:{e.Message}");
Response.Redirect("/Login");
return;
}
Response.Redirect("/monitor");
}
}
}

View File

@ -0,0 +1,171 @@
@page
@using JiShe.IOT
@model JiShe.IOT.Pages.Monitor
@{
Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href="libs/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<title>后端服务</title>
</head>
<body>
<div class="container projects">
<div class="projects-header page-header">
<h2>后端服务列表</h2>
@* <p>这些项目或者是对Bootstrap进行了有益的补充或者是基于Bootstrap开发的</p> *@
</div>
<div class="row">
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="thumbnail" style="height: 180px">
<a href="@IOTHttpApiHostConst.SwaggerUiEndPoint" target="_blank">
<img class="lazy" src="/images/swagger.png" width="300" height="150"/>
</a>
<div class="caption">
<h3>
<a href="@IOTHttpApiHostConst.SwaggerUiEndPoint" target="_blank">SwaggerUI</a>
</h3>
</div>
</div>
</div>
@* <div class="col-sm-6 col-md-4 col-lg-3"> *@
@* <div class="thumbnail" style="height: 180px"> *@
@* <a href="@IOTHttpApiHostConst.HangfireDashboardEndPoint" target="_blank"> *@
@* <img class="lazy" src="/images/hangfire.png" width="300" height="150"/> *@
@* </a> *@
@* <div class="caption"> *@
@* <h3> *@
@* <a href="@IOTHttpApiHostConst.HangfireDashboardEndPoint" target="_blank">Hangfire面板</a> *@
@* </h3> *@
@* </div> *@
@* </div> *@
@* </div> *@
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="thumbnail" style="height: 180px">
<a href="@IOTHttpApiHostConst.MiniprofilerEndPoint" target="_blank">
<img class="lazy" src="/images/miniprofiler.png" width="300" height="150"/>
</a>
<div class="caption">
<h3>
<a href="@IOTHttpApiHostConst.MiniprofilerEndPoint" target="_blank">Miniprofiler</a>
</h3>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="thumbnail" style="height: 180px">
<a href="@IOTHttpApiHostConst.MoreEndPoint" target="_blank">
<img class="lazy" src="/images/more.png" width="300" height="150"/>
</a>
<div class="caption">
<h3>
<a href="@IOTHttpApiHostConst.MoreEndPoint" target="_blank">了解更多...</a>
</h3>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<style>
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.container {
width: 1170 px;
padding-right: 15 px;
padding-left: 15 px;
margin-right: auto;
margin-left: auto;
}
.projects-header {
width: 60%;
text-align: center;
font-weight: 200;
display: block;
margin: 60 px auto 40 px !important;
}
.page-header {
padding-bottom: 9px;
margin: 40px auto;
border-bottom: 1 px solid #eee;
}
.projects-header h2 {
font-size: 42px;
letter-spacing: -1px;
}
h2 {
margin-top: 20 px;
margin-bottom: 10 px;
font-weight: 500;
line-height: 1.1;
color: inherit;
/* text-align: center; */
}
p {
margin: 0 0 10 px;
}
.row {
margin-right: -15 px;
margin-left: -15 px;
}
.col-lg-3 {
width: 25%;
}
.projects .thumbnail {
display: block;
margin-right: auto;
margin-left: auto;
text-align: center;
margin-bottom: 30 px;
border-radius: 0;
}
.thumbnail {
display: block;
padding: 4px;
line-height: 1.42857143;
background-color: #fff;
border: 1 px solid #ddd;
.transition(border 0.2s ease-in-out);
}
a {
color: #337ab7;
text-decoration: none;
background-color: transparent;
}
.projects .thumbnail img {
max-width: 100%;
height: auto;
}
.thumbnail a > img,
.thumbnail > img {
margin-right: auto;
margin-left: auto;
}
img {
vertical-align: middle;
}
/* .projects .thumbnail .caption {
overflow-y: hidden;
color: #555;
} */
.caption {
padding: 9px;
overflow-y: hidden;
color: #555;
}
</style>

View File

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace JiShe.IOT.Pages
{
public class Monitor : PageModel
{
public void OnGet()
{
}
}
}

View File

@ -0,0 +1,25 @@
namespace JiShe.IOT
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel((context, options) => { options.Limits.MaxRequestBodySize = 1024 * 50; });
webBuilder.UseStartup<Startup>();
})
.UseSerilog((context, loggerConfiguration) =>
{
SerilogToEsExtensions.SetSerilogConfiguration(
loggerConfiguration,
context.Configuration);
}).UseAutofac();
}
}

View File

@ -0,0 +1,12 @@
{
"profiles": {
"JiShe.IOT.HttpApi.Host": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "http://localhost:44315",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,16 @@
namespace JiShe.IOT
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<IOTHttpApiHostModule>();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}
}

View File

@ -0,0 +1,3 @@
{
}

View File

@ -0,0 +1,61 @@
{
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.File"
],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information",
"Volo.Abp": "Information",
"Hangfire": "Information",
"DotNetCore.CAP": "Information",
"Serilog.AspNetCore": "Information",
"Microsoft.EntityFrameworkCore": "Warning",
"Microsoft.AspNetCore": "Information"
}
},
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "File",
"Args": {
"path": "logs/logs-.txt",
"rollingInterval": "Day"
}
}
]
},
"App": {
"SelfUrl": "http://localhost:44315",
"CorsOrigins": "https://*.IOT.com,http://localhost:4200,http://localhost:3100,http://118.190.144.92:9111"
},
"ConnectionStrings": {
"Default": "Data Source=118.190.144.92;Port=33306;Database=JiSheIOTDB;uid=root;pwd=admin123;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
},
"Redis": {
"Configuration": "118.190.144.92:6379,defaultdatabase=14"
},
"Jwt": {
"Audience": "JiShe.IOT",
"SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=",
"Issuer": "JiShe.IOT",
"ExpirationTime": 2
},
"ElasticSearch": {
"Enabled": "false",
"Url": "http://es.cn",
"IndexFormat": "JiShe.IOT.development.{0:yyyy.MM.dd}",
"UserName": "elastic",
"Password": "aVVhjQ95RP7nbwNy",
"SearchIndexFormat": "JiShe.IOT.development*"
},
"Consul": {
"Enabled": false,
"Host": "http://localhost:8500",
"Service": "Project-Service"
}
}

View File

@ -0,0 +1 @@
{"AdditionalData":{},"Alg":"RS256","Crv":null,"D":"eH-Ld45J684VguyI2jACQEEVGtTx79Nt7ElT20JeUi-pbVnhJxxAJwnAe68d9Q8skpv6BxZs5QuyIORwfGpJK-lKVuo8EtyUQTuUuPmP4o1YK4cv2FIi5xN18tddTltg2JmJi1sN2AD5z-zwm45YNvoFxdQYlnUlA9lJL8QfG0HQLMQX1sv2_lgND8RfRGQBCpVXC2kcap4GvkFVQpKaQ5xaUqvNdH6ftwkGMdFfMRlHGhyYyabIjs4T16HslofvXiHbOCAzk37HtBNNsBpeoQuZul1-G7tAndHe1XtuGvuE-k1fyqdm3YiCU8wK7FpvQU3x6JqvfqmWgMAPnWKOtQ","DP":"hd3I9Nc3LlaZDoPg20JZu48kpv9rMMQ0rLtcZ0UPB_HpZWBC_No-3t3t1HFRbD4iz0MCpCR6gb5q4UsL2N2xh3Q8OhQ1Zrl76UKDZrVKs3oE0VVr9K2VUU3s1sytE4OWSv7PAHYURygcx_MrunMn8Ryd4ZJBQ_g5M2GvpBj1o5M","DQ":"T3ibciK4KxGGHqau9dnWxE6l3fGtcNw1GcjV93Lxe0NKTbfrwPEIFVVAyPsFS8QdmRXEgyunkDFKLHyq2hXBi2fZCwXGoWkUqVUKAKMaNYZaDDd_XeJKOu7mwNY8rgxNETHCyMSnnNNPNabBf2iiXmrBnMwesle2L1kwky42yns","E":"AQAB","K":null,"KeyId":"0D94529E740F5FD50EC6B8A19FF460D6","Kid":"0D94529E740F5FD50EC6B8A19FF460D6","Kty":"RSA","N":"w2jhtWb6a3kH4VqAPfuuvdF5hBh7U6gwMRnddHAH7zaVL6aYwjpCzNW56RQy4W4Zabv1My4Yw9GZpjrOcyr3Bm669eZjn_JC0O00eRTNStNgmg2kB_6AB6ROkEW7br1JC0jKr_dXhOYPBMmR-KHvpwaZXA9R1xOqY02S3JD0KB-TGMSC9q1RlVydt81aMOHFzWVyruLsYGdmcKhRPKDtL6GXpU_DG1gzzOYbk795x_D_UUTOJYuhIDEj7aYi3o32yXLEBvh4Q7HPLjLcWzV-EzCn6Ossl-EVJ2TrR53Eln03R93Vmo63DzQbLIOi3yTcZD2a3O6mpGLiqyZjUducIQ","Oth":null,"P":"y84cEtE6IRBeU2sDJxjDYb50HB4nAF7-bfvbEq0haQL2sFBz-Q-uOUAeXhaS74Gh_IagmW1TzOKblVilijMHCsfOFTWlCljaDoNfdl31enh50HMFvUu8IFjcWiQ9fjR5no8n5-jDeRO5zVfgcWoRHfVTOq4Di7WlVHJRr8FB-R8","Q":"9XRZvvMIvoumlDAVxWZHkb7_an0_dFwBLqc8v74XBZhiK5SLuBqmsJICB5kwNTKzORH7yedx-RXOJWkchJLlEtmH_cQO_6WKQQAyc1PMnLPa0tYkhjotWo8VRE9bAdVmrR0cnJeudfSJ-6gDpUBQYy9g1m8cAfWbTAk3at2_gr8","QI":"xRLXLwhTdNbevlEzANlDDnU9lDeKZWV9-YrvUxHMJBBygBNVqkNFWiee7LNUi82YgTHRn46rpHY9TZf6oQbgk6xa86MyDYXGU2uGO8DHm5oh20Spp7A-RlzZ4JRXAJ3eAYMZHQIP45JApVvKbgHh_pUGjNaiqZKZ9IN6H_L9k1s","Use":null,"X":null,"X5t":null,"X5tS256":null,"X5u":null,"Y":null,"KeySize":2048,"HasPrivateKey":true,"CryptoProviderFactory":{"CryptoProviderCache":{},"CustomCryptoProvider":null,"CacheSignatureProviders":true}}

View File

@ -0,0 +1 @@
{"KeyId":"600caa200caf5d805eba9f06ace9e236","Parameters":{"D":"KCNDHA96eimN+UqchSKocgYITGflaAIwxzCS5KqSTkYAFliPthQx7LySuLor4F1+uLvwnh3ZocyI3y43GZu+eVHD256sxdV8/UsQz1HC23RRFqcUiAZjze8K5VMVStrBOxaa/Ds1U9/bpuNE7jZdcgFIEHsdZtCACqwtlE4nlIs1/GLiokqjBOESgxJMy9WUeDbWcvoo+YdwgKf5jt6AZHOYSS+TokLL+Y7TEfGMXe3jZD9VtSMkBSM8wGB89zNGR0FZB9maCG/BCoRJqxdYRyeb4FFXJclQtK3DexyDVqlNZQaNKVHu0tVAnVNKKcd7Iex8gA+5DNqqucUA7C/F6Q==","DP":"fr9iaNb1W4YZ/NJ56+N3SCeDQYuKobq1qeaQWmHlQsOHKoHhNZJQZ5x0M9PQilou16AwVlNGCJncMwxsSUxXn6itG0LcBnvfMeo2v3xKcij1BtFR9qfXecwEn2nnhI3mpXtZxyCdP3NIYUp9qViLJUjGJqrbQk+OIAGRQd2rRe0=","DQ":"o1umLkDodtwvpCsDguQYSjd3iob+WHNmfe/9HyjADmUehP8b9SpUgcrb+QF301J8YmQMnYZKWW5rEwKOtwsWNswgXfMnXeWerlZmz0tj9y38YczS70liU0vETsRefhrRCaXHraMvneqYNNedhsrCNalWK+DNwcixi4L59vA8ofs=","Exponent":"AQAB","InverseQ":"btd1nwwxl/E3ryfDi2bN12TuVDvv7yoPvryIlLgu+FiLpe4vaA1omDLliQBcl7oeyA563HBUop4D5oE7si+jD64N8XgFz37dD3KqUokeQ4lrTSSOePT1K+nWIl30sqDd7YE4auz4CvSjm2wXmN31+CXW1hp3YWN2972yrUt+R5U=","Modulus":"uwMB6reAVtm/Cq0BRPZ0ozBq6g3wDh2kzqFKBf8I7u8d9p7i5ExLSrOWPupHwPr/IW1VUn2TKHrJ8OnyYhznKIRxqlxj0U3D2GXijz5kfFOoHK+mlfKaDMqweRoS0UzEz58kMlgwUoDraUj6dTHTPCVPo3TqA2ImRw50j6D+jobFrY5321EFvlirZViMPDAgB8Ca7wGCqNBcCxvIPYw1O6WZmcVmjG7umelD3XjcUIQlEbIyAmi/3gXAo7NdPmgOamla6bnSWsy429HfsNpXyCfPBzV3QS3ubpTekWPoPcOVZbWwVPYtFQbhRh8PmWATRx0cV6oePZNZGxGeJl8WYQ==","P":"wplelBfVmiOPmr6iUxtOgIzuvwSqvP6Rqmh8dhaGDiJjU8OqZ0tZhuh0G+xnMLPIHb2fMeg0dqZMJZ5iXaIi1QycYn/JKz1i4cUonJ6IIQeKKf67tvzn/BY0V0N8rJw8hVfzou+/5sRBCbiHtJ2KIN1YJQuWGFFfrZJOJzc95ss=","Q":"9gTGKoDiOdrY8kqIXJ2nMhoeNryAH4q3EUrROJ7simqc28oYlGx24Sco/wOoeB2xxrdcF5JYOlyJ7H2YY/huLvJISaw/wHLPskiKiYQ78tuNwW0ip+5ceB1dSToHcEe3sR30+OeTh0Z4ZKoqthKziFGIt3EhEgiGq1gjZuWB5gM="}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,53 @@
namespace Lion.AbpPro.WebGateway
{
[DependsOn(
typeof(AbpProSharedHostingGatewayModule))]
public class AbpProWebGatewayModule : AbpModule
{
private const string DefaultCorsPolicyName = "Default";
public override void ConfigureServices(ServiceConfigurationContext context)
{
ConfigureCors(context);
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseCorrelationId();
app.UseCors(DefaultCorsPolicyName);
app.UseRouting();
app.UseConfiguredEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); });
app.UseWebSockets();
app.UseOcelot().Wait();
}
/// <summary>
/// 配置跨域
/// </summary>
private void ConfigureCors(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddCors(options =>
{
options.AddPolicy(DefaultCorsPolicyName, builder =>
{
builder
.WithOrigins(
configuration["App:CorsOrigins"]
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
}
}
}

View File

@ -0,0 +1,22 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
# 创建目录
RUN mkdir /app
COPY publish /app
# 设置工作目录
WORKDIR /app
# 暴露80端口
EXPOSE 80
# 设置时区 .net6 才有这个问题
ENV TZ=Asia/Shanghai
# 设置环境变量
ENV ASPNETCORE_ENVIRONMENT=Production
ENTRYPOINT ["dotnet", "JiShe.IOT.WebGateway.dll"]

View File

@ -0,0 +1,21 @@
// Global using directives
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Threading.Tasks;
global using Lion.AbpPro;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.Cors;
global using Microsoft.AspNetCore.Hosting;
global using Microsoft.AspNetCore.HttpsPolicy;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Logging;
global using Microsoft.OpenApi.Models;
global using Ocelot.Middleware;
global using Swashbuckle.AspNetCore.SwaggerUI;
global using Volo.Abp;
global using Volo.Abp.Modularity;

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Lion.AbpPro.Shared.Hosting.Gateways"/>
</ItemGroup>
</Project>

View File

@ -0,0 +1,16 @@
namespace Lion.AbpPro.WebGateway
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Host
.UseAutofac();
await builder.AddApplicationAsync<AbpProWebGatewayModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
}
}
}

View File

@ -0,0 +1,14 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"JiShe.IOT.WebGateway": {
"commandName": "Project",
"launchBrowser": false,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:44314",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,48 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"App": {
"SelfUrl": "http://120.24.194.14:8014",
"CorsOrigins": "http://localhost:4200,http://120.24.194.14:8012,http://120.24.194.14:8011,http://120.24.194.14:8013"
},
"GlobalConfiguration": {
},
"Routes": [
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "http",
"ServiceName": "IOT-Service",
"LoadBalancerOptions": {
"Type": "LeastConnection"
},
"UpstreamPathTemplate": "/gateway/{url}",
"UpstreamHttpMethod": [
"Get",
"Post",
"Put",
"Delete"
]
},
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "ws",
"ServiceName": "IOT-Service",
"LoadBalancerOptions": {
"Type": "LeastConnection"
},
"UpstreamPathTemplate": "/ws/{url}",
"UpstreamHttpMethod": [
"Get",
"Post",
"Put",
"Delete"
]
}
]
}

View File

@ -0,0 +1,52 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"App": {
"SelfUrl": "http://localhost:44314",
"CorsOrigins": "http://*:*,https://*,http://*,http://localhost"
},
"GlobalConfiguration": {
},
"Routes": [
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "lion.abp.pro",
"Port": 8080
}
],
"UpstreamPathTemplate": "/gateway/{url}",
"UpstreamHttpMethod": [
"Get",
"Post",
"Put",
"Delete"
]
},
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "lion.abp.pro",
"Port": 8080
}
],
"UpstreamPathTemplate": "/ws/{url}",
"UpstreamHttpMethod": [
"Get",
"Post",
"Put",
"Delete"
]
}
]
}

View File

@ -0,0 +1,52 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"App": {
"SelfUrl": "http://localhost:44314",
"CorsOrigins": "http://localhost:4200"
},
"GlobalConfiguration": {
},
"Routes": [
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 44315
}
],
"UpstreamPathTemplate": "/gateway/{url}",
"UpstreamHttpMethod": [
"Get",
"Post",
"Put",
"Delete"
]
},
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 44315
}
],
"UpstreamPathTemplate": "/ws/{url}",
"UpstreamHttpMethod": [
"Get",
"Post",
"Put",
"Delete"
]
}
]
}

View File

@ -0,0 +1,16 @@
// Global using directives
global using System;
global using System.Threading.Tasks;
global using Lion.AbpPro.BasicManagement;
global using Lion.AbpPro.DataDictionaryManagement;
global using Lion.AbpPro.LanguageManagement;
global using Lion.AbpPro.NotificationManagement;
global using Volo.Abp.Application.Services;
global using Volo.Abp.Authorization.Permissions;
global using Volo.Abp.DependencyInjection;
global using Volo.Abp.Identity;
global using Volo.Abp.Localization;
global using Volo.Abp.Modularity;
global using Volo.Abp.ObjectExtending;
global using Volo.Abp.Threading;

View File

@ -0,0 +1,18 @@
namespace JiShe.IOT
{
[DependsOn(
typeof(IOTDomainSharedModule),
typeof(AbpObjectExtendingModule),
typeof(BasicManagementApplicationContractsModule),
typeof(NotificationManagementApplicationContractsModule),
typeof(DataDictionaryManagementApplicationContractsModule),
typeof(LanguageManagementApplicationContractsModule)
)]
public class IOTApplicationContractsModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
IOTDtoExtensions.Configure();
}
}
}

View File

@ -0,0 +1,25 @@
namespace JiShe.IOT
{
public static class IOTDtoExtensions
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
OneTimeRunner.Run(() =>
{
/* You can add extension properties to DTOs
* defined in the depended modules.
*
* Example:
*
* ObjectExtensionManager.Instance
* .AddOrUpdateProperty<IdentityRoleDto, string>("Title");
*
* See the documentation for more:
* https://docs.abp.io/en/abp/latest/Object-Extensions
*/
});
}
}
}

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>JiShe.IOT</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JiShe.IOT.Domain.Shared\JiShe.IOT.Domain.Shared.csproj"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.ObjectExtending"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lion.AbpPro.BasicManagement.Application.Contracts"/>
<PackageReference Include="Lion.AbpPro.NotificationManagement.Application.Contracts"/>
<PackageReference Include="Lion.AbpPro.DataDictionaryManagement.Application.Contracts"/>
<PackageReference Include="Lion.AbpPro.LanguageManagement.Application.Contracts"/>
</ItemGroup>
</Project>

View File

@ -0,0 +1,11 @@
namespace JiShe.IOT.Jobs
{
public interface IRecurringJob : ITransientDependency
{
/// <summary>
/// 执行任务
/// </summary>
/// <returns></returns>
Task ExecuteAsync();
}
}

View File

@ -0,0 +1,17 @@
namespace JiShe.IOT.Permissions
{
public class IOTPermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<IOTResource>(name);
}
}
}

View File

@ -0,0 +1,7 @@
namespace JiShe.IOT.Permissions
{
public static class IOTPermissions
{
}
}

View File

@ -0,0 +1,20 @@
// Global using directives
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Threading.Tasks;
global using Lion.AbpPro.BasicManagement;
global using Lion.AbpPro.DataDictionaryManagement;
global using Lion.AbpPro.LanguageManagement;
global using Lion.AbpPro.NotificationManagement;
global using JiShe.IOT.FreeSqlRepository;
global using JiShe.IOT.Permissions;
global using Microsoft.AspNetCore.Authorization;
global using Microsoft.Extensions.Configuration;
global using Volo.Abp.Application.Services;
global using Volo.Abp.AutoMapper;
global using Volo.Abp.BackgroundJobs.Hangfire;
global using Volo.Abp.DependencyInjection;
global using Volo.Abp.Modularity;
global using Profile = AutoMapper.Profile;

View File

@ -0,0 +1,12 @@
namespace JiShe.IOT
{
/* Inherit your application services from this class.
*/
public abstract class IOTAppService : ApplicationService
{
protected IOTAppService()
{
LocalizationResource = typeof(IOTResource);
}
}
}

View File

@ -0,0 +1,10 @@
namespace JiShe.IOT
{
public class IOTApplicationAutoMapperProfile : Profile
{
public IOTApplicationAutoMapperProfile()
{
}
}
}

View File

@ -0,0 +1,23 @@
namespace JiShe.IOT
{
[DependsOn(
typeof(IOTDomainModule),
typeof(IOTApplicationContractsModule),
typeof(BasicManagementApplicationModule),
typeof(NotificationManagementApplicationModule),
typeof(DataDictionaryManagementApplicationModule),
typeof(LanguageManagementApplicationModule),
typeof(IOTFreeSqlModule)
)]
public class IOTApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<IOTApplicationModule>();
});
}
}
}

View File

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>JiShe.IOT</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JiShe.IOT.Domain\JiShe.IOT.Domain.csproj"/>
<ProjectReference Include="..\JiShe.IOT.Application.Contracts\JiShe.IOT.Application.Contracts.csproj"/>
<ProjectReference Include="..\JiShe.IOT.FreeSqlRepository\JiShe.IOT.FreeSqlRepository.csproj"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lion.AbpPro.BasicManagement.Application"/>
<PackageReference Include="Lion.AbpPro.NotificationManagement.Application"/>
<PackageReference Include="Lion.AbpPro.DataDictionaryManagement.Application"/>
<PackageReference Include="Lion.AbpPro.LanguageManagement.Application"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.BackgroundJobs.HangFire"/>
</ItemGroup>
</Project>

View File

@ -0,0 +1,11 @@
namespace JiShe.IOT.Jobs
{
public class TestJob : IRecurringJob
{
public Task ExecuteAsync()
{
Console.WriteLine($"job 测试- {DateTime.Now}");
return Task.CompletedTask;
}
}
}

View File

@ -0,0 +1,2 @@
using System.Runtime.CompilerServices;
[assembly:InternalsVisibleToAttribute("JiShe.IOT.Application.Tests")]

View File

@ -0,0 +1,42 @@
using Volo.Abp.Data;
namespace JiShe.IOT.DbMigrator
{
public class DbMigratorHostedService : IHostedService
{
private readonly IHostApplicationLifetime _hostApplicationLifetime;
private readonly IConfiguration _configuration;
public DbMigratorHostedService(IHostApplicationLifetime hostApplicationLifetime,
IConfiguration configuration)
{
_hostApplicationLifetime = hostApplicationLifetime;
_configuration = configuration;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
using (var application = await AbpApplicationFactory.CreateAsync<IOTDbMigratorModule>(options =>
{
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
// https://github.com/abpframework/abp/pull/15208
options.AddDataMigrationEnvironment();
}))
{
await application.InitializeAsync();
await application
.ServiceProvider
.GetRequiredService<IOTDbMigrationService>()
.MigrateAsync();
await application.ShutdownAsync();
_hostApplicationLifetime.StopApplication();
}
}
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
}

View File

@ -0,0 +1,19 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
# 创建目录
RUN mkdir /app
COPY publish /app
# 设置工作目录
WORKDIR /app
# 设置时区 .net6 才有这个问题
ENV TZ=Asia/Shanghai
# 设置环境变量
ENV ASPNETCORE_ENVIRONMENT=Production
ENTRYPOINT ["dotnet", "JiShe.IOT.DbMigrator.dll"]

View File

@ -0,0 +1,18 @@
// Global using directives
global using System;
global using System.IO;
global using System.Threading;
global using System.Threading.Tasks;
global using JiShe.IOT.Data;
global using JiShe.IOT.EntityFrameworkCore;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Logging;
global using Serilog;
global using Serilog.Events;
global using Volo.Abp;
global using Volo.Abp.Autofac;
global using Volo.Abp.BackgroundJobs;
global using Volo.Abp.Modularity;

View File

@ -0,0 +1,42 @@
using Volo.Abp.Localization;
namespace JiShe.IOT.DbMigrator
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(IOTEntityFrameworkCoreModule),
typeof(IOTApplicationContractsModule)
)]
public class IOTDbMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBackgroundJobOptions>(options => options.IsJobExecutionEnabled = false);
ConfigureLocalization();
}
/// <summary>
/// 多语言配置
/// </summary>
private void ConfigureLocalization()
{
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("ar", "ar", "العربية"));
options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština"));
options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)"));
options.Languages.Add(new LanguageInfo("fr", "fr", "Français"));
options.Languages.Add(new LanguageInfo("hu", "hu", "Magyar"));
options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português"));
options.Languages.Add(new LanguageInfo("ru", "ru", "Русский"));
options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文"));
options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsch"));
options.Languages.Add(new LanguageInfo("es", "es", "Español"));
});
}
}
}

View File

@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.Extensions.Logging"/>
<PackageReference Include="Serilog.Sinks.Async"/>
<PackageReference Include="Serilog.Sinks.File"/>
<PackageReference Include="Serilog.Sinks.Console"/>
<PackageReference Include="Volo.Abp.Autofac"/>
<PackageReference Include="Microsoft.Extensions.Hosting"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JiShe.IOT.Application.Contracts\JiShe.IOT.Application.Contracts.csproj"/>
<ProjectReference Include="..\JiShe.IOT.EntityFrameworkCore\JiShe.IOT.EntityFrameworkCore.csproj"/>
</ItemGroup>
<ItemGroup>
<Compile Remove="Logs\**"/>
<Content Remove="Logs\**"/>
<EmbeddedResource Remove="Logs\**"/>
<None Remove="Logs\**"/>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,45 @@
namespace JiShe.IOT.DbMigrator
{
class Program
{
static async Task Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning)
#if DEBUG
.MinimumLevel.Override("JiShe.IOT", LogEventLevel.Debug)
#else
.MinimumLevel.Override("JiShe.IOT", LogEventLevel.Information)
#endif
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
.WriteTo.Async(c => c.Console())
.CreateLogger();
await CreateHostBuilder(args).RunConsoleAsync();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging((context, logging) => logging.ClearProviders())
.ConfigureAppConfiguration
(
otpions =>
{
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
var appSettingFileName = "appsettings.json";
if (!environment.IsNullOrWhiteSpace())
appSettingFileName = $"appsettings.{environment}.json";
otpions.AddJsonFile(appSettingFileName, optional: true);
}
)
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<DbMigratorHostedService>();
});
}
}

View File

@ -0,0 +1,5 @@
{
"ConnectionStrings": {
"Default": "Data Source=118.190.144.92;Port=33306;Database=JiSheIOTDB;uid=root;pwd=admin123;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
}
}

View File

@ -0,0 +1,13 @@
{
"KeyId": "f788zGVUZh9H-HbWL1S-Mg",
"Parameters": {
"D": "F19hbC5PLO872DszGiJnVoU55ee7XGXmNf0KEKndJ/uGBv5lWklXA0QF80h1ytWXde0jV5isQPB1t7mPhRQlDoDTkywLi1CeOgBPbxzHEfLjZZ5c4olfeX0IJX9BDqgUntY0H1a/+Om/eDu4OZUz3EIJFFZBgz46YZSyTT6ZDvAEdpC/o66sNJmxvJIp+8zVoVDSqBUzxmc+oEamXLg7r2jdymxJMxau1kQFxEGLOrJnNxGsEe8UrYA3qSsm8m/Xg4uOh7RYgnuEEt88+KTvRq+CAMWhN3YNLtOJ3NmXowwE7e1Ma+jih9+UVfxZn14P5+SOJbQ2bYV2sCV+2vBiCQ==",
"DP": "oPiGO/qdOQfFEAS9fMInQnsrNylIZVpDYEVoDJ6/jQfE/IpuwxGcmsaGvCob3SKxZiJRLCWpwJYo1hCh/JOSVGWMkVyELky56nbbkkV5ymKLSGZ4JoetdQs+GchnPdR+k2P9Ij1Kjk13ylubN3htzNhcBASJpOfSEv5pPVzGKX0=",
"DQ": "z6imxLABHkyftbfUUtpeOlPanEHgpuIjmUdp3T1Ju1jziE63UEhuj0GPAXOF17uYxixwYE8JhOJ7+TyIK9oZeI3zH2OzJqQh8f5PCQ/E+0ULXZDeNV/ShDLCTufu3Fis9Rt64uTp/H/l21oMQ79jc0ysa8DTz1ReJLRc5qjL41U=",
"Exponent": "AQAB",
"InverseQ": "ieZcvSt5XYukKJKhXpv5Dm/1RD7iH88cZnhLSTEVTMoOUHoYWmApY5pNLGahbfjA9bxnkBWDYex/i7wE9uNNY5CsA6ovUaQLVJDt3kHvR9W+9QtN8D6jjG2TuRbbOdEg4RqhfjUaDfDIgTJX2Wxc8U98FOvOyGw1HzwUPFZKecM=",
"Modulus": "vk4z1Bmtmbo+gxITcY+FIlXzcO2wTOGlOXK5GMYj/6PUMFt7lbqkc72AkPsrAo5/JE8LYLhWj7fzSKbjvtowHCz5m2t+FlUYmuiKpvvnJsTqvQrckNlbZ1nm071q5PhP3Dar/OksfBhPtAX+c3+NjDnM/w53ccJJNaBDO/s9JYoN7vH5n6ed1pMSK71hmg4MPsxChcnc1f1PpnG2mqyJ253+GEUbj/kRyeBSmCCr9aadov2ZzxIKVaFNagJEHOzanQmorSLpP25GfOHCuy27Zkef94V/qU9elzjbH4uIKslVGx5T6H99TYh0sUGu11NytYJa5WNAZWow95CzurC2vw==",
"P": "4GMCQy+XTNzR5TsgFcdAZv2K6TcQR13fHVvPoxQp/b32V5YUJOBFEUAtqociy5ro4+KzpXP5WPSk1ZtznGKuNZyLq8gTnhpB3rwd0sdo4zxKnQ5nu+n1UhlhWNxg5A9V5TaciUAyPrHWJfLoYTQWygNTgJELQH5zZXi2ihC2uiU=",
"Q": "2R36pamnLAJggkPJxiW5qH6HizZ+bkQVg0BBftMLzkAM8Y9CwTW75GRUzGEJFpMckkw0GZSYb1Uwl3DVUpkcQ8LZ91IPYdPpDlYUshhIxl184M55pnO14besKxJtMZ64zhHKVAR2pBMO0n6W4/1iBXkkQqyPViJxdfvXPJMBbhM="
}
}

View File

@ -0,0 +1,39 @@
// Global using directives
global using System;
global using System.Collections.Generic;
global using System.ComponentModel.DataAnnotations;
global using System.Linq;
global using System.Reflection;
global using System.Text;
global using System.Threading.Tasks;
global using Lion.AbpPro.BasicManagement;
global using Lion.AbpPro.BasicManagement.Localization;
global using Lion.AbpPro.Core;
global using Lion.AbpPro.DataDictionaryManagement;
global using Lion.AbpPro.LanguageManagement;
global using Lion.AbpPro.NotificationManagement;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Localization;
global using Volo.Abp;
global using Volo.Abp.AuditLogging;
global using Volo.Abp.BackgroundJobs;
global using Volo.Abp.Data;
global using Volo.Abp.DependencyInjection;
global using Volo.Abp.FeatureManagement;
global using Volo.Abp.Identity;
global using Volo.Abp.Identity.Localization;
global using Volo.Abp.Localization;
global using Volo.Abp.Localization.ExceptionHandling;
global using Volo.Abp.Localization.Resources.AbpLocalization;
global using Volo.Abp.Modularity;
global using Volo.Abp.ObjectExtending;
global using Volo.Abp.PermissionManagement;
global using Volo.Abp.SettingManagement;
global using Volo.Abp.SettingManagement.Localization;
global using Volo.Abp.TenantManagement;
global using Volo.Abp.Threading;
global using Volo.Abp.Timing.Localization.Resources.AbpTiming;
global using Volo.Abp.Validation;
global using Volo.Abp.Validation.Localization;
global using Volo.Abp.VirtualFileSystem;

View File

@ -0,0 +1,7 @@
namespace JiShe.IOT
{
public static class IOTDomainErrorCodes
{
}
}

View File

@ -0,0 +1,9 @@
namespace JiShe.IOT;
public class IOTDomainSharedConsts
{
/// <summary>名称空间</summary>
public const string NameSpace = "JiShe.IOT";
/// <summary>默认语言</summary>
public const string DefaultCultureName = "zh-Hans";
}

View File

@ -0,0 +1,44 @@
namespace JiShe.IOT
{
[DependsOn(
typeof(BasicManagementDomainSharedModule),
typeof(NotificationManagementDomainSharedModule),
typeof(DataDictionaryManagementDomainSharedModule),
typeof(LanguageManagementDomainSharedModule),
typeof(AbpProCoreModule)
)]
public class IOTDomainSharedModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
IOTGlobalFeatureConfigurator.Configure();
IOTModuleExtensionConfigurator.Configure();
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<IOTDomainSharedModule>(IOTDomainSharedConsts.NameSpace);
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<IOTResource>(IOTDomainSharedConsts.DefaultCultureName)
.AddVirtualJson("/Localization/IOT")
.AddBaseTypes(typeof(BasicManagementResource))
.AddBaseTypes(typeof(AbpTimingResource));
options.DefaultResourceType = typeof(IOTResource);
});
Configure<AbpExceptionLocalizationOptions>(options =>
{
options.MapCodeNamespace(IOTDomainSharedConsts.NameSpace, typeof(IOTResource));
});
}
}
}

View File

@ -0,0 +1,21 @@
namespace JiShe.IOT
{
public static class IOTGlobalFeatureConfigurator
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
OneTimeRunner.Run(() =>
{
/* You can configure (enable/disable) global features of the used modules here.
*
* YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT!
*
* Please refer to the documentation to lear more about the Global Features System:
* https://docs.abp.io/en/abp/latest/Global-Features
*/
});
}
}
}

View File

@ -0,0 +1,67 @@
namespace JiShe.IOT
{
public static class IOTModuleExtensionConfigurator
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
OneTimeRunner.Run(() =>
{
ConfigureExistingProperties();
ConfigureExtraProperties();
});
}
private static void ConfigureExistingProperties()
{
/* You can change max lengths for properties of the
* entities defined in the modules used by your application.
*
* Example: Change user and role name max lengths
IdentityUserConsts.MaxNameLength = 99;
IdentityRoleConsts.MaxNameLength = 99;
* Notice: It is not suggested to change property lengths
* unless you really need it. Go with the standard values wherever possible.
*
* If you are using EF Core, you will need to run the add-migration command after your changes.
*/
}
private static void ConfigureExtraProperties()
{
/* You can configure extra properties for the
* entities defined in the modules used by your application.
*
* This class can be used to define these extra properties
* with a high level, easy to use API.
*
* Example: Add a new property to the user entity of the identity module
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<string>( //property type: string
"SocialSecurityNumber", //property name
property =>
{
//validation rules
property.Attributes.Add(new RequiredAttribute());
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4});
//...other configurations for this property
}
);
});
});
* See the documentation for more:
* https://docs.abp.io/en/abp/latest/Module-Entity-Extensions
*/
}
}
}

View File

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>JiShe.IOT</RootNamespace>
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\IOT\*.json"/>
<Content Remove="Localization\IOT\*.json"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lion.AbpPro.Core"/>
<PackageReference Include="Lion.AbpPro.BasicManagement.Domain.Shared"/>
<PackageReference Include="Lion.AbpPro.NotificationManagement.Domain.Shared"/>
<PackageReference Include="Lion.AbpPro.DataDictionaryManagement.Domain.Shared"/>
<PackageReference Include="Lion.AbpPro.LanguageManagement.Domain.Shared"/>
</ItemGroup>
</Project>

View File

@ -0,0 +1,8 @@
{
"culture": "ar",
"texts": {
"Menu:Home": "الرئيسية",
"Welcome": "مرحبا",
"LongWelcomeMessage": "مرحبا بكم في التطبيق. هذا مشروع بدء تشغيل يعتمد على إطار عمل ABP. لمزيد من المعلومات ، يرجى زيارة abp.io."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "cs",
"texts": {
"Menu:Home": "Úvod",
"Welcome": "Vítejte",
"LongWelcomeMessage": "Vítejte v aplikaci. Toto je startovací projekt založený na ABP frameworku. Pro více informací, navštivte abp.io."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "de-DE",
"texts": {
"Menu:Home": "Home",
"Welcome": "Willkommen",
"LongWelcomeMessage": "Willkommen bei der Anwendung. Dies ist ein Startup-Projekt, das auf dem ABP-Framework basiert. Weitere Informationen finden Sie unter abp.io."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "en-GB",
"texts": {
"Menu:Home": "Home",
"Welcome": "Welcome",
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io."
}
}

View File

@ -0,0 +1,29 @@
{
"culture": "en",
"texts": {
"Menu:Home": "Home",
"Welcome": "Welcome",
"Test": "Test",
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io.",
"Permission:Query": "Query",
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Permission:Export": "Export",
"Permission:Enable": "Enable|Disable",
"Permission:SystemManagement": "SystemManagement",
"Permission:AuditLogManagement": "AuditLog",
"Permission:HangfireManagement": "BackgroundTask",
"Permission:CapManagement": "IntegratedEvent",
"Permission:ESManagement": "ESManagement",
"Permission:SettingManagement": "SettingManagement",
"Permission:OrganizationUnitManagement": "OrganizationUnitManagement",
"Setting.Group.System": "System",
"Setting.Group.Other": "Other",
"DisplayName:Setting.Group.Other.Github": "Github",
"Description:Setting.Group.Other.Github": "Github",
"Enum:TestType:Created:1":"Created",
"Enum:TestType:Cancel:1":"Cancel",
"Enum:TestType:Delete:1":"Delete"
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "es",
"texts": {
"Menu:Home": "Inicio",
"Welcome": "Bienvenido",
"LongWelcomeMessage": "Bienvenido a la aplicación, este es un proyecto base basado en el framework ABP. Para más información, visita abp.io."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "fr",
"texts": {
"Menu:Home": "Accueil",
"Welcome": "Bienvenue",
"LongWelcomeMessage": "Bienvenue dans l'application. Il s'agit d'un projet de démarrage basé sur le framework ABP. Pour plus d'informations, visitez abp.io."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "hu",
"texts": {
"Menu:Home": "Kezdőlap",
"Welcome": "Üdvözlöm",
"LongWelcomeMessage": "Üdvözöljük az alkalmazásban. Ez egy ABP keretrendszeren alapuló startup projekt. További információkért látogasson el az abp.io oldalra."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "nl",
"texts": {
"Menu:Home": "Home",
"Welcome": "Welkom",
"LongWelcomeMessage": "Welkom bij de applicatie. Dit is een startup-project gebaseerd op het ABP-framework. Bezoek abp.io voor meer informatie."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "pl-PL",
"texts": {
"Menu:Home": "Home",
"Welcome": "Witaj",
"LongWelcomeMessage": "Witaj w aplikacji. To jest inicjalny projekt bazujący na ABP framework. Po więcej informacji odwiedź stronę abp.io."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "pt-BR",
"texts": {
"Menu:Home": "Principal",
"Welcome": "Seja bem-vindo!",
"LongWelcomeMessage": "Bem-vindo a esta aplicação. Este é um projeto inicial baseado no ABP framework. Para mais informações, visite abp.io."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "ru",
"texts": {
"Menu:Home": "Главная",
"Welcome": "Добро пожаловать",
"LongWelcomeMessage": "Добро пожаловать в приложение. Этот запущенный проект основан на фреймворке ABP. Для получения дополнительной информации посетите сайт abp.io."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "sl",
"texts": {
"Menu:Home": "Domov",
"Welcome": "Dobrodošli",
"LongWelcomeMessage": "Dobrodošli v aplikaciji. To je začetni projekt na osnovi okolja ABP. Za več informacij obiščite abp.io."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "tr",
"texts": {
"Menu:Home": "Ana sayfa",
"Welcome": "Hoşgeldiniz",
"LongWelcomeMessage": "Uygulamaya hoşgeldiniz. Bu, ABP framework'ü üzerine bina edilmiş bir başlangıç projesidir. Daha fazla bilgi için abp.io adresini ziyaret edebilirsiniz."
}
}

View File

@ -0,0 +1,8 @@
{
"culture": "vi",
"texts": {
"Menu:Home": "Trang chủ",
"Welcome": "Chào mừng bạn",
"LongWelcomeMessage": "Chào mừng bạn đến ứng dụng. Đây là một dự án khởi nghiệp dựa trên khung ABP. Để biết thêm thông tin, hãy truy cập abp.io."
}
}

View File

@ -0,0 +1,30 @@
{
"culture": "zh-Hans",
"texts": {
"Menu:Home": "首页",
"Welcome": "欢迎",
"Test": "测试",
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io.",
"Permission:Query": "查询",
"Permission:Create": "创建",
"Permission:Update": "编辑",
"Permission:Delete": "删除",
"Permission:Export": "导出",
"Permission:Enable": "启用|禁用",
"Permission:AuditLogManagement": "审计日志",
"Permission:SystemManagement": "系统管理",
"Permission:HangfireManagement": "后台任务",
"Permission:CapManagement": "集成事件",
"Permission:ESManagement": "ES日志",
"Permission:SettingManagement": "设置管理",
"Permission:OrganizationUnitManagement": "组织结构管理",
"Setting.Group.System": "系统",
"Setting.Group.Other": "其它",
"DisplayName:Setting.Group.Other.Github": "Github",
"Description:Setting.Group.Other.Github": "Github",
"Enum:TestType:Created:1":"创建",
"Enum:TestType:Cancel:1":"取消",
"Enum:TestType:Delete:1":"删除"
}
}

View File

@ -0,0 +1,14 @@
{
"culture": "zh-Hant",
"texts": {
"Menu:Home": "首頁",
"Welcome": "歡迎",
"LongWelcomeMessage": "歡迎來到此應用程式. 這是一個基於ABP框架的起始專案. 有關更多訊息, 請瀏覽 abp.io.",
"Permissions:Query": "查询",
"Permissions:Create": "创建",
"Permissions:Update": "更新",
"Permissions:Delete": "删除",
"Permissions:Enable": "启用|禁用",
"Permissions:AuditLogManagement": "审计日志"
}
}

View File

@ -0,0 +1,8 @@
namespace JiShe.IOT
{
[LocalizationResourceName("IOT")]
public class IOTResource
{
}
}

View File

@ -0,0 +1,11 @@
namespace JiShe.IOT.MultiTenancy
{
public static class MultiTenancyConsts
{
/* Enable/disable multi-tenancy easily in a single point.
* If you will never need to multi-tenancy, you can remove
* related modules and code parts, including this file.
*/
public const bool IsEnabled = true;
}
}

View File

@ -0,0 +1,7 @@
namespace JiShe.IOT.Users.Dto
{
public class UserOutput
{
public Guid Id { get; set; }
}
}

View File

@ -0,0 +1,7 @@
namespace JiShe.IOT.Data
{
public interface IIOTDbSchemaMigrator
{
Task MigrateAsync();
}
}

View File

@ -0,0 +1,205 @@
namespace JiShe.IOT.Data
{
public class IOTDbMigrationService : ITransientDependency
{
public ILogger<IOTDbMigrationService> Logger { get; set; }
private readonly IDataSeeder _dataSeeder;
private readonly IEnumerable<IIOTDbSchemaMigrator> _dbSchemaMigrators;
private readonly ITenantRepository _tenantRepository;
private readonly ICurrentTenant _currentTenant;
public IOTDbMigrationService(
IDataSeeder dataSeeder,
IEnumerable<IIOTDbSchemaMigrator> dbSchemaMigrators,
ITenantRepository tenantRepository,
ICurrentTenant currentTenant)
{
_dataSeeder = dataSeeder;
_dbSchemaMigrators = dbSchemaMigrators;
_tenantRepository = tenantRepository;
_currentTenant = currentTenant;
Logger = NullLogger<IOTDbMigrationService>.Instance;
}
public async Task MigrateAsync()
{
var initialMigrationAdded = AddInitialMigrationIfNotExist();
if (initialMigrationAdded)
{
return;
}
Logger.LogInformation("Started database migrations...");
await MigrateDatabaseSchemaAsync();
await SeedDataAsync();
Logger.LogInformation($"Successfully completed host database migrations.");
var tenants = await _tenantRepository.GetListAsync(includeDetails: true);
var migratedDatabaseSchemas = new HashSet<string>();
foreach (var tenant in tenants)
{
using (_currentTenant.Change(tenant.Id))
{
if (tenant.ConnectionStrings.Any())
{
var tenantConnectionStrings = tenant.ConnectionStrings
.Select(x => x.Value)
.ToList();
if (!migratedDatabaseSchemas.IsSupersetOf(tenantConnectionStrings))
{
await MigrateDatabaseSchemaAsync(tenant);
migratedDatabaseSchemas.AddIfNotContains(tenantConnectionStrings);
}
}
await SeedDataAsync(tenant);
}
Logger.LogInformation($"Successfully completed {tenant.Name} tenant database migrations.");
}
Logger.LogInformation("Successfully completed all database migrations.");
Logger.LogInformation("You can safely end this process...");
}
private async Task MigrateDatabaseSchemaAsync(Tenant tenant = null)
{
Logger.LogInformation(
$"Migrating schema for {(tenant == null ? "host" : tenant.Name + " tenant")} database...");
foreach (var migrator in _dbSchemaMigrators)
{
await migrator.MigrateAsync();
}
}
private async Task SeedDataAsync(Tenant tenant = null)
{
Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed...");
await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id)
.WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue)
.WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, IdentityDataSeedContributor.AdminPasswordDefaultValue)
);
}
private bool AddInitialMigrationIfNotExist()
{
try
{
if (!DbMigrationsProjectExists())
{
return false;
}
}
catch (Exception)
{
return false;
}
try
{
if (!MigrationsFolderExists())
{
AddInitialMigration();
return true;
}
else
{
return false;
}
}
catch (Exception e)
{
Logger.LogWarning("Couldn't determinate if any migrations exist : " + e.Message);
return false;
}
}
private bool DbMigrationsProjectExists()
{
var dbMigrationsProjectFolder = GetDbMigrationsProjectFolderPath();
return dbMigrationsProjectFolder != null;
}
private bool MigrationsFolderExists()
{
var dbMigrationsProjectFolder = GetDbMigrationsProjectFolderPath();
return Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "EntityFrameworkCore"));
}
private void AddInitialMigration()
{
Logger.LogInformation("Creating initial migration...");
string argumentPrefix;
string fileName;
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
argumentPrefix = "-c";
fileName = "/bin/bash";
}
else
{
argumentPrefix = "/C";
fileName = "cmd.exe";
}
var procStartInfo = new ProcessStartInfo(fileName,
$"{argumentPrefix} \"abp create-migration-and-run-migrator \"{GetDbMigrationsProjectFolderPath()}\"\""
);
try
{
Process.Start(procStartInfo);
}
catch (Exception)
{
throw new Exception("Couldn't run ABP CLI...");
}
}
private string GetDbMigrationsProjectFolderPath()
{
var slnDirectoryPath = GetSolutionDirectoryPath();
if (slnDirectoryPath == null)
{
throw new Exception("Solution folder not found!");
}
var srcDirectoryPath = Path.Combine(slnDirectoryPath, "src");
return Directory.GetDirectories(srcDirectoryPath)
.FirstOrDefault(d => d.EndsWith(".DbMigrations"));
}
private string GetSolutionDirectoryPath()
{
var currentDirectory = new DirectoryInfo(Directory.GetCurrentDirectory());
while (Directory.GetParent(currentDirectory.FullName) != null)
{
currentDirectory = Directory.GetParent(currentDirectory.FullName);
if (Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null)
{
return currentDirectory.FullName;
}
}
return null;
}
}
}

View File

@ -0,0 +1,13 @@
namespace JiShe.IOT.Data
{
/* This is used if database provider does't define
* IIOTDbSchemaMigrator implementation.
*/
public class NullIOTDbSchemaMigrator : IIOTDbSchemaMigrator, ITransientDependency
{
public Task MigrateAsync()
{
return Task.CompletedTask;
}
}
}

View File

@ -0,0 +1,32 @@
// Global using directives
global using System;
global using System.Collections.Generic;
global using System.Diagnostics;
global using System.IO;
global using System.Linq;
global using System.Runtime.InteropServices;
global using System.Threading.Tasks;
global using Lion.AbpPro.BasicManagement;
global using Lion.AbpPro.DataDictionaryManagement;
global using Lion.AbpPro.LanguageManagement;
global using Lion.AbpPro.NotificationManagement;
global using JiShe.IOT.MultiTenancy;
global using JiShe.IOT.Users.Dto;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Logging.Abstractions;
global using Volo.Abp.AutoMapper;
global using Volo.Abp.Data;
global using Volo.Abp.DependencyInjection;
global using Volo.Abp.Domain.Services;
global using Volo.Abp.EventBus.Distributed;
global using Volo.Abp.Identity;
global using Volo.Abp.Localization;
global using Volo.Abp.Modularity;
global using Volo.Abp.MultiTenancy;
global using Volo.Abp.ObjectMapping;
global using Volo.Abp.SettingManagement;
global using Volo.Abp.Settings;
global using Volo.Abp.TenantManagement;
global using Volo.Abp.Uow;

View File

@ -0,0 +1,9 @@
namespace JiShe.IOT
{
public static class IOTDbProperties
{
public const string DbTablePrefix = "Abp";
public const string DbSchema = null;
}
}

Some files were not shown because too many files have changed in this diff Show More