Commit c9f5c971 by 李毅波

【无】搭建JK.ERP.OMS项目,对外开放webapi

parents
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# 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
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.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
# Visual Studio Trace Files
*.e2e
# 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
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# 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
# Note: 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
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable 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
*.appx
# 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
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# 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
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# 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
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
\ No newline at end of file
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using Microsoft.Extensions.Options;
using System.IO;
namespace JK.ERP.Helper
{
public class AppSettingHelper
{
public static IConfiguration Configuration { get; set; }
static AppSettingHelper()
{
Configuration = new ConfigurationBuilder()
.Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
.Build();
}
//public static T GetSectionObject<T>(string path = null) where T : new()
//{
// var entity = new T();
// if (string.IsNullOrEmpty(path))
// {
// Configuration.Bind(entity);
// }
// else {
// var section = Configuration.GetSection(path);
// section.Bind(entity);
// }
// return entity;
//}
}
public class JWTSetting
{
/// <summary>
/// 发行人
/// </summary>
public string Issuer { get; set; }
/// <summary>
/// 受众人
/// </summary>
public string Audience { get; set; }
/// <summary>
/// 密钥
/// </summary>
public string TockenSecrete { get; set; }
}
}
using Microsoft.AspNetCore.Http;
using Microsoft.IdentityModel.Tokens;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;
namespace JK.ERP.Helper
{
[Serializable]
public class AccountAuth
{
public int Id { get; set; }
public string AccountId { get; set; }
[Required(ErrorMessage = "账号必填")]
public string Account { get; set; }
[Required(ErrorMessage = "密码必填")]
[StringLength(maximumLength: 10, MinimumLength = 6, ErrorMessage = "密码长度最多10位")]
public string Password { get; set; }
}
public class TockenInfo
{
public string Account { get; set; }
public string Password { get; set; }
}
public class AuthHelper
{
/// <summary>
/// 生成Tocken
/// </summary>
/// <param name="p"></param>
/// <returns></returns>
public static string GetTocken(AccountAuth auth)
{
string _issuer = AppSettingHelper.Configuration["JWTSetting:Issuer"];
string audience = AppSettingHelper.Configuration["JWTSetting:Audience"];
string TockenSecrete = AppSettingHelper.Configuration["JWTSetting:TockenSecrete"];
var securityKey = new SigningCredentials(new SymmetricSecurityKey(Encoding.ASCII.GetBytes(TockenSecrete)), SecurityAlgorithms.HmacSha256);
var claims = new Claim[] {
new Claim(JwtRegisteredClaimNames.Sid,auth.AccountId),
new Claim(JwtRegisteredClaimNames.Iss,_issuer),
new Claim(JwtRegisteredClaimNames.Sub,auth.Account),
new Claim(JwtRegisteredClaimNames.Jti,auth.Password),
new Claim("Guid",Guid.NewGuid().ToString("D"))
};
SecurityToken securityToken = new JwtSecurityToken(
issuer: _issuer,
audience: audience,
signingCredentials: securityKey,
expires: DateTime.Now.AddMinutes(2),//过期时间
claims: claims
);
return new JwtSecurityTokenHandler().WriteToken(securityToken);
}
/// <summary>
/// 解析Jwt生成的 Tocken
/// </summary>
/// <param name="accesTocken"></param>
/// <returns></returns>
public static AccountAuth GetTockenInfo(string accesTocken)
{
try
{
if (accesTocken.Contains("Bearer"))
{
accesTocken = accesTocken.Replace("Bearer ", "");
}
var tockHandler = new JwtSecurityToken(accesTocken);
AccountAuth auth = new AccountAuth
{
Account = tockHandler.Claims.FirstOrDefault(c => c.Type == JwtRegisteredClaimNames.Sub).Value,
Password = tockHandler.Claims.FirstOrDefault(c => c.Type == JwtRegisteredClaimNames.Jti).Value
};
return auth;
}
catch (Exception ex)
{
throw new Exception($"解析Tocken时错误:{ex.Message}!");
}
}
/// <summary>
/// 获取accessTocken
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public static string GetTockenString(HttpContext context)
{
return context != null ? context.Request.Headers["Authorization"].ToString() : "";
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.1.9" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.8.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.8.0" />
</ItemGroup>
</Project>
using System;
using System.Collections.Generic;
using System.Text;
namespace JK.ERP.Helper
{
public class LogHelper
{
private static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("LogInfo");
public static void Info(string info)
{
if (loginfo.IsInfoEnabled)
{
loginfo.Info(info);
}
}
public static void Info(string excptionType, string message, string stackTrace)
{
if (loginfo.IsInfoEnabled)
{
loginfo.ErrorFormat("{0}:{1}\n{2}", excptionType, message, stackTrace);
}
}
public static void Warn(string info)
{
if (loginfo.IsWarnEnabled)
{
loginfo.Warn(info);
}
}
public static void Error(Exception ex)
{
if (loginfo.IsErrorEnabled)
{
loginfo.Error(ex);
}
}
public static void Error(object message)
{
if (loginfo.IsErrorEnabled)
{
loginfo.Error(message);
}
}
public static void Error(string info, Exception ex)
{
if (loginfo.IsErrorEnabled)
{
loginfo.Error(info, ex);
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<!-- Define some output appenders -->
<appender name="rollingAppender" type="log4net.Appender.RollingFileAppender">
<file value="log\log.txt" />
<!--追加日志内容-->
<appendToFile value="true" />
<!--防止多线程时不能写Log,官方说线程非安全-->
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<!--可以为:Once|Size|Date|Composite-->
<!--CompositeSizeDate的组合-->
<rollingStyle value="Composite" />
<!--当备份文件时,为文件名加的后缀-->
<datePattern value="yyyyMMdd.TXT" />
<!--日志最大个数,都是最新的-->
<!--rollingStyle节点为Size时,只能有value个日志-->
<!--rollingStyle节点为Composite时,每天有value个日志-->
<maxSizeRollBackups value="20" />
<!--可用的单位:KB|MB|GB-->
<maximumFileSize value="3MB" />
<!--置为true,当前最新日志文件名永远为file节中的名字-->
<staticLogFileName value="true" />
<!--输出级别在INFOERROR之间的日志-->
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="ALL" />
<param name="LevelMax" value="FATAL" />
</filter>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"/>
</layout>
</appender>
<root>
<priority value="ALL"/>
<level value="ALL"/>
<appender-ref ref="rollingAppender" />
</root>
</log4net>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Text;
namespace JK.ERP.Bussiness
{
using JK.ERP.IService;
using JK.ERP.Service;
using JK.ERP.Entity;
public class AccountAuthBussiness
{
private IAccountAuth service = new AccountAuthService();
public AccountAuth GetAccountAuth(string account, string pwd)
{
return service.GetAccountAuth(account, pwd);
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JK.ERP.Entity\JK.ERP.Entity.csproj" />
<ProjectReference Include="..\JK.ERP.IService\JK.ERP.IService.csproj" />
<ProjectReference Include="..\JK.ERP.Model\JK.ERP.Model.csproj" />
<ProjectReference Include="..\JK.ERP.Service\JK.ERP.Service.csproj" />
</ItemGroup>
</Project>
using System;
using System.Collections.Generic;
using System.Text;
namespace JK.ERP.Entity
{
public class AccountAuth
{
public int Id { get; set; }
public string Account { get; set; }
public string Password { get; set; }
public string AccessToken { get; set; }
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="sqlSugarCore" Version="5.0.1" />
</ItemGroup>
</Project>
using JK.ERP.Model;
using System;
using System.Collections.Generic;
using System.Text;
namespace JK.ERP.IService
{
using JK.ERP.Entity;
public interface IAccountAuth
{
AccountAuth GetAccountAuth(string account, string pwd);
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JK.ERP.Entity\JK.ERP.Entity.csproj" />
<ProjectReference Include="..\JK.ERP.Model\JK.ERP.Model.csproj" />
</ItemGroup>
</Project>
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JK.ERP.Model
{
using JK.ERP.Helper;
public class BaseDB
{
public static SqlSugarClient GetClient()
{
SqlSugarClient db = new SqlSugarClient(
new ConnectionConfig {
ConnectionString=BaseDBConfig.ConnectionString,
DbType=DbType.SqlServer,
IsAutoCloseConnection=true
}
);
db.Aop.OnLogExecuting = (sql, pars) =>
{
string log = sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value));
LogHelper.Info(log);
Console.WriteLine(log);
Console.WriteLine();
};
return db;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace JK.ERP.Model
{
public class BaseDBConfig
{
public static string ConnectionString = "server=192.168.8.248;database=SinadealTradeDB;uid=sa;pwd=admin+123;Max Pool Size=2000";
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="sqlSugarCore" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\JK.ERP.COMMON\JK.ERP.Helper\JK.ERP.Helper.csproj" />
</ItemGroup>
</Project>
using System;
using System.Collections.Generic;
using System.Text;
namespace JK.ERP.Model
{
public class MessageModel<T>
{
public bool Success { get; set; }
public string Msg { get; set; }
public List<T> Data { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace JK.ERP.Model
{
public class TableModel<T>
{
/// <summary>
/// 表格数据,支持分页
/// </summary>
public int Code { get; set; }
public string Msg { get; set; }
public int Count { get; set; }
public List<T> Data { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace JK.ERP.Service
{
using JK.ERP.Entity;
using JK.ERP.IService;
using JK.ERP.Model;
using SqlSugar;
public class AccountAuthService : BaseDB,IAccountAuth
{
public SqlSugarClient db = BaseDB.GetClient();
public AccountAuth GetAccountAuth(string account, string pwd)
{
return db.Queryable<AccountAuth>()
.With(SqlWith.NoLock)
.First(f=>f.Account==account && f.Password==pwd);
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JK.ERP.IService\JK.ERP.IService.csproj" />
<ProjectReference Include="..\JK.ERP.Model\JK.ERP.Model.csproj" />
</ItemGroup>
</Project>

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JK.ERP.WEBAPP", "JK.ERP.WEBAPP\JK.ERP.WEBAPP.csproj", "{141CF2A3-A8DB-46A9-8E07-F3D15E2ED0F9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JK.ERP.WEBAPI", "JK.ERP.WEBAPI\JK.ERP.WEBAPI.csproj", "{BC4C3CC1-A3EE-44A6-AB63-BD61DF997F86}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "JK.ERP.COMMON", "JK.ERP.COMMON", "{C05B785A-57B6-4C8F-BD49-F23B1229ADAF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JK.ERP.Helper", "JK.ERP.COMMON\JK.ERP.Helper\JK.ERP.Helper.csproj", "{EB60145D-DD17-4532-B9B9-613CB2DA593C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "JK.ERP.CORE", "JK.ERP.CORE", "{0C3CD167-5701-4C90-8133-47DC88CE9116}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JK.ERP.Service", "JK.ERP.CORE\JK.ERP.Service\JK.ERP.Service.csproj", "{02DF830E-99BC-4F38-8198-24CCE5A3AF75}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JK.ERP.IService", "JK.ERP.CORE\JK.ERP.IService\JK.ERP.IService.csproj", "{2E2BED3A-4378-46C1-A32B-D6CF14666214}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JK.ERP.Model", "JK.ERP.CORE\JK.ERP.Model\JK.ERP.Model.csproj", "{8B8932C1-FE3A-4C5C-821D-A7EF5437EF97}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JK.ERP.Entity", "JK.ERP.CORE\JK.ERP.Entity\JK.ERP.Entity.csproj", "{9421C73F-096E-41D1-8B60-8D32F52BBDD7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JK.ERP.Bussiness", "JK.ERP.CORE\JK.ERP.Bussiness\JK.ERP.Bussiness.csproj", "{74B27306-502F-482E-9F4D-72DF6AB08E7F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{141CF2A3-A8DB-46A9-8E07-F3D15E2ED0F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{141CF2A3-A8DB-46A9-8E07-F3D15E2ED0F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{141CF2A3-A8DB-46A9-8E07-F3D15E2ED0F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{141CF2A3-A8DB-46A9-8E07-F3D15E2ED0F9}.Release|Any CPU.Build.0 = Release|Any CPU
{BC4C3CC1-A3EE-44A6-AB63-BD61DF997F86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC4C3CC1-A3EE-44A6-AB63-BD61DF997F86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC4C3CC1-A3EE-44A6-AB63-BD61DF997F86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC4C3CC1-A3EE-44A6-AB63-BD61DF997F86}.Release|Any CPU.Build.0 = Release|Any CPU
{EB60145D-DD17-4532-B9B9-613CB2DA593C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB60145D-DD17-4532-B9B9-613CB2DA593C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB60145D-DD17-4532-B9B9-613CB2DA593C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB60145D-DD17-4532-B9B9-613CB2DA593C}.Release|Any CPU.Build.0 = Release|Any CPU
{02DF830E-99BC-4F38-8198-24CCE5A3AF75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{02DF830E-99BC-4F38-8198-24CCE5A3AF75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02DF830E-99BC-4F38-8198-24CCE5A3AF75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{02DF830E-99BC-4F38-8198-24CCE5A3AF75}.Release|Any CPU.Build.0 = Release|Any CPU
{2E2BED3A-4378-46C1-A32B-D6CF14666214}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E2BED3A-4378-46C1-A32B-D6CF14666214}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E2BED3A-4378-46C1-A32B-D6CF14666214}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E2BED3A-4378-46C1-A32B-D6CF14666214}.Release|Any CPU.Build.0 = Release|Any CPU
{8B8932C1-FE3A-4C5C-821D-A7EF5437EF97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B8932C1-FE3A-4C5C-821D-A7EF5437EF97}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B8932C1-FE3A-4C5C-821D-A7EF5437EF97}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B8932C1-FE3A-4C5C-821D-A7EF5437EF97}.Release|Any CPU.Build.0 = Release|Any CPU
{9421C73F-096E-41D1-8B60-8D32F52BBDD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9421C73F-096E-41D1-8B60-8D32F52BBDD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9421C73F-096E-41D1-8B60-8D32F52BBDD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9421C73F-096E-41D1-8B60-8D32F52BBDD7}.Release|Any CPU.Build.0 = Release|Any CPU
{74B27306-502F-482E-9F4D-72DF6AB08E7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74B27306-502F-482E-9F4D-72DF6AB08E7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74B27306-502F-482E-9F4D-72DF6AB08E7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74B27306-502F-482E-9F4D-72DF6AB08E7F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{EB60145D-DD17-4532-B9B9-613CB2DA593C} = {C05B785A-57B6-4C8F-BD49-F23B1229ADAF}
{02DF830E-99BC-4F38-8198-24CCE5A3AF75} = {0C3CD167-5701-4C90-8133-47DC88CE9116}
{2E2BED3A-4378-46C1-A32B-D6CF14666214} = {0C3CD167-5701-4C90-8133-47DC88CE9116}
{8B8932C1-FE3A-4C5C-821D-A7EF5437EF97} = {0C3CD167-5701-4C90-8133-47DC88CE9116}
{9421C73F-096E-41D1-8B60-8D32F52BBDD7} = {0C3CD167-5701-4C90-8133-47DC88CE9116}
{74B27306-502F-482E-9F4D-72DF6AB08E7F} = {0C3CD167-5701-4C90-8133-47DC88CE9116}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B299B537-3F30-46C9-8E23-26B0D9649A1B}
EndGlobalSection
EndGlobal
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using System.ComponentModel.DataAnnotations;
using JK.ERP.Helper;
using log4net.Core;
using Microsoft.Extensions.Logging;
using log4net.Repository.Hierarchy;
using RestSharp;
namespace JK.ERP.WEBAPI.Controllers
{
using JK.ERP.Bussiness;
using JK.ERP.Entity;
using JK.ERP.Helper;
using Newtonsoft.Json;
using System.Xml;
[Route("api/[controller]/[action]")]
[ApiController]
public class DockingPlatformController : ControllerBase
{
private readonly ILogger<DockingPlatformController> _logger;
public DockingPlatformController(ILogger<DockingPlatformController> logger)
{
_logger = logger;
}
[HttpGet]
public string Index()
{
return "Hello World";
}
//[HttpPost]
//public ApiResult RequestAuth(AccountAuth auth)
//{
// ApiResult result = new ApiResult();
// //try
// //{
// // string tockenStr = AuthHelper.GetTocken(auth);
// // result.data = tockenStr;
// // result.code = 200;
// // result.message = "授权成功!";
// //}
// //catch (Exception ex)
// //{
// // result.code = 500;
// // result.message = $"授权异常:{ex.Message}";
// // _logger.LogInformation($"Login:{result.message}");
// //}
// return result;
//}
[HttpPost]
[AllowAnonymous]
public ApiResult authTest(string accesTocken)
{
ApiResult result = new ApiResult();
try
{
var info = AuthHelper.GetTockenInfo(accesTocken);
result.data = info;
result.code = 200;
result.message = "success!";
}
catch (Exception ex)
{
result.message = "error:" + ex.Message;
}
return result;
}
}
}
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="3.1.5" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="RestSharp" Version="106.11.7" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.8.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JK.ERP.COMMON\JK.ERP.Helper\JK.ERP.Helper.csproj" />
<ProjectReference Include="..\JK.ERP.CORE\JK.ERP.Bussiness\JK.ERP.Bussiness.csproj" />
<ProjectReference Include="..\JK.ERP.CORE\JK.ERP.Entity\JK.ERP.Entity.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace JK.ERP.WEBAPI
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(configureLogging=>configureLogging.AddLog4Net())
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:61931",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/DockingPlatform/Index",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"JK.ERP.WEBAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/DockingPlatform/Index",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace JK.ERP.WEBAPI
{
using JK.ERP.Helper;
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
//services.AddOptions();
//services.Configure<JWTSetting>(Configuration.GetSection("JWTSetting"));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"JWTSetting": {
"Issuer": "JK",
"Audience": "*",
"TockenSecrete": "123456jkguoji78"
},
"eRacuni": {
"api": "https://eurofaktura.com/WebServicesSI/API",
"username": "IMEDIAGSM@GMAIL.COM",
"md5pass": "66c05e7e6e0d29d8fc2e80bf9c6b84e0",
"token": "FDF3B9A8716D0D00AA0E8D470459CF56",
"AuthToken": "o437OHPrrAODuq6!NUA$FMLMIZHGAyDA"
}
}
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<!-- Define some output appenders -->
<appender name="rollingAppender" type="log4net.Appender.RollingFileAppender">
<file value="log\log.txt" />
<!--追加日志内容-->
<appendToFile value="true" />
<!--防止多线程时不能写Log,官方说线程非安全-->
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<!--可以为:Once|Size|Date|Composite-->
<!--CompositeSizeDate的组合-->
<rollingStyle value="Composite" />
<!--当备份文件时,为文件名加的后缀-->
<datePattern value="yyyyMMdd.TXT" />
<!--日志最大个数,都是最新的-->
<!--rollingStyle节点为Size时,只能有value个日志-->
<!--rollingStyle节点为Composite时,每天有value个日志-->
<maxSizeRollBackups value="20" />
<!--可用的单位:KB|MB|GB-->
<maximumFileSize value="3MB" />
<!--置为true,当前最新日志文件名永远为file节中的名字-->
<staticLogFileName value="true" />
<!--输出级别在INFOERROR之间的日志-->
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="ALL" />
<param name="LevelMax" value="FATAL" />
</filter>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"/>
</layout>
</appender>
<root>
<priority value="ALL"/>
<level value="ALL"/>
<appender-ref ref="rollingAppender" />
</root>
</log4net>
\ No newline at end of file
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="3.1.28" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="System.Net.Http.Json" Version="3.2.0" />
</ItemGroup>
</Project>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace JK.ERP.WEBAPP
{
public class TodoItem
{
public string Title { get; set; }
public bool IsDone { get; set; }
}
}
@page "/"
<Layout ShowFooter="true">
<Header>
<div class="text-center header">Header</div>
</Header>
<Main>
<div class="text-center main">Main</div>
</Main>
<Footer>
<div class="text-center footer">Footer</div>
</Footer>
</Layout>
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace JK.ERP.WEBAPP
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
await builder.Build().RunAsync();
}
}
}
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:61910",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"JK.ERP.WEBAPP": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
@inherits LayoutComponentBase
<div class="wrapper">
@*<Header />
@Body
<Footer />*@
</div>
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
@using JK.ERP.WEBAPP
@using JK.ERP.WEBAPP.Shared
@using BootstrapBlazor
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="keywords" content="Meowv,qix,阿星Plus,个人博客">
<meta name="description" content="阿星Plus的个人博客,用于发表原创文章,关注微信公众号:『阿星Plus』了解更多。">
<title>😍阿星Plus⭐⭐⭐</title>
<base href="/" />
<link href="css/app.css" rel="stylesheet" />
</head>
<body>
<app>
<div class="loader"></div>
</app>
<script src="_framework/blazor.webassembly.js"></script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment