This commit is contained in:
汤龙 2025-02-12 19:23:50 +08:00
parent 9297749880
commit 6caede7880
285 changed files with 18589 additions and 3333 deletions

View File

@ -14,7 +14,7 @@ namespace VYD_XinWei.Commons.Filters
{
public void OnResultExecuted(ResultExecutedContext context)
{
}
public void OnResultExecuting(ResultExecutingContext context)
@ -27,12 +27,13 @@ namespace VYD_XinWei.Commons.Filters
if (context.Result is ObjectResult objectResult)
{
//LoggerType loggerType = LoggerType.Info;
WebResponseContent webResponseContent = new WebResponseContent() { Data= objectResult.Value };
WebResponseContent webResponseContent = new WebResponseContent() { Data = objectResult.Value };
// 如果没有设置状态码,默认为 200
if (objectResult.StatusCode==null|| objectResult.StatusCode.Value == 200)
if (objectResult.StatusCode == null || objectResult.StatusCode.Value == 200)
{
webResponseContent.ErrorCode = StatusCodes.Status200OK.ToString();
webResponseContent.ErrorCode = 0.ToString();
webResponseContent.Success = true;
webResponseContent.ErrorMsg = "成功";
}
else
{
@ -69,10 +70,10 @@ namespace VYD_XinWei.Commons.Filters
string message = null;
string code = "500";
object data = null;
if(exception is CustomException customException)
if (exception is CustomException customException)
{
message = customException.Message;
code = customException.Code;
code = customException.Code;
data = customException.GetResult();
statusCode = customException.Status;
}
@ -84,7 +85,7 @@ namespace VYD_XinWei.Commons.Filters
else
message = exception.Message;
WebResponseContent exceptionJsonResult = new WebResponseContent() { ErrorMsg = message, ErrorCode = code, Data = data, Success = false };
context.Result = new JsonResult(exceptionJsonResult) {StatusCode = StatusCodes.Status200OK };
context.Result = new JsonResult(exceptionJsonResult) { StatusCode = StatusCodes.Status200OK };
//// 获取 HttpContext
//var httpContext = context.HttpContext;
//var request = HttpRequestResponseFormat.FormatRequest(httpContext.Request).Result;
@ -100,10 +101,10 @@ namespace VYD_XinWei.Commons.Filters
public CustomException(string? message, Exception? innerException) : base()
{
}
public virtual int Status { get;protected set; } = 500;
public abstract string Code { get; set; }
public virtual int Status { get; protected set; } = 500;
public abstract string Code { get; set; }
public abstract object GetResult();
}
public abstract class CustomException<T> : CustomException
{

View File

@ -1,5 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Runtime.InteropServices;
namespace YD_XinWei.Commons.Utils
{
@ -108,6 +109,14 @@ namespace YD_XinWei.Commons.Utils
return true;
return str.ToString() == "";
}
public static bool _windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
public static string ReplacePath(this string path)
{
if (string.IsNullOrEmpty(path))
return "";
if (_windows)
return path.Replace("/", "\\");
return path.Replace("\\", "/");
}
}
}

View File

@ -0,0 +1,356 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"YD_XinWei.Commons/1.0.0": {
"dependencies": {
"Aliyun.OSS.SDK.NetCore": "2.14.1",
"Microsoft.AspNetCore.Mvc.Abstractions": "2.2.0",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "6.0.0",
"Newtonsoft.Json": "13.0.3",
"System.IdentityModel.Tokens.Jwt": "8.3.0"
},
"runtime": {
"YD_XinWei.Commons.dll": {}
}
},
"Aliyun.OSS.SDK.NetCore/2.14.1": {
"runtime": {
"lib/netstandard2.0/Aliyun.OSS.Core.dll": {
"assemblyVersion": "2.14.1.0",
"fileVersion": "2.14.1.0"
}
}
},
"Microsoft.AspNetCore.Http.Abstractions/2.2.0": {
"dependencies": {
"Microsoft.AspNetCore.Http.Features": "2.2.0",
"System.Text.Encodings.Web": "4.5.0"
}
},
"Microsoft.AspNetCore.Http.Features/2.2.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "2.2.0"
}
},
"Microsoft.AspNetCore.JsonPatch/6.0.0": {
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.3"
},
"runtime": {
"lib/net6.0/Microsoft.AspNetCore.JsonPatch.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52608"
}
}
},
"Microsoft.AspNetCore.Mvc.Abstractions/2.2.0": {
"dependencies": {
"Microsoft.AspNetCore.Routing.Abstractions": "2.2.0",
"Microsoft.Net.Http.Headers": "2.2.0"
}
},
"Microsoft.AspNetCore.Mvc.NewtonsoftJson/6.0.0": {
"dependencies": {
"Microsoft.AspNetCore.JsonPatch": "6.0.0",
"Newtonsoft.Json": "13.0.3",
"Newtonsoft.Json.Bson": "1.0.2"
},
"runtime": {
"lib/net6.0/Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52608"
}
}
},
"Microsoft.AspNetCore.Routing.Abstractions/2.2.0": {
"dependencies": {
"Microsoft.AspNetCore.Http.Abstractions": "2.2.0"
}
},
"Microsoft.Bcl.AsyncInterfaces/8.0.0": {
"runtime": {
"lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.23.53103"
}
}
},
"Microsoft.Bcl.TimeProvider/8.0.1": {
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "8.0.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Bcl.TimeProvider.dll": {
"assemblyVersion": "8.0.0.1",
"fileVersion": "8.0.123.58001"
}
}
},
"Microsoft.CSharp/4.7.0": {},
"Microsoft.Extensions.Primitives/2.2.0": {
"dependencies": {
"System.Memory": "4.5.1",
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
}
},
"Microsoft.IdentityModel.Abstractions/8.3.0": {
"runtime": {
"lib/net6.0/Microsoft.IdentityModel.Abstractions.dll": {
"assemblyVersion": "8.3.0.0",
"fileVersion": "8.3.0.51204"
}
}
},
"Microsoft.IdentityModel.JsonWebTokens/8.3.0": {
"dependencies": {
"Microsoft.Bcl.TimeProvider": "8.0.1",
"Microsoft.IdentityModel.Tokens": "8.3.0"
},
"runtime": {
"lib/net6.0/Microsoft.IdentityModel.JsonWebTokens.dll": {
"assemblyVersion": "8.3.0.0",
"fileVersion": "8.3.0.51204"
}
}
},
"Microsoft.IdentityModel.Logging/8.3.0": {
"dependencies": {
"Microsoft.IdentityModel.Abstractions": "8.3.0"
},
"runtime": {
"lib/net6.0/Microsoft.IdentityModel.Logging.dll": {
"assemblyVersion": "8.3.0.0",
"fileVersion": "8.3.0.51204"
}
}
},
"Microsoft.IdentityModel.Tokens/8.3.0": {
"dependencies": {
"Microsoft.Bcl.TimeProvider": "8.0.1",
"Microsoft.IdentityModel.Logging": "8.3.0"
},
"runtime": {
"lib/net6.0/Microsoft.IdentityModel.Tokens.dll": {
"assemblyVersion": "8.3.0.0",
"fileVersion": "8.3.0.51204"
}
}
},
"Microsoft.Net.Http.Headers/2.2.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "2.2.0",
"System.Buffers": "4.5.0"
}
},
"Newtonsoft.Json/13.0.3": {
"runtime": {
"lib/net6.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.3.27908"
}
}
},
"Newtonsoft.Json.Bson/1.0.2": {
"dependencies": {
"Newtonsoft.Json": "13.0.3"
},
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.Bson.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.2.22727"
}
}
},
"System.Buffers/4.5.0": {},
"System.IdentityModel.Tokens.Jwt/8.3.0": {
"dependencies": {
"Microsoft.IdentityModel.JsonWebTokens": "8.3.0",
"Microsoft.IdentityModel.Tokens": "8.3.0"
},
"runtime": {
"lib/net6.0/System.IdentityModel.Tokens.Jwt.dll": {
"assemblyVersion": "8.3.0.0",
"fileVersion": "8.3.0.51204"
}
}
},
"System.Memory/4.5.1": {},
"System.Runtime.CompilerServices.Unsafe/4.5.1": {},
"System.Text.Encodings.Web/4.5.0": {}
}
},
"libraries": {
"YD_XinWei.Commons/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Aliyun.OSS.SDK.NetCore/2.14.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-UOI6I8Uw8A7pFh2GS6CSpJuhmcHH45k6asex8SRnZed2WWBXeGEaBFyv3HsMJNp+B6gPqyN079sQHWenGd3Y7g==",
"path": "aliyun.oss.sdk.netcore/2.14.1",
"hashPath": "aliyun.oss.sdk.netcore.2.14.1.nupkg.sha512"
},
"Microsoft.AspNetCore.Http.Abstractions/2.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Nxs7Z1q3f1STfLYKJSVXCs1iBl+Ya6E8o4Oy1bCxJ/rNI44E/0f6tbsrVqAWfB7jlnJfyaAtIalBVxPKUPQb4Q==",
"path": "microsoft.aspnetcore.http.abstractions/2.2.0",
"hashPath": "microsoft.aspnetcore.http.abstractions.2.2.0.nupkg.sha512"
},
"Microsoft.AspNetCore.Http.Features/2.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ziFz5zH8f33En4dX81LW84I6XrYXKf9jg6aM39cM+LffN9KJahViKZ61dGMSO2gd3e+qe5yBRwsesvyqlZaSMg==",
"path": "microsoft.aspnetcore.http.features/2.2.0",
"hashPath": "microsoft.aspnetcore.http.features.2.2.0.nupkg.sha512"
},
"Microsoft.AspNetCore.JsonPatch/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-SUiwg0XQ5NtmnELHXSdX4mAwawFnAOwSx2Zz6NIhQnEN1tZDoAWEHc8dS/S7y8cE52+9bHj+XbYZuLGF7OrQPA==",
"path": "microsoft.aspnetcore.jsonpatch/6.0.0",
"hashPath": "microsoft.aspnetcore.jsonpatch.6.0.0.nupkg.sha512"
},
"Microsoft.AspNetCore.Mvc.Abstractions/2.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ET6uZpfVbGR1NjCuLaLy197cQ3qZUjzl7EG5SL4GfJH/c9KRE89MMBrQegqWsh0w1iRUB/zQaK0anAjxa/pz4g==",
"path": "microsoft.aspnetcore.mvc.abstractions/2.2.0",
"hashPath": "microsoft.aspnetcore.mvc.abstractions.2.2.0.nupkg.sha512"
},
"Microsoft.AspNetCore.Mvc.NewtonsoftJson/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-YMwSWgBuwkVn9k4/2wWxfwEbx8T5Utj13UH/zmUm5lbkKcY+tJyt9w9P4rY5pO1XtCitoh1+L+Feqz9qxG/CvA==",
"path": "microsoft.aspnetcore.mvc.newtonsoftjson/6.0.0",
"hashPath": "microsoft.aspnetcore.mvc.newtonsoftjson.6.0.0.nupkg.sha512"
},
"Microsoft.AspNetCore.Routing.Abstractions/2.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-lRRaPN7jDlUCVCp9i0W+PB0trFaKB0bgMJD7hEJS9Uo4R9MXaMC8X2tJhPLmeVE3SGDdYI4QNKdVmhNvMJGgPQ==",
"path": "microsoft.aspnetcore.routing.abstractions/2.2.0",
"hashPath": "microsoft.aspnetcore.routing.abstractions.2.2.0.nupkg.sha512"
},
"Microsoft.Bcl.AsyncInterfaces/8.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-3WA9q9yVqJp222P3x1wYIGDAkpjAku0TMUaaQV22g6L67AI0LdOIrVS7Ht2vJfLHGSPVuqN94vIr15qn+HEkHw==",
"path": "microsoft.bcl.asyncinterfaces/8.0.0",
"hashPath": "microsoft.bcl.asyncinterfaces.8.0.0.nupkg.sha512"
},
"Microsoft.Bcl.TimeProvider/8.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-C7kWHJnMRY7EvJev2S8+yJHZ1y7A4ZlLbA4NE+O23BDIAN5mHeqND1m+SKv1ChRS5YlCDW7yAMUe7lttRsJaAA==",
"path": "microsoft.bcl.timeprovider/8.0.1",
"hashPath": "microsoft.bcl.timeprovider.8.0.1.nupkg.sha512"
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
"path": "microsoft.csharp/4.7.0",
"hashPath": "microsoft.csharp.4.7.0.nupkg.sha512"
},
"Microsoft.Extensions.Primitives/2.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-azyQtqbm4fSaDzZHD/J+V6oWMFaf2tWP4WEGIYePLCMw3+b2RQdj9ybgbQyjCshcitQKQ4lEDOZjmSlTTrHxUg==",
"path": "microsoft.extensions.primitives/2.2.0",
"hashPath": "microsoft.extensions.primitives.2.2.0.nupkg.sha512"
},
"Microsoft.IdentityModel.Abstractions/8.3.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-jNin7yvWZu+K3U24q+6kD+LmGSRfbkHl9Px8hN1XrGwq6ZHgKGi/zuTm5m08G27fwqKfVXIWuIcUeq4Y1VQUOg==",
"path": "microsoft.identitymodel.abstractions/8.3.0",
"hashPath": "microsoft.identitymodel.abstractions.8.3.0.nupkg.sha512"
},
"Microsoft.IdentityModel.JsonWebTokens/8.3.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-4SVXLT8sDG7CrHiszEBrsDYi+aDW0W9d+fuWUGdZPBdan56aM6fGXJDjbI0TVGEDjJhXbACQd8F/BnC7a+m2RQ==",
"path": "microsoft.identitymodel.jsonwebtokens/8.3.0",
"hashPath": "microsoft.identitymodel.jsonwebtokens.8.3.0.nupkg.sha512"
},
"Microsoft.IdentityModel.Logging/8.3.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-4w4pSIGHhCCLTHqtVNR2Cc/zbDIUWIBHTZCu/9ZHm2SVwrXY3RJMcZ7EFGiKqmKZMQZJzA0bpwCZ6R8Yb7i5VQ==",
"path": "microsoft.identitymodel.logging/8.3.0",
"hashPath": "microsoft.identitymodel.logging.8.3.0.nupkg.sha512"
},
"Microsoft.IdentityModel.Tokens/8.3.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-yGzqmk+kInH50zeSEH/L1/J0G4/yqTQNq4YmdzOhpE7s/86tz37NS2YbbY2ievbyGjmeBI1mq26QH+yBR6AK3Q==",
"path": "microsoft.identitymodel.tokens/8.3.0",
"hashPath": "microsoft.identitymodel.tokens.8.3.0.nupkg.sha512"
},
"Microsoft.Net.Http.Headers/2.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-iZNkjYqlo8sIOI0bQfpsSoMTmB/kyvmV2h225ihyZT33aTp48ZpF6qYnXxzSXmHt8DpBAwBTX+1s1UFLbYfZKg==",
"path": "microsoft.net.http.headers/2.2.0",
"hashPath": "microsoft.net.http.headers.2.2.0.nupkg.sha512"
},
"Newtonsoft.Json/13.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
"path": "newtonsoft.json/13.0.3",
"hashPath": "newtonsoft.json.13.0.3.nupkg.sha512"
},
"Newtonsoft.Json.Bson/1.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-QYFyxhaABwmq3p/21VrZNYvCg3DaEoN/wUuw5nmfAf0X3HLjgupwhkEWdgfb9nvGAUIv3osmZoD3kKl4jxEmYQ==",
"path": "newtonsoft.json.bson/1.0.2",
"hashPath": "newtonsoft.json.bson.1.0.2.nupkg.sha512"
},
"System.Buffers/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pL2ChpaRRWI/p4LXyy4RgeWlYF2sgfj/pnVMvBqwNFr5cXg7CXNnWZWxrOONLg8VGdFB8oB+EG2Qw4MLgTOe+A==",
"path": "system.buffers/4.5.0",
"hashPath": "system.buffers.4.5.0.nupkg.sha512"
},
"System.IdentityModel.Tokens.Jwt/8.3.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-9GESpDG0Zb17HD5mBW/uEWi2yz/uKPmCthX2UhyLnk42moGH2FpMgXA2Y4l2Qc7P75eXSUTA6wb/c9D9GSVkzw==",
"path": "system.identitymodel.tokens.jwt/8.3.0",
"hashPath": "system.identitymodel.tokens.jwt.8.3.0.nupkg.sha512"
},
"System.Memory/4.5.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-sDJYJpGtTgx+23Ayu5euxG5mAXWdkDb4+b0rD0Cab0M1oQS9H0HXGPriKcqpXuiJDTV7fTp/d+fMDJmnr6sNvA==",
"path": "system.memory/4.5.1",
"hashPath": "system.memory.4.5.1.nupkg.sha512"
},
"System.Runtime.CompilerServices.Unsafe/4.5.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Zh8t8oqolRaFa9vmOZfdQm/qKejdqz0J9kr7o2Fu0vPeoH3BL1EOXipKWwkWtLT1JPzjByrF19fGuFlNbmPpiw==",
"path": "system.runtime.compilerservices.unsafe/4.5.1",
"hashPath": "system.runtime.compilerservices.unsafe.4.5.1.nupkg.sha512"
},
"System.Text.Encodings.Web/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Xg4G4Indi4dqP1iuAiMSwpiWS54ZghzR644OtsRCm/m/lBMG8dUBhLVN7hLm8NNrNTR+iGbshCPTwrvxZPlm4g==",
"path": "system.text.encodings.web/4.5.0",
"hashPath": "system.text.encodings.web.4.5.0.nupkg.sha512"
}
}
}

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("YD_XinWei.Commons")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+dc38461ab3d5355886477c5ce017e5a8d53b032c")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+929774988031cca82bdac9706a3078d4cad66bea")]
[assembly: System.Reflection.AssemblyProductAttribute("YD_XinWei.Commons")]
[assembly: System.Reflection.AssemblyTitleAttribute("YD_XinWei.Commons")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
65247451932fb6a1473b087a540d7cef1e306a7fc920c10a16025c3146816395
0d957c58615c426610070e828d0dddcdda8dbaf31fef27c72b605d896fc6ad58

View File

@ -1 +1 @@
{"documents":{"C:\\Users\\TangLong\\Desktop\\Code\\YD_XinWei\\*":"https://dev.azure.com/tanglong10081/YD_XinWei/_apis/git/repositories/YD_XinWei/items?api-version=1.0&versionType=commit&version=dc38461ab3d5355886477c5ce017e5a8d53b032c&path=/*"}}
{"documents":{"C:\\Users\\TangLong\\Desktop\\Code\\YD_XinWei\\*":"https://dev.azure.com/tanglong10081/YD_XinWei/_apis/git/repositories/YD_XinWei/items?api-version=1.0&versionType=commit&version=929774988031cca82bdac9706a3078d4cad66bea&path=/*"}}

View File

@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("YD_XinWei.Commons")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+929774988031cca82bdac9706a3078d4cad66bea")]
[assembly: System.Reflection.AssemblyProductAttribute("YD_XinWei.Commons")]
[assembly: System.Reflection.AssemblyTitleAttribute("YD_XinWei.Commons")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@ -0,0 +1 @@
606796293ab823ae3c7b928f5bd3d96877a1d7e5e15a563dc49e22f9310599cf

View File

@ -0,0 +1,15 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = YD_XinWei.Commons
build_property.ProjectDir = C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 6.0
build_property.EnableCodeStyleSeverity =

View File

@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -0,0 +1 @@
a5358a77df3b00039652aa3bb0386ae565f2482469789fb282b68df98c4ea622

View File

@ -0,0 +1,13 @@
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\bin\Release\net6.0\YD_XinWei.Commons.deps.json
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\bin\Release\net6.0\YD_XinWei.Commons.dll
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\bin\Release\net6.0\YD_XinWei.Commons.pdb
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\YD_XinWei.Commons.csproj.AssemblyReference.cache
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\YD_XinWei.Commons.GeneratedMSBuildEditorConfig.editorconfig
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\YD_XinWei.Commons.AssemblyInfoInputs.cache
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\YD_XinWei.Commons.AssemblyInfo.cs
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\YD_XinWei.Commons.csproj.CoreCompileInputs.cache
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\YD_XinWei.Commons.sourcelink.json
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\YD_XinWei.Commons.dll
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\refint\YD_XinWei.Commons.dll
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\YD_XinWei.Commons.pdb
C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei.Commons\obj\Release\net6.0\ref\YD_XinWei.Commons.dll

View File

@ -0,0 +1 @@
{"documents":{"C:\\Users\\TangLong\\Desktop\\Code\\YD_XinWei\\*":"https://dev.azure.com/tanglong10081/YD_XinWei/_apis/git/repositories/YD_XinWei/items?api-version=1.0&versionType=commit&version=929774988031cca82bdac9706a3078d4cad66bea&path=/*"}}

View File

@ -91,6 +91,11 @@
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.100\\RuntimeIdentifierGraph.json"
}
},
"runtimes": {
"linux-x64": {
"#import": []
}
}
}
}

View File

@ -347,6 +347,353 @@
}
}
}
},
"net6.0/linux-x64": {
"Aliyun.OSS.SDK.NetCore/2.14.1": {
"type": "package",
"compile": {
"lib/netstandard2.0/Aliyun.OSS.Core.dll": {
"related": ".pdb;.xml"
}
},
"runtime": {
"lib/netstandard2.0/Aliyun.OSS.Core.dll": {
"related": ".pdb;.xml"
}
}
},
"Microsoft.AspNetCore.Http.Abstractions/2.2.0": {
"type": "package",
"dependencies": {
"Microsoft.AspNetCore.Http.Features": "2.2.0",
"System.Text.Encodings.Web": "4.5.0"
},
"compile": {
"lib/netstandard2.0/Microsoft.AspNetCore.Http.Abstractions.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Microsoft.AspNetCore.Http.Abstractions.dll": {
"related": ".xml"
}
}
},
"Microsoft.AspNetCore.Http.Features/2.2.0": {
"type": "package",
"dependencies": {
"Microsoft.Extensions.Primitives": "2.2.0"
},
"compile": {
"lib/netstandard2.0/Microsoft.AspNetCore.Http.Features.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Microsoft.AspNetCore.Http.Features.dll": {
"related": ".xml"
}
}
},
"Microsoft.AspNetCore.JsonPatch/6.0.0": {
"type": "package",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1"
},
"compile": {
"lib/net6.0/Microsoft.AspNetCore.JsonPatch.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/Microsoft.AspNetCore.JsonPatch.dll": {
"related": ".xml"
}
}
},
"Microsoft.AspNetCore.Mvc.Abstractions/2.2.0": {
"type": "package",
"dependencies": {
"Microsoft.AspNetCore.Routing.Abstractions": "2.2.0",
"Microsoft.Net.Http.Headers": "2.2.0"
},
"compile": {
"lib/netstandard2.0/Microsoft.AspNetCore.Mvc.Abstractions.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Microsoft.AspNetCore.Mvc.Abstractions.dll": {
"related": ".xml"
}
}
},
"Microsoft.AspNetCore.Mvc.NewtonsoftJson/6.0.0": {
"type": "package",
"dependencies": {
"Microsoft.AspNetCore.JsonPatch": "6.0.0",
"Newtonsoft.Json": "13.0.1",
"Newtonsoft.Json.Bson": "1.0.2"
},
"compile": {
"lib/net6.0/Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll": {
"related": ".xml"
}
},
"frameworkReferences": [
"Microsoft.AspNetCore.App"
]
},
"Microsoft.AspNetCore.Routing.Abstractions/2.2.0": {
"type": "package",
"dependencies": {
"Microsoft.AspNetCore.Http.Abstractions": "2.2.0"
},
"compile": {
"lib/netstandard2.0/Microsoft.AspNetCore.Routing.Abstractions.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Microsoft.AspNetCore.Routing.Abstractions.dll": {
"related": ".xml"
}
}
},
"Microsoft.Bcl.AsyncInterfaces/8.0.0": {
"type": "package",
"compile": {
"lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": {
"related": ".xml"
}
}
},
"Microsoft.Bcl.TimeProvider/8.0.1": {
"type": "package",
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "8.0.0"
},
"compile": {
"lib/netstandard2.0/Microsoft.Bcl.TimeProvider.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Microsoft.Bcl.TimeProvider.dll": {
"related": ".xml"
}
},
"build": {
"buildTransitive/net6.0/_._": {}
}
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"compile": {
"ref/netcoreapp2.0/_._": {}
},
"runtime": {
"lib/netcoreapp2.0/_._": {}
}
},
"Microsoft.Extensions.Primitives/2.2.0": {
"type": "package",
"dependencies": {
"System.Memory": "4.5.1",
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
},
"compile": {
"lib/netstandard2.0/Microsoft.Extensions.Primitives.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Primitives.dll": {
"related": ".xml"
}
}
},
"Microsoft.IdentityModel.Abstractions/8.3.0": {
"type": "package",
"compile": {
"lib/net6.0/Microsoft.IdentityModel.Abstractions.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/Microsoft.IdentityModel.Abstractions.dll": {
"related": ".xml"
}
}
},
"Microsoft.IdentityModel.JsonWebTokens/8.3.0": {
"type": "package",
"dependencies": {
"Microsoft.Bcl.TimeProvider": "8.0.1",
"Microsoft.IdentityModel.Tokens": "8.3.0"
},
"compile": {
"lib/net6.0/Microsoft.IdentityModel.JsonWebTokens.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/Microsoft.IdentityModel.JsonWebTokens.dll": {
"related": ".xml"
}
}
},
"Microsoft.IdentityModel.Logging/8.3.0": {
"type": "package",
"dependencies": {
"Microsoft.IdentityModel.Abstractions": "8.3.0"
},
"compile": {
"lib/net6.0/Microsoft.IdentityModel.Logging.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/Microsoft.IdentityModel.Logging.dll": {
"related": ".xml"
}
}
},
"Microsoft.IdentityModel.Tokens/8.3.0": {
"type": "package",
"dependencies": {
"Microsoft.Bcl.TimeProvider": "8.0.1",
"Microsoft.IdentityModel.Logging": "8.3.0"
},
"compile": {
"lib/net6.0/Microsoft.IdentityModel.Tokens.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/Microsoft.IdentityModel.Tokens.dll": {
"related": ".xml"
}
}
},
"Microsoft.Net.Http.Headers/2.2.0": {
"type": "package",
"dependencies": {
"Microsoft.Extensions.Primitives": "2.2.0",
"System.Buffers": "4.5.0"
},
"compile": {
"lib/netstandard2.0/Microsoft.Net.Http.Headers.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Microsoft.Net.Http.Headers.dll": {
"related": ".xml"
}
}
},
"Newtonsoft.Json/13.0.3": {
"type": "package",
"compile": {
"lib/net6.0/Newtonsoft.Json.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/Newtonsoft.Json.dll": {
"related": ".xml"
}
}
},
"Newtonsoft.Json.Bson/1.0.2": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "12.0.1"
},
"compile": {
"lib/netstandard2.0/Newtonsoft.Json.Bson.dll": {
"related": ".pdb;.xml"
}
},
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.Bson.dll": {
"related": ".pdb;.xml"
}
}
},
"System.Buffers/4.5.0": {
"type": "package",
"compile": {
"ref/netcoreapp2.0/_._": {}
},
"runtime": {
"lib/netcoreapp2.0/_._": {}
}
},
"System.IdentityModel.Tokens.Jwt/8.3.0": {
"type": "package",
"dependencies": {
"Microsoft.IdentityModel.JsonWebTokens": "8.3.0",
"Microsoft.IdentityModel.Tokens": "8.3.0"
},
"compile": {
"lib/net6.0/System.IdentityModel.Tokens.Jwt.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/System.IdentityModel.Tokens.Jwt.dll": {
"related": ".xml"
}
}
},
"System.Memory/4.5.1": {
"type": "package",
"compile": {
"ref/netcoreapp2.1/_._": {}
},
"runtime": {
"lib/netcoreapp2.1/_._": {}
}
},
"System.Runtime.CompilerServices.Unsafe/4.5.1": {
"type": "package",
"compile": {
"ref/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll": {
"related": ".xml"
}
}
},
"System.Text.Encodings.Web/4.5.0": {
"type": "package",
"compile": {
"lib/netstandard2.0/System.Text.Encodings.Web.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/System.Text.Encodings.Web.dll": {
"related": ".xml"
}
}
}
}
},
"libraries": {
@ -966,6 +1313,11 @@
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.100\\RuntimeIdentifierGraph.json"
}
},
"runtimes": {
"linux-x64": {
"#import": []
}
}
},
"logs": [
@ -976,7 +1328,8 @@
"message": "包 \"System.Text.Encodings.Web\" 4.5.0 具有已知的 严重 严重性漏洞https://github.com/advisories/GHSA-ghhp-997w-qr28",
"libraryId": "System.Text.Encodings.Web",
"targetGraphs": [
"net6.0"
"net6.0",
"net6.0/linux-x64"
]
}
]

View File

@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "wKC9CAFzTlg=",
"dgSpecHash": "SKnWqtqGijw=",
"success": true,
"projectFilePath": "C:\\Users\\TangLong\\Desktop\\Code\\YD_XinWei\\Server\\YD_XinWei.Commons\\YD_XinWei.Commons.csproj",
"expectedPackageFiles": [
@ -36,7 +36,8 @@
"message": "包 \"System.Text.Encodings.Web\" 4.5.0 具有已知的 严重 严重性漏洞https://github.com/advisories/GHSA-ghhp-997w-qr28",
"libraryId": "System.Text.Encodings.Web",
"targetGraphs": [
"net6.0"
"net6.0",
"net6.0/linux-x64"
]
}
]

View File

@ -1,45 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using YD_XinWei.Api.Services.Interface;
using YD_XinWei.Commons.Dto.School;
namespace YD_XinWei.Api.Controllers
{
/// <summary>
/// 学生
/// </summary>
[ApiController]
[ApiExplorerSettings(GroupName = "v1")]
[Route("[controller]")]
public class StudentController : ControllerBase
{
private readonly IStudentService _studentService;
public StudentController(IStudentService studentService)
{
_studentService = studentService;
}
/// <summary>
/// 获取班级列表
/// </summary>
/// <param name="teacherPhoneNo"></param>
/// <returns></returns>
[HttpGet("ClassListbyTeacher")]
public async Task<List<ClassListDto>> ClassListbyTeacher(string teacherPhoneNo)
{
var res = await _studentService.ClassListbyTeacher(teacherPhoneNo);
return res;
}
/// <summary>
/// 获取学生列表
/// </summary>
/// <param name="classId"></param>
/// <returns></returns>
[HttpGet("StudentListByClassId")]
public async Task<List<StudentListDto>> StudentListByClassId(int classId)
{
var res = await _studentService.StudentListByClassId(classId);
return res;
}
}
}

View File

@ -1,94 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using YD_XinWei.Commons;
using YD_XinWei.Commons.Exceptions;
using TGJ.NetworkFreight.SeckillAggregateServices.Pos.UserService;
using YD_XinWei.Api.Utilities;
using YD_XinWei.Api.WeChat.Lib;
using YD_XinWei.Api.Services.Interface;
using YD_XinWei.Api.WeChat;
namespace YD_XinWei.Api.Controllers
{
/// <summary>
/// 用户
/// </summary>
[ApiController]
[ApiExplorerSettings(GroupName = "v1")]
[Route("[controller]")]
public class UserController : ControllerBase
{
private readonly IUserService _userService;
public UserController(IUserService userService)
{
_userService = userService;
}
/// <summary>
/// 获取微信信息
/// </summary>
/// <param name="wXLoginPo"></param>
/// <returns></returns>
[HttpPost("WXUserInfo")]
public WechatUserInfo GetWXUserInfo(WXLoginPo wXLoginPo)
{
var wli = new WechatLoginInfo();
wli.code = wXLoginPo.code;
wli.encryptedData = wXLoginPo.encryptedData;
wli.iv = wXLoginPo.iv;
wli.rawData = wXLoginPo.rawData;
wli.signature = wXLoginPo.signature;
wli.appid = AppSettings.WeChat.Appid;
wli.secret = AppSettings.WeChat.Appid;
WechatUserInfo wechatResult = new WeChatAppDecrypt().Decrypt(wli);
if (wechatResult == null || string.IsNullOrWhiteSpace(wechatResult.openId))
{
throw new BizException("用户信息获取失败");
}
return wechatResult;
}
/// <summary>
/// 用户名密码登录
/// </summary>
/// <returns></returns>
[HttpPost(nameof(Login))]
[AllowAnonymous]
public async Task<IActionResult> Login([FromBody] LoginInfo paramDto)
{
var res = await _userService.Login(paramDto);
return Ok(res);
}
/// <summary>
/// 微信用户登录
/// </summary>
/// <returns></returns>
[HttpPost("WxLogin")]
[AllowAnonymous]
public async Task<IActionResult> WxLogin(WXLoginPo loginPo)
{
//var id = UserLoginContext.Current.UserId;
var res = await _userService.WxLogin(loginPo);
return Ok(res);
}
/// <summary>
/// 关联账号
/// </summary>
/// <param name="relevanceId"></param>
/// <returns></returns>
[HttpGet("RelatedAccounts")]
public async Task<List<RelatedAccountsDto>> RelatedAccounts(Guid relevanceId)
{
var res = await _userService.RelatedAccounts(relevanceId);
return res;
}
}
}

View File

@ -87,7 +87,7 @@ namespace YD_XinWei.Api.Controllers
/// <summary>
/// 查询训练评分规则
/// </summary>
/// <param name="dto"></param>
/// <param name="orgId"></param>
/// <returns></returns>
[HttpGet]
[Route("/sports/{apiVersion}/project/getScoreRules")]

View File

@ -7,15 +7,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>C:\Users\HHST102\Desktop\web</PublishUrl>
<PublishUrl>C:\Users\TangLong\Desktop\web</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net6.0</TargetFramework>
<ProjectGuid>9afb29dd-781b-44b2-a88c-562a0ffdaac3</ProjectGuid>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<_PublishTargetUrl>C:\Users\HHST102\Desktop\web</_PublishTargetUrl>
<History>True|2024-10-08T02:27:01.3672443Z||;True|2024-10-08T10:16:00.0834614+08:00||;</History>
<_PublishTargetUrl>C:\Users\TangLong\Desktop\web</_PublishTargetUrl>
<History>True|2025-02-11T13:19:13.6318600Z||;True|2025-02-09T16:36:10.7108847+08:00||;True|2025-02-09T16:29:51.7125871+08:00||;True|2025-02-09T16:07:23.2042495+08:00||;False|2025-02-09T16:06:37.4330989+08:00||;True|2024-10-08T10:27:01.3672443+08:00||;True|2024-10-08T10:16:00.0834614+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

View File

@ -1,50 +0,0 @@
using Microsoft.EntityFrameworkCore;
using YD_XinWei.Api.Context;
using YD_XinWei.Api.Services.Interface;
using YD_XinWei.Api.SmartSportsEntitys;
using YD_XinWei.Commons.Dto.School;
namespace YD_XinWei.Api.Services.Impl
{
public class StudentService : IStudentService
{
public SmartSportsContext _sportsContext;
public StudentService(SmartSportsContext sportsContext)
{
_sportsContext = sportsContext;
}
public async Task<List<ClassListDto>> ClassListbyTeacher(string teacherPhoneNo)
{
//var classList = await (
// from t in _sportsContext.Teacher
// join a in _sportsContext.ClassAssocTeacher on t.Id equals a.TeacherId
// join c in _sportsContext.Class on a.ClassId equals c.Id
// where t.TeacherPhoneNo == teacherPhoneNo
// select new ClassListDto()
// {
// ClassId = c.Id,
// Name = $"{c.GradeName}-{c.ClassName}"
// }).ToListAsync();
//return classList;
return null;
}
public async Task<List<StudentListDto>> StudentListByClassId(int classId)
{
//var students = await _sportsContext.Student.Where(x => x.ClassId == classId).Select(x => new StudentListDto()
//{
// StudentNo = x.StudentNo,
// StudentName = x.StudentName,
// Sex = x.Sex,
// Photo = x.Photo
//}).ToListAsync();
//return students;
return null;
}
}
}

View File

@ -1,224 +0,0 @@
using Microsoft.EntityFrameworkCore;
using YD_XinWei.Commons;
using YD_XinWei.Api.Utilities;
using YD_XinWei.Commons.Exceptions;
using Microsoft.AspNetCore.Mvc;
using TGJ.NetworkFreight.SeckillAggregateServices.Pos.UserService;
using YD_XinWei.Api.Entitys;
using YD_XinWei.Commons.Users;
using System.Linq.Expressions;
using YD_XinWei.Api.WeChat.Lib;
using YD_XinWei.Api.Context;
using YD_XinWei.Api.Services.Interface;
using YD_XinWei.Api.WeChat;
namespace YD_XinWei.Api.Services.Impl
{
public class UserService : IUserService
{
public UserContext _userContext;
public SmartSportsContext _smartSportsContext;
public UserService(UserContext userContext, SmartSportsContext smartSportsContext)
{
_userContext = userContext;
_smartSportsContext = smartSportsContext;
}
public async Task<UserInfoDto> Login(LoginInfo paramDto)
{
User userModel = null;
//switch (paramDto.RoleId)
//{
// case 2: // 教师登录
// userModel = await QueryUserByRole(
// x => x.PhoneNo == paramDto.Key && x.UserPwd == paramDto.Password,
// () => GetTeacherUser(paramDto)
// );
// break;
// case 3: // 家长登录
// userModel = await QueryUserByRole(
// x => x.UserName == paramDto.Key && x.UserPwd == paramDto.Password,
// () => GetParentUser(paramDto)
// );
// break;
// default:
// throw new BizException("无效的角色ID");
//}
//if (userModel == null || userModel.User_Id <= 0)
// throw new BizException("用户新增失败");
return GenerateUserInfoDto(userModel);
}
private async Task<User> QueryUserByRole(Expression<Func<User, bool>> queryCondition, Func<Task<UserModelDataDto>> createUser)
{
var userModel = await _userContext.Users.FirstOrDefaultAsync(queryCondition);
if (userModel == null)
{
var userData = await createUser();
if (userData == null)
throw new BizException("账号或密码错误");
userModel = CreateUserModel(userData);
// 保存新用户信息
await _userContext.Users.AddAsync(userModel);
await _userContext.SaveChangesAsync();
}
return userModel;
}
private User CreateUserModel(UserModelDataDto userData)
{
return new User()
{
ModifyDate = DateTime.Now,
CreateDate = DateTime.Now,
Enable = true,
RoleName = userData.RoleName,
Role_Id = userData.RoleId,
HeadImageUrl = userData.HeadImageUrl,
Address = userData.Address,
Gender = userData.Gender,
Email = userData.Email,
PhoneNo = userData.PhoneNo,
SchoolCode = userData.SchoolCode,
UserName = userData.UserName,
UserPwd = userData.UserPwd,
RelevanceId = Guid.NewGuid()
};
}
private UserInfoDto GenerateUserInfoDto(User userModel)
{
string token = JwtHelper.IssueJwt(new UserInfoDto()
{
User_Id = userModel.User_Id,
UserName = userModel.UserName,
Role_Id = userModel.Role_Id,
PhoneNo = userModel.PhoneNo ?? "",
SchoolCode = userModel.SchoolCode,
UserTrueName = userModel.UserName
});
return new UserInfoDto()
{
SchoolCode = userModel.SchoolCode,
Enable = userModel.Enable,
PhoneNo = userModel.PhoneNo,
RoleName = userModel.RoleName,
Role_Id = userModel.Role_Id,
UserName = userModel.UserName,
UserTrueName = userModel.UserName,
User_Id = userModel.User_Id,
RelevanceId = userModel.RelevanceId,
Token = token
};
}
public async Task<UserInfoDto> WxLogin(WXLoginPo loginPo)
{
var wli = new WechatLoginInfo();
wli.code = loginPo.code;
wli.encryptedData = loginPo.encryptedData;
wli.iv = loginPo.iv;
wli.rawData = loginPo.rawData;
wli.signature = loginPo.signature;
wli.appid = AppSettings.WeChat.Appid;
wli.secret = AppSettings.WeChat.Appid;
WechatUserInfo wechatResult = new WeChatAppDecrypt().Decrypt(wli);
if (wechatResult == null || string.IsNullOrWhiteSpace(wechatResult.phoneNumber))
{
throw new BizException("手机号获取失败");
}
var userInfo = await _userContext.Users.FirstOrDefaultAsync(x => x.wx_OpenID == wechatResult.openId);
if (null == userInfo || userInfo.User_Id == 0)
{
var model = new User()
{
ModifyDate = DateTime.Now,
CreateDate = DateTime.Now,
PhoneNo = wechatResult.phoneNumber,
wx_HeadImgUrl = wechatResult.avatarUrl,
wx_NickName = wechatResult.nickName,
UserTrueName = wechatResult.nickName,
wx_OpenID = wechatResult.openId,
wx_UnionID = wechatResult.unionId,
Enable = true,
RoleName = "用户",
Role_Id = 1,
RelevanceId = loginPo.RelevanceId ?? Guid.NewGuid()
};
await _userContext.Users.AddAsync(model);
await _userContext.SaveChangesAsync();
if (model == null || model.User_Id <= 0)
{
throw new BizException("用户新增失败");
}
}
else
{
userInfo.wx_HeadImgUrl = wechatResult.avatarUrl;
userInfo.wx_NickName = wechatResult.nickName;
userInfo.wx_UnionID = wechatResult.unionId;
userInfo.ModifyDate = DateTime.Now;
_userContext.Users.Update(userInfo);
await _userContext.SaveChangesAsync();
}
string token = JwtHelper.IssueJwt(new UserInfoDto()
{
User_Id = userInfo.User_Id,
UserName = userInfo.UserName,
Role_Id = userInfo.Role_Id
});
return new UserInfoDto()
{
Enable = userInfo.Enable,
PhoneNo = userInfo.PhoneNo,
RoleName = userInfo.RoleName,
Role_Id = userInfo.Role_Id,
UserName = userInfo.UserName,
UserTrueName = userInfo.UserName,
User_Id = userInfo.User_Id,
RelevanceId = userInfo.RelevanceId,
Token = token
};
}
public async Task<List<RelatedAccountsDto>> RelatedAccounts(Guid relevanceId)
{
var roleId = UserLoginContext.Current.RoleId;
var res = await _userContext.Users.Where(x => x.RelevanceId == relevanceId).Select(s => new RelatedAccountsDto()
{
RoleId = s.Role_Id,
IsCurrentLogin = s.Role_Id == roleId,
Key = s.UserName ?? "",
UserPwd = s.UserPwd ?? "",
OpenId = s.wx_OpenID ?? ""
}).ToListAsync();
return res;
}
}
}

View File

@ -1,26 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using TGJ.NetworkFreight.SeckillAggregateServices.Pos.UserService;
using YD_XinWei.Api;
using YD_XinWei.Api.Entitys;
using YD_XinWei.Commons;
using YD_XinWei.Commons.Dto.School;
namespace YD_XinWei.Api.Services.Interface
{
public interface IStudentService
{
/// <summary>
/// 获取班级列表
/// </summary>
/// <param name="teacherPhoneNo"></param>
/// <returns></returns>
Task<List<ClassListDto>> ClassListbyTeacher(string teacherPhoneNo);
/// <summary>
/// 获取学生列表
/// </summary>
/// <param name="classId"></param>
/// <returns></returns>
Task<List<StudentListDto>> StudentListByClassId(int classId);
}
}

View File

@ -1,31 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using TGJ.NetworkFreight.SeckillAggregateServices.Pos.UserService;
using YD_XinWei.Api;
using YD_XinWei.Api.Entitys;
using YD_XinWei.Commons;
namespace YD_XinWei.Api.Services.Interface
{
public interface IUserService
{
/// <summary>
/// 账号密码登录
/// </summary>
/// <returns></returns>
Task<UserInfoDto> Login(LoginInfo paramDto);
/// <summary>
/// 微信登录
/// </summary>
/// <param name="loginPo"></param>
/// <returns></returns>
Task<UserInfoDto> WxLogin(WXLoginPo loginPo);
/// <summary>
/// 获取关联账号列表
/// </summary>
/// <param name="relevanceId"></param>
/// <returns></returns>
Task<List<RelatedAccountsDto>> RelatedAccounts(Guid relevanceId);
}
}

View File

@ -24,6 +24,7 @@ using YD_XinWei.Api.Extensions;
using System.Text.Json;
using VYD_XinWei.Commons.Filters;
using Microsoft.AspNetCore.Mvc.Versioning;
using Microsoft.Extensions.FileProviders;
namespace YD_XinWei.Api
{
@ -59,8 +60,6 @@ namespace YD_XinWei.Api
});
services.AddSingleton<JwtHelper>();
services.AddScoped<IUserService, UserService>();
services.AddScoped<IStudentService, StudentService>();
services.AddScoped<IXinWeiService, XinWeiService>();
@ -261,26 +260,26 @@ namespace YD_XinWei.Api
//app.Use(HttpRequestMiddleware.Context);
//2021.06.27增加创建默认upload文件夹
//string _uploadPath = (env.ContentRootPath + "/Upload").ReplacePath();
string _uploadPath = (env.ContentRootPath + "/Upload").ReplacePath();
//if (!Directory.Exists(_uploadPath))
//{
// Directory.CreateDirectory(_uploadPath);
//}
if (!Directory.Exists(_uploadPath))
{
Directory.CreateDirectory(_uploadPath);
}
//app.UseStaticFiles(new StaticFileOptions()
//{
// FileProvider = new PhysicalFileProvider(
// Path.Combine(Directory.GetCurrentDirectory(), @"Upload")),
// //配置访问虚拟目录时文件夹别名
// RequestPath = "/Upload",
// OnPrepareResponse = (Microsoft.AspNetCore.StaticFiles.StaticFileResponseContext staticFile) =>
// {
// //可以在此处读取请求的信息进行权限认证
// // staticFile.File
// // staticFile.Context.Response.StatusCode;
// }
//});
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"Upload")),
//配置访问虚拟目录时文件夹别名
RequestPath = "/Upload",
OnPrepareResponse = (Microsoft.AspNetCore.StaticFiles.StaticFileResponseContext staticFile) =>
{
//可以在此处读取请求的信息进行权限认证
// staticFile.File
// staticFile.Context.Response.StatusCode;
}
});
//配置HttpContext
app.UseStaticHttpContext();

View File

@ -7,6 +7,6 @@
<ActiveDebugProfile>SimCalibration</ActiveDebugProfile>
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
<NameOfLastUsedPublishProfile>C:\Users\HHST102\Desktop\GitCode\YD_WeChatApplet\Server\WeChatApplet\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>C:\Users\TangLong\Desktop\Code\YD_XinWei\Server\YD_XinWei\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
</Project>

View File

@ -14,56 +14,6 @@
用户服务上下文
</summary>
</member>
<member name="T:YD_XinWei.Api.Controllers.StudentController">
<summary>
学生
</summary>
</member>
<member name="M:YD_XinWei.Api.Controllers.StudentController.ClassListbyTeacher(System.String)">
<summary>
获取班级列表
</summary>
<param name="teacherPhoneNo"></param>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Controllers.StudentController.StudentListByClassId(System.Int32)">
<summary>
获取学生列表
</summary>
<param name="classId"></param>
<returns></returns>
</member>
<member name="T:YD_XinWei.Api.Controllers.UserController">
<summary>
用户
</summary>
</member>
<member name="M:YD_XinWei.Api.Controllers.UserController.GetWXUserInfo(TGJ.NetworkFreight.SeckillAggregateServices.Pos.UserService.WXLoginPo)">
<summary>
获取微信信息
</summary>
<param name="wXLoginPo"></param>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Controllers.UserController.Login(YD_XinWei.Commons.LoginInfo)">
<summary>
用户名密码登录
</summary>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Controllers.UserController.WxLogin(TGJ.NetworkFreight.SeckillAggregateServices.Pos.UserService.WXLoginPo)">
<summary>
微信用户登录
</summary>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Controllers.UserController.RelatedAccounts(System.Guid)">
<summary>
关联账号
</summary>
<param name="relevanceId"></param>
<returns></returns>
</member>
<member name="T:YD_XinWei.Api.Controllers.XinWeiController">
<summary>
芯未
@ -104,7 +54,7 @@
<summary>
查询训练评分规则
</summary>
<param name="dto"></param>
<param name="orgId"></param>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Controllers.XinWeiController.AddTrain(YD_XinWei.Commons.Dto.Open.AddTrainDto)">
@ -315,40 +265,6 @@
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Services.Interface.IStudentService.ClassListbyTeacher(System.String)">
<summary>
获取班级列表
</summary>
<param name="teacherPhoneNo"></param>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Services.Interface.IStudentService.StudentListByClassId(System.Int32)">
<summary>
获取学生列表
</summary>
<param name="classId"></param>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Services.Interface.IUserService.Login(YD_XinWei.Commons.LoginInfo)">
<summary>
账号密码登录
</summary>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Services.Interface.IUserService.WxLogin(TGJ.NetworkFreight.SeckillAggregateServices.Pos.UserService.WXLoginPo)">
<summary>
微信登录
</summary>
<param name="loginPo"></param>
<returns></returns>
</member>
<member name="M:YD_XinWei.Api.Services.Interface.IUserService.RelatedAccounts(System.Guid)">
<summary>
获取关联账号列表
</summary>
<param name="relevanceId"></param>
<returns></returns>
</member>
<member name="T:YD_XinWei.Api.Services.Interface.IXinWeiService">
<summary>
服务接口

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,20 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "6.0.0"
}
],
"configProperties": {
"System.GC.Server": true,
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@ -0,0 +1,5 @@
{
"Version": 1,
"ManifestType": "Build",
"Endpoints": []
}

View File

@ -0,0 +1 @@
{"ContentRoots":["C:\\Users\\HHST102\\Desktop\\GitCode\\YD_WeChatApplet\\Server\\WeChatApplet\\wwwroot\\"],"Root":{"Children":null,"Asset":null,"Patterns":[{"ContentRootIndex":0,"Pattern":"**","Depth":0}]}}

File diff suppressed because it is too large Load Diff

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