Browse Source

添加项目文件。

master
faker 2 years ago
parent
commit
12b8e8238b
  1. 25
      src/.dockerignore
  2. 51
      src/.vscode/launch.json
  3. 8
      src/.vscode/solution-explorer/class.cs-template
  4. 3
      src/.vscode/solution-explorer/class.ts-template
  5. 9
      src/.vscode/solution-explorer/class.vb-template
  6. 3
      src/.vscode/solution-explorer/default.ts-template
  7. 8
      src/.vscode/solution-explorer/enum.cs-template
  8. 8
      src/.vscode/solution-explorer/interface.cs-template
  9. 3
      src/.vscode/solution-explorer/interface.ts-template
  10. 46
      src/.vscode/solution-explorer/template-list.json
  11. 17
      src/.vscode/solution-explorer/template-parameters.js
  12. 42
      src/.vscode/tasks.json
  13. 29
      src/Dockerfile
  14. 21
      src/LICENSE
  15. 1
      src/README.md
  16. 12
      src/Znyc.Recruitment.Api/.config/dotnet-tools.json
  17. 39
      src/Znyc.Recruitment.Api/Aop/AopHelper.cs
  18. 67
      src/Znyc.Recruitment.Api/Aop/TransactionInterceptor.cs
  19. 44
      src/Znyc.Recruitment.Api/Attributes/HiddenApiAttribute .cs
  20. 12
      src/Znyc.Recruitment.Api/Attributes/LoginAttribute.cs
  21. 12
      src/Znyc.Recruitment.Api/Attributes/NoOprationLogAttribute.cs
  22. 55
      src/Znyc.Recruitment.Api/Attributes/PermissionAttribute.cs
  23. 67
      src/Znyc.Recruitment.Api/Attributes/QuartzAttribute.cs
  24. 32
      src/Znyc.Recruitment.Api/Attributes/ValidateInputAttribute.cs
  25. 22
      src/Znyc.Recruitment.Api/Attributes/VersionRouteAttribute.cs
  26. 25
      src/Znyc.Recruitment.Api/Auth/ApiHandler.cs
  27. 13
      src/Znyc.Recruitment.Api/Auth/IApiHandler.cs
  28. 18
      src/Znyc.Recruitment.Api/Auth/IPermissionHandler.cs
  29. 35
      src/Znyc.Recruitment.Api/Auth/PermissionHandler.cs
  30. 74
      src/Znyc.Recruitment.Api/Auth/ResponseAuthenticationHandler.cs
  31. 121
      src/Znyc.Recruitment.Api/Controllers/ActivityController.cs
  32. 156
      src/Znyc.Recruitment.Api/Controllers/ApplyJobController.cs
  33. 35
      src/Znyc.Recruitment.Api/Controllers/AuditController.cs
  34. 63
      src/Znyc.Recruitment.Api/Controllers/AuthController.cs
  35. 36
      src/Znyc.Recruitment.Api/Controllers/BannerController.cs
  36. 15
      src/Znyc.Recruitment.Api/Controllers/BaseController.cs
  37. 51
      src/Znyc.Recruitment.Api/Controllers/BrowseController.cs
  38. 37
      src/Znyc.Recruitment.Api/Controllers/CallFeedbackController.cs
  39. 58
      src/Znyc.Recruitment.Api/Controllers/CertificationController.cs
  40. 42
      src/Znyc.Recruitment.Api/Controllers/CityEncyclopediaController.cs
  41. 79
      src/Znyc.Recruitment.Api/Controllers/CollectionController.cs
  42. 49
      src/Znyc.Recruitment.Api/Controllers/CurrencyController.cs
  43. 36
      src/Znyc.Recruitment.Api/Controllers/CurrencyIntroController.cs
  44. 76
      src/Znyc.Recruitment.Api/Controllers/DeliveryResumeController.cs
  45. 61
      src/Znyc.Recruitment.Api/Controllers/DictionaryController.cs
  46. 36
      src/Znyc.Recruitment.Api/Controllers/DocumentController.cs
  47. 34
      src/Znyc.Recruitment.Api/Controllers/FeedbackController.cs
  48. 37
      src/Znyc.Recruitment.Api/Controllers/IndustryJobsController.cs
  49. 41
      src/Znyc.Recruitment.Api/Controllers/LoginController.cs
  50. 80
      src/Znyc.Recruitment.Api/Controllers/MessageController.cs
  51. 39
      src/Znyc.Recruitment.Api/Controllers/ProductCategoryController.cs
  52. 40
      src/Znyc.Recruitment.Api/Controllers/ProductInfoController.cs
  53. 37
      src/Znyc.Recruitment.Api/Controllers/ProductPicController.cs
  54. 37
      src/Znyc.Recruitment.Api/Controllers/ProudctWarehouseController.cs
  55. 100
      src/Znyc.Recruitment.Api/Controllers/QuartzController.cs
  56. 34
      src/Znyc.Recruitment.Api/Controllers/RechargeController.cs
  57. 201
      src/Znyc.Recruitment.Api/Controllers/RecruitmentController.cs
  58. 36
      src/Znyc.Recruitment.Api/Controllers/ShareController.cs
  59. 46
      src/Znyc.Recruitment.Api/Controllers/SignController.cs
  60. 72
      src/Znyc.Recruitment.Api/Controllers/UserController.cs
  61. 48
      src/Znyc.Recruitment.Api/Controllers/WxPayController.cs
  62. 18
      src/Znyc.Recruitment.Api/Db/Data.cs
  63. 2777
      src/Znyc.Recruitment.Api/Db/Data/data.json
  64. 62
      src/Znyc.Recruitment.Api/Db/DbHelper.cs
  65. 67
      src/Znyc.Recruitment.Api/Db/ServiceCollectionExtensions.cs
  66. 29
      src/Znyc.Recruitment.Api/Dockerfile
  67. 18
      src/Znyc.Recruitment.Api/Enums/ApiVersion.cs
  68. 40
      src/Znyc.Recruitment.Api/Enums/StatusCodes.cs
  69. 55
      src/Znyc.Recruitment.Api/Extensions/EventBusExtension.cs
  70. 75
      src/Znyc.Recruitment.Api/Extensions/HangFireExtension.cs
  71. 41
      src/Znyc.Recruitment.Api/Extensions/RabbitMQExtension.cs
  72. 36
      src/Znyc.Recruitment.Api/Extensions/UploadConfigApplicationBuilderExtensions.cs
  73. 59
      src/Znyc.Recruitment.Api/Filters/ExceptionFilter.cs
  74. 69
      src/Znyc.Recruitment.Api/Program.cs
  75. 34
      src/Znyc.Recruitment.Api/Properties/launchSettings.json
  76. 398
      src/Znyc.Recruitment.Api/Startup.cs
  77. 116
      src/Znyc.Recruitment.Api/Znyc.Recruitment.Api.csproj
  78. 904
      src/Znyc.Recruitment.Api/Znyc.Recruitment.Api.xml
  79. 38
      src/Znyc.Recruitment.Api/appsettings.Development.json
  80. 40
      src/Znyc.Recruitment.Api/appsettings.Production.json
  81. 41
      src/Znyc.Recruitment.Api/appsettings.Staging.json
  82. 289
      src/Znyc.Recruitment.Api/configs/appconfig.Development.json
  83. 291
      src/Znyc.Recruitment.Api/configs/appconfig.Production.json
  84. 295
      src/Znyc.Recruitment.Api/configs/appconfig.Staging.json
  85. 30
      src/Znyc.Recruitment.Api/nlog.Production.config
  86. 30
      src/Znyc.Recruitment.Api/nlog.config
  87. 19
      src/Znyc.Recruitment.Common/Attributes/MasterTableAttribute.cs
  88. 12
      src/Znyc.Recruitment.Common/Attributes/SingleInstanceAttribute.cs
  89. 9
      src/Znyc.Recruitment.Common/Attributes/SnowflakeAttribute.cs
  90. 23
      src/Znyc.Recruitment.Common/Attributes/TransactionAttribute.cs
  91. 48
      src/Znyc.Recruitment.Common/Auth/ClaimAttributes.cs
  92. 46
      src/Znyc.Recruitment.Common/Auth/IUser.cs
  93. 11
      src/Znyc.Recruitment.Common/Auth/IUserToken.cs
  94. 146
      src/Znyc.Recruitment.Common/Auth/User.cs
  95. 51
      src/Znyc.Recruitment.Common/Auth/UserToken.cs
  96. 25
      src/Znyc.Recruitment.Common/BaseModel/Entity.cs
  97. 39
      src/Znyc.Recruitment.Common/BaseModel/EntityAdd.cs
  98. 55
      src/Znyc.Recruitment.Common/BaseModel/EntityBase.cs
  99. 22
      src/Znyc.Recruitment.Common/BaseModel/EntitySoftDelete.cs
  100. 39
      src/Znyc.Recruitment.Common/BaseModel/EntityUpdate.cs

25
src/.dockerignore

@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

51
src/.vscode/launch.json

@ -0,0 +1,51 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/<target-framework>/<project-name.dll>",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole"
},
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/ZNYC.Recruitment.Api/bin/Debug/net5.0/ZNYC.Recruitment.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/ZNYC.Recruitment.Api",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\\\bNow listening on:\\\\s+(https?://\\\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

8
src/.vscode/solution-explorer/class.cs-template

@ -0,0 +1,8 @@
using System;
namespace {{namespace}}
{
public class {{name}}
{
}
}

3
src/.vscode/solution-explorer/class.ts-template

@ -0,0 +1,3 @@
export class {{name}} {
}

9
src/.vscode/solution-explorer/class.vb-template

@ -0,0 +1,9 @@
Imports System
Namespace {{namespace}}
Public Class {{name}}
End Class
End Namespace

3
src/.vscode/solution-explorer/default.ts-template

@ -0,0 +1,3 @@
export default {{name}} {
}

8
src/.vscode/solution-explorer/enum.cs-template

@ -0,0 +1,8 @@
using System;
namespace {{namespace}}
{
public enum {{name}}
{
}
}

8
src/.vscode/solution-explorer/interface.cs-template

@ -0,0 +1,8 @@
using System;
namespace {{namespace}}
{
public interface {{name}}
{
}
}

3
src/.vscode/solution-explorer/interface.ts-template

@ -0,0 +1,3 @@
export interface {{name}} {
}

46
src/.vscode/solution-explorer/template-list.json

@ -0,0 +1,46 @@
{
"templates": [
{
"name": "Class",
"extension": "cs",
"file": "./class.cs-template",
"parameters": "./template-parameters.js"
},
{
"name": "Interface",
"extension": "cs",
"file": "./interface.cs-template",
"parameters": "./template-parameters.js"
},
{
"name": "Enum",
"extension": "cs",
"file": "./enum.cs-template",
"parameters": "./template-parameters.js"
},
{
"name": "Class",
"extension": "ts",
"file": "./class.ts-template",
"parameters": "./template-parameters.js"
},
{
"name": "Interface",
"extension": "ts",
"file": "./interface.ts-template",
"parameters": "./template-parameters.js"
},
{
"name": "Default",
"extension": "ts",
"file": "./default.ts-template",
"parameters": "./template-parameters.js"
},
{
"name": "Class",
"extension": "vb",
"file": "./class.vb-template",
"parameters": "./template-parameters.js"
}
]
}

17
src/.vscode/solution-explorer/template-parameters.js

@ -0,0 +1,17 @@
var path = require("path");
module.exports = function(filename, projectPath, folderPath) {
var namespace = "Unknown";
if (projectPath) {
namespace = path.basename(projectPath, path.extname(projectPath));
if (folderPath) {
namespace += "." + folderPath.replace(path.dirname(projectPath), "").substring(1).replace(/[\\\/]/g, ".");
}
namespace = namespace.replace(/[\\\-]/g, "_");
}
return {
namespace: namespace,
name: path.basename(filename, path.extname(filename))
}
};

42
src/.vscode/tasks.json

@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/ZNYC.Recruitment.Api/ZNYC.Recruitment.Api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/ZNYC.Recruitment.Api/ZNYC.Recruitment.Api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/ZNYC.Recruitment.Api/ZNYC.Recruitment.Api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

29
src/Dockerfile

@ -0,0 +1,29 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Znyc.Recruitment.Api/Znyc.Recruitment.Api.csproj", "Znyc.Recruitment.Api/"]
COPY ["Znyc.Recruitment.Services/Znyc.Recruitment.Service.csproj", "Znyc.Recruitment.Services/"]
COPY ["Znyc.Recruitment.Repository/Znyc.Recruitment.Repository.csproj", "Znyc.Recruitment.Repository/"]
COPY ["Znyc.Recruitment.Model/Znyc.Recruitment.Model.csproj", "Znyc.Recruitment.Model/"]
COPY ["Znyc.Recruitment.Common/Znyc.Recruitment.Common.csproj", "Znyc.Recruitment.Common/"]
RUN dotnet restore "Znyc.Recruitment.Api/Znyc.Recruitment.Api.csproj"
COPY . .
WORKDIR "/src/Znyc.Recruitment.Api"
RUN dotnet build "Znyc.Recruitment.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Znyc.Recruitment.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Znyc.Recruitment.Api.dll"]

21
src/LICENSE

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 zhontai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1
src/README.md

@ -0,0 +1 @@
众能云车人才招聘后端API

12
src/Znyc.Recruitment.Api/.config/dotnet-tools.json

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "5.0.3",
"commands": [
"dotnet-ef"
]
}
}
}

39
src/Znyc.Recruitment.Api/Aop/AopHelper.cs

@ -0,0 +1,39 @@
using Castle.DynamicProxy;
using System;
using System.Reflection;
using System.Threading.Tasks;
namespace Znyc.Recruitment.Aop
{
public class AopHelper
{
public static async Task<T> ExecuteGenericMethod<T>(Task<T> returnValue, Action<T> callBackAction,
Action<Exception> exceptionAction, Action finallyAction)
{
try
{
T result = await returnValue;
callBackAction?.Invoke(result);
return result;
}
catch (Exception ex)
{
exceptionAction?.Invoke(ex);
return default;
}
finally
{
finallyAction?.Invoke();
}
}
public static object CallGenericMethod(IInvocation invocation, Action<object> callBackAction,
Action<Exception> exceptionAction, Action finallyAction)
{
return typeof(AopHelper)
.GetMethod("ExecuteGenericMethod", BindingFlags.Public | BindingFlags.Static)
.MakeGenericMethod(invocation.Method.ReturnType.GenericTypeArguments[0])
.Invoke(null, new[] { invocation.ReturnValue, callBackAction, exceptionAction, finallyAction });
}
}
}

67
src/Znyc.Recruitment.Api/Aop/TransactionInterceptor.cs

@ -0,0 +1,67 @@
using Castle.DynamicProxy;
using FreeSql;
using System.Reflection;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Attributes;
using Znyc.Recruitment.Common.Extensions;
using Znyc.Recruitment.Common.Output;
namespace Znyc.Recruitment.Aop
{
public class TransactionInterceptor : IInterceptor
{
private readonly UnitOfWorkManager _unitOfWorkManager;
private IUnitOfWork _unitOfWork;
public TransactionInterceptor(UnitOfWorkManager unitOfWorkManager)
{
_unitOfWorkManager = unitOfWorkManager;
}
public void Intercept(IInvocation invocation)
{
MethodInfo method = invocation.MethodInvocationTarget ?? invocation.Method;
if (method.HasAttribute<TransactionAttribute>())
{
InterceptTransaction(invocation, method);
}
else
{
invocation.Proceed();
}
}
private async void InterceptTransaction(IInvocation invocation, MethodInfo method)
{
try
{
TransactionAttribute transaction = method.GetAttribute<TransactionAttribute>();
_unitOfWork = _unitOfWorkManager.Begin(transaction.Propagation, transaction.IsolationLevel);
invocation.Proceed();
dynamic returnValue = invocation.ReturnValue;
if (returnValue is Task)
{
returnValue = await returnValue;
}
if (returnValue is IResponseOutput res && !res.Successed)
{
_unitOfWork.Rollback();
}
else
{
_unitOfWork.Commit();
}
}
catch
{
_unitOfWork.Rollback();
}
finally
{
_unitOfWork.Dispose();
}
}
}
}

44
src/Znyc.Recruitment.Api/Attributes/HiddenApiAttribute .cs

@ -0,0 +1,44 @@
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
using System;
namespace Znyc.Recruitment.Attributes
{
/// <summary>
/// 隐藏接口,不生成到swagger文档展示(Swashbuckle.AspNetCore 5.0.0)
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public class HiddenApiAttribute : Attribute
{
}
public class HiddenApiFilter : IDocumentFilter
{
/// <summary>
/// 重写Apply方法,移除隐藏接口的生成
/// </summary>
/// <param name="swaggerDoc">swagger文档文件</param>
/// <param name="context"></param>
public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
{
foreach (Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription apiDescription in context.ApiDescriptions)
{
ControllerActionDescriptor api =
apiDescription.ActionDescriptor as
ControllerActionDescriptor; //这里强转来获取到控制器的名称
if (api?.ControllerName == "CommonBase") //过滤的核心逻辑
{
string key = "/" + apiDescription.RelativePath;
if (key.Contains("?"))
{
int idx = key.IndexOf("?", StringComparison.Ordinal);
key = key.Substring(0, idx);
}
swaggerDoc.Paths.Remove(key);
}
}
}
}
}

12
src/Znyc.Recruitment.Api/Attributes/LoginAttribute.cs

@ -0,0 +1,12 @@
using System;
namespace Znyc.Recruitment.Attributes
{
/// <summary>
/// 启用登录
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class LoginAttribute : Attribute
{
}
}

12
src/Znyc.Recruitment.Api/Attributes/NoOprationLogAttribute.cs

@ -0,0 +1,12 @@
using System;
namespace Znyc.Recruitment.Attributes
{
/// <summary>
/// 禁用操作日志
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class NoOprationLogAttribute : Attribute
{
}
}

55
src/Znyc.Recruitment.Api/Attributes/PermissionAttribute.cs

@ -0,0 +1,55 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Auth;
namespace Znyc.Recruitment.Attributes
{
/// <summary>
/// 启用权限
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class PermissionAttribute : AuthorizeAttribute, IAuthorizationFilter, IAsyncAuthorizationFilter
{
public Task OnAuthorizationAsync(AuthorizationFilterContext context)
{
OnAuthorization(context);
return Task.CompletedTask;
}
public void OnAuthorization(AuthorizationFilterContext context)
{
//排除匿名访问
if (context.ActionDescriptor.EndpointMetadata.Any(m => m.GetType() == typeof(AllowAnonymousAttribute)))
{
return;
}
//登录验证
IUser user = context.HttpContext.RequestServices.GetService<IUser>();
;
if (user == null || !(user?.Id > 0))
{
context.Result = new ChallengeResult();
return;
}
//排除登录接口
if (context.ActionDescriptor.EndpointMetadata.Any(m => m.GetType() == typeof(LoginAttribute)))
{
return;
}
//权限验证 v1.1.0增加权限
//var httpMethod = context.HttpContext.Request.Method;
//var api = context.ActionDescriptor.AttributeRouteInfo.Template;
//var permissionHandler = context.HttpContext.RequestServices.GetService<IPermissionHandler>();
//var isValid = await permissionHandler.ValidateAsync(api, httpMethod);
//if (!isValid) context.Result = new ForbidResult();
}
}
}

67
src/Znyc.Recruitment.Api/Attributes/QuartzAttribute.cs

@ -0,0 +1,67 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq;
using System.Threading.Tasks;
using Znyc.Recruitment.Api.Auth;
namespace Znyc.Recruitment.Attributes
{
/// <summary>
/// 定时任务启动密钥
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class QuartzAttribute : AuthorizeAttribute, IAuthorizationFilter, IAsyncAuthorizationFilter
{
private IApiHandler _apiHandler;
public Task OnAuthorizationAsync(AuthorizationFilterContext context)
{
OnAuthorization(context);
return Task.CompletedTask;
}
public async void OnAuthorization(AuthorizationFilterContext context)
{
//排除匿名访问
if (context.ActionDescriptor.EndpointMetadata.Any(m => m.GetType() == typeof(AllowAnonymousAttribute)))
{
return;
}
string apiUrl = context.HttpContext.Request.Path.Value;
_apiHandler = context.HttpContext.RequestServices.GetService<IApiHandler>();
Model.ApiEntity entity = await _apiHandler.ValidateAsync(apiUrl);
//key/value 存入数据库去查询,不同的api对应不同的key/value
string authHeader = context.HttpContext.Request.Headers[entity.AuthKey];
if (authHeader != null && authHeader.Equals(entity.AuthValue))
{
return;
}
context.Result = new StatusCodeResult(StatusCodes.Status401Unauthorized);
}
public void OnAuthorizationTest(AuthorizationFilterContext context)
{
//key/value 存入数据库去查询,不同的api对应不同的key/value
string authHeader = context.HttpContext.Request.Headers["Authorization"];
if (authHeader != null && authHeader.StartsWith("Quartz"))
{
if (authHeader.Equals("Quartz 5r59#ioFJLQ@Pye6"))
{
return;
}
context.Result = new StatusCodeResult(StatusCodes.Status401Unauthorized);
}
else
{
context.Result = new StatusCodeResult(StatusCodes.Status401Unauthorized);
}
}
}
}

32
src/Znyc.Recruitment.Api/Attributes/ValidateInputAttribute.cs

@ -0,0 +1,32 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Linq;
using Znyc.Recruitment.Common.Output;
namespace Znyc.Recruitment.Attributes
{
/// <summary>
/// 输入模型验证
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class ValidateInputAttribute : ActionFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext context)
{
if (!context.ModelState.IsValid)
{
try
{
context.Result =
new JsonResult(ResponseOutput.Fail(context.ModelState.Values.First().Errors[0].ErrorMessage));
}
catch
{
context.Result = new StatusCodeResult(StatusCodes.Status500InternalServerError);
}
}
}
}
}

22
src/Znyc.Recruitment.Api/Attributes/VersionRouteAttribute.cs

@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using System;
using Znyc.Recruitment.Enums;
namespace Znyc.Recruitment.Attributes
{
/// <summary>
/// 自定义路由 /api/{version}/[controler]/[action]
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class VersionRouteAttribute : RouteAttribute, IApiDescriptionGroupNameProvider
{
public VersionRouteAttribute(ApiVersion version = ApiVersion.v1, string action = "[action]")
: base($"/api/{version}/[controller]/{action}")
{
GroupName = version.ToString();
}
public string GroupName { get; set; }
}
}

25
src/Znyc.Recruitment.Api/Auth/ApiHandler.cs

@ -0,0 +1,25 @@
using System.Threading.Tasks;
using Znyc.Recruitment.Model;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Auth
{
/// <summary>
/// 定时任务
/// </summary>
public class ApiHandler : IApiHandler
{
private readonly IApiService _apiService;
public ApiHandler(IApiService apiService)
{
_apiService = apiService;
}
public async Task<ApiEntity> ValidateAsync(string apiUrl)
{
ApiEntity result = await _apiService.GetApiAsync(apiUrl);
return result;
}
}
}

13
src/Znyc.Recruitment.Api/Auth/IApiHandler.cs

@ -0,0 +1,13 @@
using System.Threading.Tasks;
using Znyc.Recruitment.Model;
namespace Znyc.Recruitment.Api.Auth
{
/// <summary>
/// 定时任务
/// </summary>
public interface IApiHandler
{
public Task<ApiEntity> ValidateAsync(string apiUrl);
}
}

18
src/Znyc.Recruitment.Api/Auth/IPermissionHandler.cs

@ -0,0 +1,18 @@
using System.Threading.Tasks;
namespace Znyc.Recruitment.Auth
{
/// <summary>
/// 权限处理接口
/// </summary>
public interface IPermissionHandler
{
/// <summary>
/// 权限验证
/// </summary>
/// <param name="api"></param>
/// <param name="httpMethod"></param>
/// <returns></returns>
Task<bool> ValidateAsync(string api, string httpMethod);
}
}

35
src/Znyc.Recruitment.Api/Auth/PermissionHandler.cs

@ -0,0 +1,35 @@
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Attributes;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Auth
{
/// <summary>
/// 权限处理
/// </summary>
[SingleInstance]
public class PermissionHandler : IPermissionHandler
{
private readonly IUserService _userService;
public PermissionHandler(IUserService userService)
{
_userService = userService;
}
/// <summary>
/// 权限验证 v1.1.0后增加权限验证
/// </summary>
/// <param name="api"> 接口路径 </param>
/// <param name="httpMethod">http请求方法</param>
/// <returns></returns>
public async Task<bool> ValidateAsync(string api, string httpMethod)
{
//var permissions = await _userService.GetPermissionsAsync();
////var isValid = permissions.Any(m => m.EqualsIgnoreCase($"{httpMethod}/{api}"));
//var isValid = permissions.Any(m => m != null && m.EqualsIgnoreCase($"/{api}"));
return await Task.FromResult(true);
}
}
}

74
src/Znyc.Recruitment.Api/Auth/ResponseAuthenticationHandler.cs

@ -0,0 +1,74 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Extensions;
using StatusCodes = Znyc.Recruitment.Enums.StatusCodes;
namespace Znyc.Recruitment.Auth
{
/// <summary>
/// 响应认证处理器
/// </summary>
public class ResponseAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions>
{
public ResponseAuthenticationHandler(
IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock
) : base(options, logger, encoder, clock)
{
}
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
{
throw new NotImplementedException();
}
protected override async Task HandleChallengeAsync(AuthenticationProperties properties)
{
Response.ContentType = "application/json";
Response.StatusCode = Microsoft.AspNetCore.Http.StatusCodes.Status401Unauthorized;
await Response.WriteAsync(JsonConvert.SerializeObject(
new ResponseStatusData
{
Code = StatusCodes.Status401Unauthorized,
Msg = StatusCodes.Status401Unauthorized.ToDescription()
},
new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
}
));
}
protected override async Task HandleForbiddenAsync(AuthenticationProperties properties)
{
Response.ContentType = "application/json";
Response.StatusCode = Microsoft.AspNetCore.Http.StatusCodes.Status403Forbidden;
await Response.WriteAsync(JsonConvert.SerializeObject(
new ResponseStatusData
{
Code = StatusCodes.Status403Forbidden,
Msg = StatusCodes.Status403Forbidden.ToDescription()
},
new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
}
));
}
}
public class ResponseStatusData
{
public StatusCodes Code { get; set; } = StatusCodes.Status1Ok;
public string Msg { get; set; }
}
}

121
src/Znyc.Recruitment.Api/Controllers/ActivityController.cs

@ -0,0 +1,121 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 活动页
/// </summary>
[ApiExplorerSettings(IgnoreApi = false)]
public class ActivityController : BaseController
{
private readonly IActivityService _activityService;
public ActivityController(IActivityService activityService)
{
_activityService = activityService;
}
/// <summary>
/// 查询活动列表
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/activitys")]
public async Task<IResponseOutput<List<ActivityListOutput>>> GetListAsync()
{
return await _activityService.GetListAsync();
}
/// <summary>
/// 根据Id查询活动详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/activity/{id}")]
public async Task<IResponseOutput<ActivityGetOutput>> GetAsync(long id)
{
return await _activityService.GetAsync(id);
}
/// <summary>
/// 邀请排行榜
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/invitation/activitys/search")]
public async Task<IResponseOutput<List<TopListOutput>>> GetInviteTopAsync(int currentPage = 1, int pageSize = 10)
{
return await _activityService.GetInviteTopAsync(currentPage, pageSize);
}
/// <summary>
/// 累计签到排行榜
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/sign/activitys/search")]
[AllowAnonymous]
public async Task<IResponseOutput<List<TopListOutput>>> GetTotalSeriesDaysAsync(int currentPage = 1, int pageSize = 10)
{
return await _activityService.GetTotalSeriesDaysAsync(currentPage, pageSize);
}
/// <summary>
/// 积分排行榜
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/currency/activitys/search")]
public async Task<IResponseOutput<List<TopListOutput>>> GetAvailableCreditsAsync(int currentPage = 1, int pageSize = 10)
{
return await _activityService.GetAvailableCreditsAsync(currentPage, pageSize);
}
/// <summary>
/// 求职浏览量排行榜
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/applyjob/activitys/search")]
[AllowAnonymous]
public async Task<IResponseOutput<List<TopListOutput>>> GetApplyJobPageViewAsync(int currentPage = 1, int pageSize = 10)
{
return await _activityService.GetApplyJobPageViewAsync(currentPage, pageSize);
}
/// <summary>
/// 招聘浏览量排行榜
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/recruitment/activitys/search")]
[AllowAnonymous]
public async Task<IResponseOutput<List<TopListOutput>>> GetRecruitmentPageViewAsync(int currentPage = 1, int pageSize = 10)
{
return await _activityService.GetRecruitmentPageViewAsync(currentPage, pageSize);
}
}
}

156
src/Znyc.Recruitment.Api/Controllers/ApplyJobController.cs

@ -0,0 +1,156 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.apply.Api.Controllers
{
/// <summary>
/// 求职信息管理
/// </summary>
public class ApplyJobController : BaseController
{
private readonly IApplyJobService _applyJobService;
public ApplyJobController(
IApplyJobService applyJobService
)
{
_applyJobService = applyJobService;
}
/// <summary>
/// 单条查询
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/apply/{id}")]
public async Task<IResponseOutput<ApplyJobGetOutput>> GetAsync([Required] long id)
{
return await _applyJobService.GetAsync(id);
}
/// <summary>
/// 我的求职简历
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/my/apply")]
public async Task<IResponseOutput<ApplyJobGetOutput>> GetMyApplyAsync()
{
return await _applyJobService.GetMyApplyAsync();
}
/// <summary>
/// 分页查询
/// </summary>
/// <param name="key">内容</param>
/// <param name="provinceId">省</param>
/// <param name="cityId">市</param>
/// <param name="industryId">行业id</param>
/// <param name="jobId">岗位类型</param>
/// <param name="sort">排序</param>
/// <param name="currentPage">当前页</param>
/// <param name="pageSize">页数</param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/applys/search")]
public async Task<IResponseOutput> PageAsync(string key, string provinceId, string cityId,
long industryId, long jobId, long areaid, string sort, int currentPage = 1, int pageSize = 20)
{
return await _applyJobService.PageAsync(key, provinceId, cityId, industryId, jobId, areaid, sort, currentPage,
pageSize);
}
/// <summary>
/// 获取手机号码
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/apply/phone/{id}")]
public async Task<IResponseOutput> GetPhoneAsync([Required] long id)
{
return await _applyJobService.GetPhoneAsync(id);
}
/// <summary>
/// 添加求职信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/v1/apply")]
public async Task<IResponseOutput> AddAsync([Required] ApplyJobAddInput input)
{
return await _applyJobService.AddAsync(input);
}
/// <summary>
/// 修改求职信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/apply")]
public async Task<IResponseOutput> UpdateAsync([Required] ApplyJobUpdateInput input)
{
return await _applyJobService.UpdateAsync(input);
}
/// <summary>
/// 一键刷新
/// </summary>
/// <returns></returns>
[HttpPut]
[Route("api/v1/apply/refresh/{id}")]
public async Task<IResponseOutput> RefreshAsync([Required] long id)
{
return await _applyJobService.RefreshAsync(id);
}
/// <summary>
/// 置顶求职信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/apply/top/{id}")]
public async Task<IResponseOutput> UpdateTopAsync([Required] long id)
{
return await _applyJobService.UpdateTopAsync(id);
}
/// <summary>
/// 更改求职信息状态
/// </summary>
/// <param name="id"></param>
/// <param name="status">求职状态1-正在找/2-已找到</param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/apply/status/{status}/{id}")]
public async Task<IResponseOutput> UpdateStateAsync([Required] int status, [Required] long id)
{
return await _applyJobService.UpdateStateAsync(status, id);
}
/// <summary>
/// 是否公开求职信息
/// </summary>
/// <param name="id"></param>
/// <param name="isPublic"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/apply/public/{isPublic}/{id}")]
public async Task<IResponseOutput> IsPublicAsync([Required] bool isPublic, [Required] long id)
{
return await _applyJobService.IsPublicAsync(isPublic, id);
}
}
}

35
src/Znyc.Recruitment.Api/Controllers/AuditController.cs

@ -0,0 +1,35 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 审核记录管理
/// </summary>
[ApiExplorerSettings(IgnoreApi = false)]
public class AuditController : BaseController
{
private readonly IAuditService _auditService;
public AuditController(IAuditService auditService)
{
_auditService = auditService;
}
/// <summary>
/// 审核记录
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/audits/search")]
public async Task<IResponseOutput<PageOutput<AuditListOutput>>> PageAsync(int currentPage = 1, int pageSize = 10)
{
return await _auditService.PageAsync(currentPage, pageSize);
}
}
}

63
src/Znyc.Recruitment.Api/Controllers/AuthController.cs

@ -0,0 +1,63 @@
using Microsoft.AspNetCore.Mvc;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 授权管理
/// </summary>
public class AuthController : BaseController
{
private readonly IAuthService _authService;
public AuthController(
IAuthService authService
)
{
_authService = authService;
}
/// <summary>
/// 百度地图获取AccessToken
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/auth/baidu/accesstoken")]
public IResponseOutput<BaiduAccessTokenOutput> GetAccessTokenAsync()
{
return _authService.GetAccessTokenAsync();
}
/// <summary>
/// 微信获取AccessToken
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/auth/weixin/accesstoken")]
public IResponseOutput<WxAccessTokenOutput> GetWxAccessTokenAsync()
{
return _authService.GetWxAccessTokenAsync();
}
/// <summary>
/// 获取小程序码
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/auth/weixin/unlimited")]
public IResponseOutput<string> GetUnlimitedAsync(string? id)
{
if(id is not null)
{
return _authService.GetUnlimitedAsync(id);
}
else
{
return _authService.GetUnlimitedAsync();
}
}
}
}

36
src/Znyc.Recruitment.Api/Controllers/BannerController.cs

@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 广告页
/// </summary>
[ApiExplorerSettings(IgnoreApi = false)]
public class BannerController : BaseController
{
private readonly IBannerService _bannerService;
public BannerController(IBannerService bannerService)
{
_bannerService = bannerService;
}
/// <summary>
/// 查询广告列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/banners")]
[AllowAnonymous]
public async Task<IResponseOutput<List<BannerListOutput>>> GetBannerListAsync(int tag)
{
return await _bannerService.GetBannerListAsync(tag);
}
}
}

15
src/Znyc.Recruitment.Api/Controllers/BaseController.cs

@ -0,0 +1,15 @@
using Microsoft.AspNetCore.Mvc;
using Znyc.Recruitment.Attributes;
namespace Znyc.Recruitment.Controllers
{
/// <summary>
/// 基础控制器
/// </summary>
[ApiController]
[Permission]
[ValidateInput]
public abstract class BaseController : ControllerBase
{
}
}

51
src/Znyc.Recruitment.Api/Controllers/BrowseController.cs

@ -0,0 +1,51 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 用户浏览信息管理
/// </summary>
public class BrowseController : BaseController
{
private readonly IBrowseService _browseService;
public BrowseController(IBrowseService browseService)
{
_browseService = browseService;
}
/// <summary>
/// 用户浏览求职信息
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/apply/browses/search")]
public async Task<IResponseOutput<PageOutput<BrowseListApplyJobOutput>>> ApplyJobPageAsync(
int currentPage = 1, int pageSize = 10)
{
return await _browseService.ApplyJobPageAsync(currentPage, pageSize);
}
/// <summary>
/// 用户浏览招聘信息
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/recruitment/browses/search")]
public async Task<IResponseOutput<PageOutput<BrowseListRecruitmentOutput>>> RecruitmentPageAsync(
int currentPage = 1, int pageSize = 10)
{
return await _browseService.RecruitmentPageAsync(currentPage, pageSize);
}
}
}

37
src/Znyc.Recruitment.Api/Controllers/CallFeedbackController.cs

@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 通话评价
/// </summary>
[ApiExplorerSettings(IgnoreApi = false)]
public class CallFeedbackController : BaseController
{
private readonly ICallFeedbackService _callFeedbackService;
public CallFeedbackController(ICallFeedbackService callFeedbackService)
{
_callFeedbackService = callFeedbackService;
}
/// <summary>
/// 新增通话评价
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/v1/callfeedback")]
public async Task<IResponseOutput> AddCallFeedbackAsync(CallFeedbackAddInput input)
{
return await _callFeedbackService.AddCallFeedbackAsync(input);
}
}
}

58
src/Znyc.Recruitment.Api/Controllers/CertificationController.cs

@ -0,0 +1,58 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 实名认证管理
/// </summary>
public class CertificationController : BaseController
{
private readonly ICertificationService _certificationService;
public CertificationController(
ICertificationService certificationService
)
{
_certificationService = certificationService;
}
/// <summary>
/// 查询实名认证信息
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/certification")]
public async Task<IResponseOutput<CertificationOutput>> GetAsync()
{
return await _certificationService.GetAsync();
}
/// <summary>
/// 新增实名认证信息
/// </summary>
/// <param name="certificationAddInput"></param>
/// <returns></returns>
[HttpPost]
[Route("api/v1/certification")]
public async Task<IResponseOutput> AddAsync(CertificationAddInput certificationAddInput)
{
return await _certificationService.AddAsync(certificationAddInput);
}
/// <summary>
/// 更新实名认证信息
/// </summary>
/// <param name="certificationUpdateInput"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/certification")]
public async Task<IResponseOutput> UpdateAsync(CertificationUpdateInput certificationUpdateInput)
{
return await _certificationService.UpdateAsync(certificationUpdateInput);
}
}
}

42
src/Znyc.Recruitment.Api/Controllers/CityEncyclopediaController.cs

@ -0,0 +1,42 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
public class CityEncyclopediaController : BaseController
{
private readonly ICityEncyclopediaService encyclopediaService;
public CityEncyclopediaController(ICityEncyclopediaService encyclopediaService)
{
this.encyclopediaService = encyclopediaService;
}
/// <summary>
/// 查询行业岗位
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/CityEncyclopedia")]
[AllowAnonymous]
public async Task<IResponseOutput<List<CityEncyclopediaListOutput>>> GetListByIdAsync()
{
return await this.encyclopediaService.GetListByIdAsync();
}
}
}

79
src/Znyc.Recruitment.Api/Controllers/CollectionController.cs

@ -0,0 +1,79 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 用户收藏信息管理
/// </summary>
public class CollectionController : BaseController
{
private readonly ICollectionService _collectionService;
public CollectionController(ICollectionService collectionService)
{
_collectionService = collectionService;
}
/// <summary>
/// 用户收藏求职信息
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/apply/collections/search")]
public async Task<IResponseOutput<PageOutput<CollectionListApplyJobOutput>>> ApplyJobPageAsync(
int currentPage = 1, int pageSize = 10)
{
return await _collectionService.ApplyJobPageAsync(currentPage, pageSize);
}
/// <summary>
/// 用户收藏招聘信息
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/recruitment/collections/search")]
public async Task<IResponseOutput<PageOutput<CollectionListRecruitmentOutput>>> RecruitmentPageAsync(
int currentPage = 1, int pageSize = 10)
{
return await _collectionService.RecruitmentPageAsync(currentPage, pageSize);
}
/// <summary>
///
/// </summary>
/// <param name="productType"></param>
/// <param name="productId"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/collection/{productType}/{productId}")]
public async Task<IResponseOutput> AddAsync(int productType, long productId)
{
return await _collectionService.AddAsync(productType, productId);
}
/// <summary>
/// 取消收藏
/// </summary>
/// <param name="productType"></param>
/// <param name="productId"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/collection/cancel/{productType}/{productId}")]
public async Task<IResponseOutput> CancelAsync(int productType, long productId)
{
return await _collectionService.CancelAsync(productType, productId);
}
}
}

49
src/Znyc.Recruitment.Api/Controllers/CurrencyController.cs

@ -0,0 +1,49 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 用户云币管理
/// </summary>
public class CurrencyController : BaseController
{
private readonly ICurrencyService _currencyService;
public CurrencyController(
ICurrencyService currencyService
)
{
_currencyService = currencyService;
}
/// <summary>
/// 获取用户云币信息
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/currency")]
public async Task<IResponseOutput<CurrencyOutput>> GetAsync()
{
return await _currencyService.GetAsync();
}
/// <summary>
/// 云币账单
/// </summary>
/// <param name="currencyType">0-全部/1-增加/2-减少</param>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/currencys/search")]
public async Task<IResponseOutput<PageOutput<CurrencyRecordListOutput>>> PageAsync(
int currencyType, int currentPage = 1, int pageSize = 10)
{
return await _currencyService.PageAsync(currencyType, currentPage, pageSize);
}
}
}

36
src/Znyc.Recruitment.Api/Controllers/CurrencyIntroController.cs

@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 用户云币管理
/// </summary>
public class CurrencyIntroController : BaseController
{
private readonly ICurrencyIntroService _currencyIntroService;
public CurrencyIntroController(
ICurrencyIntroService currencyIntroService
)
{
_currencyIntroService = currencyIntroService;
}
/// <summary>
/// 获取云币来源列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/currencyintros")]
public async Task<IResponseOutput<List<CurrencyIntroListOutput>>> ListAsync()
{
return await _currencyIntroService.GetListAsync();
}
}
}

76
src/Znyc.Recruitment.Api/Controllers/DeliveryResumeController.cs

@ -0,0 +1,76 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Enums;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 用户投递简历信息管理
/// </summary>
public class DeliveryResumeController : BaseController
{
private readonly IDeliveryResumeService _deliveryResumeService;
public DeliveryResumeController(IDeliveryResumeService deliveryResumeService)
{
_deliveryResumeService = deliveryResumeService;
}
/// <summary>
/// 我的求职--我的投递/对我感兴趣
/// </summary>
/// <param name="deliveryType">1-我的投递/2-对我感兴趣</param>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/apply/deliverys/search")]
public async Task<IResponseOutput<PageOutput<DeliveryResumeListToRecruitment>>> ApplyJobPageAsync(
DeliveryType deliveryType, int currentPage = 1, int pageSize = 20)
{
return await _deliveryResumeService.ApplyJobPageAsync(deliveryType, currentPage, pageSize);
}
/// <summary>
/// 我的招聘——我感兴趣的/收到的求职
/// </summary>
/// <param name="deliveryType">1-收到的求职/2-我感兴趣的</param>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/recruitment/deliverys/search")]
public async Task<IResponseOutput<PageOutput<DeliveryResumeListToApplyJob>>> RecruitmentPageAsync(
DeliveryType deliveryType, int currentPage = 1, int pageSize = 20)
{
return await _deliveryResumeService.RecruitmentPageAsync(deliveryType, currentPage, pageSize);
}
/// <summary>
/// 新增用户投递简历信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/v1/delivery")]
public async Task<IResponseOutput> AddAsync(DeliveryResumeAddInput input)
{
return await _deliveryResumeService.AddAsync(input);
}
/// <summary>
/// 已查看用户投递简历信息
/// </summary>
/// <param name="productType">1--求职/2--招聘</param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/deliverys/{productType}")]
public async Task<IResponseOutput> UpdateAsync(int productType)
{
return await _deliveryResumeService.UpdateAsync(productType);
}
}
}

61
src/Znyc.Recruitment.Api/Controllers/DictionaryController.cs

@ -0,0 +1,61 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Controllers
{
/// <summary>
/// 数据字典
/// </summary>
public class DictionaryController : BaseController
{
private readonly IDictionaryService _dictionaryServices;
public DictionaryController(IDictionaryService dictionaryServices)
{
_dictionaryServices = dictionaryServices;
}
/// <summary>
/// 根据Id获取字典
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/dict/{id}")]
public async Task<IResponseOutput<DictionaryListOutput>> GetByIdAsync([Required] int id)
{
return await _dictionaryServices.GetByIdAsync(id);
}
///// <summary>
///// 根据pid查询字典列表
///// </summary>
///// <param name="pid"></param>
///// <returns></returns>
//[HttpGet]
//[AllowAnonymous]
//[Route("api/v1/dict/{pid}")]
//public async Task<IResponseOutput<List<DictionaryListOutput>>> GetListByParentIdAsync([Required] long pid)
//{
// return await _dictionaryServices.GetListByParentIdAsync(pid);
//}
/// <summary>
///
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/dict/code/{code}")]
public async Task<IResponseOutput<List<DictionaryListOutput>>> GetListByCodeAsync(string code)
{
return await _dictionaryServices.GetListByCodeAsync(code);
}
}
}

36
src/Znyc.Recruitment.Api/Controllers/DocumentController.cs

@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
using Znyc.Recruitment.Service.Document.Output;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 文档管理
/// </summary>
public class DocumentController : BaseController
{
private readonly IDocumentService _documentService;
public DocumentController(
IDocumentService documentService
)
{
_documentService = documentService;
}
/// <summary>
/// 上传文档图片
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/document")]
public ImageOutput UploadImageAsync()
{
return _documentService.UploadImageAsync();
}
}
}

34
src/Znyc.Recruitment.Api/Controllers/FeedbackController.cs

@ -0,0 +1,34 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 意见反馈
/// </summary>
[ApiExplorerSettings(IgnoreApi = false)]
public class FeedbackController : BaseController
{
private readonly IFeedbackService _feedbackService;
public FeedbackController(IFeedbackService feedbackService)
{
_feedbackService = feedbackService;
}
/// <summary>
/// 新增意见反馈
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/v1/feedback")]
public async Task<IResponseOutput> AddFeedbackAsync(FeedbackAddInput input)
{
return await _feedbackService.AddFeedbackAsync(input);
}
}
}

37
src/Znyc.Recruitment.Api/Controllers/IndustryJobsController.cs

@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 行业岗位管理
/// </summary>
public class IndustryJobsController : BaseController
{
private readonly IIndustryJobsService _industryJobsService;
public IndustryJobsController(IIndustryJobsService industryJobsService)
{
_industryJobsService = industryJobsService;
}
/// <summary>
/// 查询行业岗位
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/industryjob/{id}")]
[AllowAnonymous]
public async Task<IResponseOutput<List<IndustryJobsListOutput>>> GetListByIdAsync(long id = 0)
{
return await _industryJobsService.GetListByIdAsync(id);
}
}
}

41
src/Znyc.Recruitment.Api/Controllers/LoginController.cs

@ -0,0 +1,41 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
using Znyc.Recruitment.Service.Login.OutPut;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 登录管理
/// </summary>
public class LoginController : BaseController
{
private readonly ILoginService _loginService;
public LoginController(
ILoginService loginService
)
{
_loginService = loginService;
}
/// <summary>
/// Wx登录授权
/// </summary>
/// <param name="loginInput"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
[Route("api/v1/login")]
public async Task<IResponseOutput<LoginOutPut>> Login(LoginInput loginInput)
{
return await _loginService.Login(loginInput);
}
}
}

80
src/Znyc.Recruitment.Api/Controllers/MessageController.cs

@ -0,0 +1,80 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 信息通知管理
/// </summary>
public class MessageController : BaseController
{
private readonly IMessageLogsService _messageLogsService;
private readonly IMessageService _messageService;
public MessageController(
IMessageService messageService,
IMessageLogsService messageLogsService
)
{
_messageService = messageService;
_messageLogsService = messageLogsService;
}
/// <summary>
/// 查询消息通知列表
/// </summary>
/// <param name="productType"></param>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/notifications/search")]
public async Task<IResponseOutput<PageOutput<MessageLogsListOutput>>> MessageLogsPageAsync(int productType,
int currentPage, int pageSize)
{
return await _messageLogsService.MessageLogsPageAsync(productType, currentPage, pageSize);
}
/// <summary>
/// 已读消息记录
/// </summary>
/// <param name="productType">1--求职/2--招聘/3--实名</param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/notification/{productType}")]
public async Task<IResponseOutput> UpdateAsync(int productType)
{
return await _messageLogsService.UpdateAsync(productType);
}
/// <summary>
/// 获取新用户滚动播放列表
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/register/newusers")]
public async Task<IResponseOutput<string[]>> GetRegistUserListAsync()
{
return await _messageLogsService.GetRegistUserListAsync();
}
/// <summary>
/// 邀请新用户信息滚动播放列表
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/invitation/newusers")]
public async Task<IResponseOutput<List<InviteNewUserOutput>>> GetInviteNewUserAsync()
{
return await _messageLogsService.GetInviteNewUserAsync();
}
}
}

39
src/Znyc.Recruitment.Api/Controllers/ProductCategoryController.cs

@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 商品品牌表
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
[Obsolete]
public class ProductCategoryController : BaseController
{
private readonly IProductCategoryService _productCategoryService;
public ProductCategoryController(IProductCategoryService productCategoryService)
{
_productCategoryService = productCategoryService;
}
/// <summary>
/// 产品图片
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/product/categorys")]
public async Task<IResponseOutput<List<ProductCategoryListOutput>>> ListAsync()
{
return await _productCategoryService.ListAsync();
}
}
}

40
src/Znyc.Recruitment.Api/Controllers/ProductInfoController.cs

@ -0,0 +1,40 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 商品服务
/// </summary>
public class ProductInfoController : BaseController
{
private readonly IProductInfoService _productInfoService;
public ProductInfoController(IProductInfoService productInfoService)
{
_productInfoService = productInfoService;
}
/// <summary>
/// 分页获取商品信息
/// </summary>
/// <param name="key"></param>
/// <param name="brandId">品牌</param>
/// <param name="categoryId">分类</param>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/products/search")]
public async Task<IResponseOutput<PageOutput<ProductInfoOutput>>> PageAsync(long brandId, long categoryId, string key, int currentPage = 1, int pageSize = 10)
{
return await _productInfoService.PageAsync(brandId, categoryId, key, currentPage, pageSize);
}
}
}

37
src/Znyc.Recruitment.Api/Controllers/ProductPicController.cs

@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 产品图片
/// </summary>
[Route("api/product/pic")]
[ApiExplorerSettings(IgnoreApi = true)]
public class ProductPicController : BaseController
{
private readonly IProductPicService _productPicService;
public ProductPicController(IProductPicService productPicService)
{
_productPicService = productPicService;
}
/// <summary>
/// 产品图片
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/product/pictures")]
public async Task<IResponseOutput<List<ProductPicListOutput>>> ListAsync()
{
return await _productPicService.ListAsync();
}
}
}

37
src/Znyc.Recruitment.Api/Controllers/ProudctWarehouseController.cs

@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// Banner
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public class ProudctWarehouseController : BaseController
{
private readonly IProudctWarehouseService _proudctWarehouseService;
public ProudctWarehouseController(IProudctWarehouseService proudctWarehouseService)
{
_proudctWarehouseService = proudctWarehouseService;
}
/// <summary>
/// 产品图片
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/proudct/warehouse")]
public async Task<IResponseOutput<List<ProudctWarehouseListOutput>>> ListAsync()
{
return await _proudctWarehouseService.ListAsync();
}
}
}

100
src/Znyc.Recruitment.Api/Controllers/QuartzController.cs

@ -0,0 +1,100 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Attributes;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 定时调度
/// </summary>
[Quartz]
[AllowAnonymous]
public class QuartzController : BaseController
{
private readonly IApplyJobService _applyJobService;
private readonly ICacheService _cacheService;
private readonly ICurrencyService _currencyService;
private readonly IRecruitmentService _recruitmentService;
private readonly ISignService _signService;
public QuartzController(
ISignService signService,
IApplyJobService applyJobService,
IRecruitmentService recruitmentService,
ICurrencyService currencyService,
ICacheService cacheService
)
{
_signService = signService;
_applyJobService = applyJobService;
_recruitmentService = recruitmentService;
_currencyService = currencyService;
_cacheService = cacheService;
}
/// <summary>
/// 置顶到期取消
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/sync/top")]
public async Task<IResponseOutput> CancelTopAsync()
{
await _applyJobService.CancelTopAsync();
await _recruitmentService.CancelTopAsync();
return ResponseOutput.Success();
}
/// <summary>
/// 月重置签到次数
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/sync/sign")]
public async Task<IResponseOutput> ResetSignAsync()
{
return await _signService.ResetSignAsync();
}
/// <summary>
/// 每日清空临时积分
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/sync/emptytemporarycurrency")]
public async Task<IResponseOutput> ResetTemporaryCurrencyAsync()
{
return await _currencyService.ResetTemporaryCurrencyAsync();
}
/// <summary>
/// 每日清空云币来源缓存
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/sync/emptycurrencyintro")]
public async Task<bool> ResetCurrencyIntroAsync()
{
return await _cacheService.RemoveAllCurrencyIntroAsync();
}
/// <summary>
/// 同步浏览量
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/sync/pageview")]
public async Task<IResponseOutput> PageViewAsync()
{
await _recruitmentService.PageViewAsync();
await _applyJobService.PageViewAsync();
return ResponseOutput.Success();
}
}
}

34
src/Znyc.Recruitment.Api/Controllers/RechargeController.cs

@ -0,0 +1,34 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 充值活动服务
/// </summary>
public class RechargeController : BaseController
{
private readonly IRechargeService _rechargeService;
public RechargeController(IRechargeService rechargeService)
{
_rechargeService = rechargeService;
}
/// <summary>
/// 获取充值活动
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/recharge")]
public async Task<IResponseOutput<RechargeGetOutput>> GetAsync()
{
return await _rechargeService.GetAsync();
}
}
}

201
src/Znyc.Recruitment.Api/Controllers/RecruitmentController.cs

@ -0,0 +1,201 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Enums;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 招聘信息管理
/// </summary>
public class RecruitmentController : BaseController
{
private readonly IRecruitmentService _recruitmentService;
public RecruitmentController(IRecruitmentService recruitmentService)
{
_recruitmentService = recruitmentService;
}
/// <summary>
/// 单条查询
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/recruitment/{id}")]
public async Task<IResponseOutput<RecruitmentGetOutput>> GetByIdAsync([Required] long id)
{
return await _recruitmentService.GetByIdAsync(id);
}
/// <summary>
/// 我的招聘信息
/// </summary>
/// <param name="productStatus">招聘状态</param>
/// <param name="currentPage">当前页码</param>
/// <param name="pageSize">页数</param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/my/recruitments/search")]
public async Task<IResponseOutput<PageOutput<MyRecruitmentList>>> MyRecruitmentPageAsync(
ProductStatusEnum productStatus,
int currentPage = 1, int pageSize = 10)
{
return await _recruitmentService.MyRecruitmentPageAsync(productStatus, currentPage, pageSize);
}
/// <summary>
/// 分页查询招聘信息
/// </summary>
/// <param name="key">标题</param>
/// <param name="provinceId">省</param>
/// <param name="cityId">市</param>
/// <param name="industryId">行业Id</param>
/// <param name="jobId">岗位Id</param>
/// <param name="sort">排序</param>
/// <param name="currentPage">当前页码</param>
/// <param name="pageSize">页数</param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/recruitments/search")]
[AllowAnonymous]
public async Task<IResponseOutput<PageOutput<RecruitmentListOutput>>> PageAsync(string key, long provinceId,
long cityId,
long industryId,
long areaid,
long jobId, string sort,
int currentPage = 1, int pageSize = 20)
{
return await _recruitmentService.PageAsync(key, provinceId, cityId, areaid, industryId, jobId, sort,
currentPage, pageSize);
}
/// <summary>
/// 获取上一次发布信息的手机号码和发布人
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/recruitment/GetPhoneAndReleaseAsync/{id}")]
[AllowAnonymous]
public async Task<IResponseOutput> GetPhoneAndReleaseAsync([Required] long id)
{
return await _recruitmentService.GetOldAsync(id);
}
/// <summary>
/// 获取手机号码
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/recruitment/phone/{id}")]
public async Task<IResponseOutput> GetPhoneAsync([Required] long id)
{
return await _recruitmentService.GetPhoneAsync(id);
}
/// <summary>
/// 新增招聘信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/v1/recruitment")]
public async Task<IResponseOutput> AddAsync(RecruitmentAddInput input)
{
var matc = this._recruitmentService.Matching(input);
return await _recruitmentService.AddAsync(matc);
}
///// <summary>
///// 查询行业岗位
///// </summary>
///// <param name="MatchingInput"></param>
///// <returns></returns>
//[HttpPost]
//[Route("api/v1/Matching")]
//public async Task<IResponseOutput> Matching(RecruitmentAddInput MatchingInput)
//{
// return await this._recruitmentService.Matching(MatchingInput);
//}
/// <summary>
/// 编辑招聘信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/recruitment")]
public async Task<IResponseOutput> UpdateAsync(RecruitmentUpdateInput input)
{
return await _recruitmentService.UpdateAsync(input);
}
/// <summary>
/// 刷新招聘信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/recruitment/refresh/{id}")]
[Route("refresh")]
public async Task<IResponseOutput> RefreshAsync([Required] long id)
{
return await _recruitmentService.RefreshAsync(id);
}
/// <summary>
/// 置顶招聘信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/recruitment/top/{id}")]
public async Task<IResponseOutput> TopAsync([Required] long id)
{
return await _recruitmentService.TopAsync(id);
}
/// <summary>
/// 更改招聘信息状态
/// </summary>
/// <param name="id"></param>
/// <param name="status">招聘状态</param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/recruitment/{status}/{id}")]
public async Task<IResponseOutput> UpdateStateAsync([Required] long id, [Required] int status)
{
return await _recruitmentService.UpdateStateAsync(id, status);
}
/// <summary>
/// 是否公开招聘信息
/// </summary>
/// <param name="id"></param>
/// <param name="isPublic"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/recruitment/public/{id}")]
public async Task<IResponseOutput> IsPublicAsync([Required] long id, [Required] bool isPublic)
{
return await _recruitmentService.IsPublicAsync(id, isPublic);
}
}
}

36
src/Znyc.Recruitment.Api/Controllers/ShareController.cs

@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 分享管理
/// </summary>
public class ShareController : BaseController
{
private readonly ICurrencyService _currencyService;
public ShareController(
ICurrencyService currencyService
)
{
_currencyService = currencyService;
}
/// <summary>
/// 分享
/// </summary>
/// <param name="userId"></param>
/// <param name="shareType">newusers(邀请新用户)/dailyshare(每日分享)/personalposter(生成海报)</param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/share/{shareType}/{userId}")]
public async Task<IResponseOutput> ShareAsync(string shareType, long userId)
{
return await _currencyService.ShareAsync(shareType, userId);
}
}
}

46
src/Znyc.Recruitment.Api/Controllers/SignController.cs

@ -0,0 +1,46 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 用户签到管理
/// </summary>
public class SignController : BaseController
{
private readonly ISignService _signService;
public SignController(
ISignService signService
)
{
_signService = signService;
}
/// <summary>
/// 月签到记录
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/sign/{date}")]
public async Task<IResponseOutput<UserSignRecordOutput>> GetAsync(string date)
{
return await _signService.GetAsync(date);
}
/// <summary>
/// 今日签到
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/sign/info")]
public async Task<IResponseOutput> SignAsync()
{
return await _signService.SignAsync();
}
}
}

72
src/Znyc.Recruitment.Api/Controllers/UserController.cs

@ -0,0 +1,72 @@
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 用户管理
/// </summary>
public class UserController : BaseController
{
private readonly IUserService _userService;
public UserController(
IUserService userService
)
{
_userService = userService;
}
///// <summary>
///// 用户信息
///// </summary>
///// <returns></returns>
//[HttpGet]
//[Route("")]
//public async Task<IResponseOutput<UserOutput>> GetUserAsync()
//{
// return await _userService.GetUserAsync();
//}
/// <summary>
/// 修改用户信息
/// </summary>
/// <param name="userUpdateInput"></param>
/// <returns></returns>
[HttpPut]
[Route("api/v1/user")]
public async Task<IResponseOutput<UserOutput>> UpdateAsync(UserUpdateInput userUpdateInput)
{
return await _userService.UpdateAsync(userUpdateInput);
}
/// <summary>
/// 未读提示
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("api/v1/user/unreadinformation")]
public async Task<IResponseOutput<Dictionary<string, int>>> UnreadMessage()
{
return await _userService.UnreadMessage();
}
/// <summary>
/// 我的邀请记录
/// </summary>
/// <param name="currentPage"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[Route("api/v1/user/invitationrecords/search")]
public async Task<IResponseOutput<PageOutput<InviteUserOutput>>> InvitePageAsync(
int currentPage = 1, int pageSize = 20)
{
return await _userService.InvitePageAsync(currentPage, pageSize);
}
}
}

48
src/Znyc.Recruitment.Api/Controllers/WxPayController.cs

@ -0,0 +1,48 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Controllers;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Controllers
{
/// <summary>
/// 支付服务
/// </summary>
public class WxPayController : BaseController
{
private readonly IAuthService _authService;
public WxPayController(IAuthService authService)
{
_authService = authService;
}
/// <summary>
/// 微信小程序支付
/// </summary>
/// <param name="productId">商品Id</param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("api/v1/wxpay/{productId}")]
public Task<IResponseOutput> WxPay(long productId)
{
return _authService.WxPay(productId);
}
/// <summary>
/// 微信小程序支付回调
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
[Route("api/v1/wxpay/notify")]
public Task<string> NotifyUrl()
{
return _authService.NotifyUrl();
}
}
}

18
src/Znyc.Recruitment.Api/Db/Data.cs

@ -0,0 +1,18 @@
using Znyc.Recruitment.Model;
namespace Znyc.Recruitment.Db
{
/// <summary>
/// 数据
/// </summary>
public class Data
{
public DictionaryEntity[] Dictionaries { get; set; }
public PermissionEntity[] Permissions { get; set; }
public UserEntity[] Users { get; set; }
public RoleEntity[] Roles { get; set; }
public UserRoleEntity[] UserRoles { get; set; }
public RolePermissionEntity[] RolePermissions { get; set; }
}
}

2777
src/Znyc.Recruitment.Api/Db/Data/data.json

File diff suppressed because it is too large

62
src/Znyc.Recruitment.Api/Db/DbHelper.cs

@ -0,0 +1,62 @@
using FreeSql.Aop;
using System;
using System.Reflection;
using Yitter.IdGenerator;
using Znyc.Recruitment.Common.Attributes;
using Znyc.Recruitment.Common.Auth;
using Znyc.Recruitment.Common.Extensions;
namespace Znyc.Recruitment.Db
{
public class DbHelper
{
/// <summary>
/// 审计数据
/// </summary>
/// <param name="e"></param>
/// <param name="user"></param>
public static void AuditValue(AuditValueEventArgs e, IUser user)
{
if (e.Column.CsType == typeof(long)
&& e.Property.GetCustomAttribute<SnowflakeAttribute>(false) != null
&& (e.Value.IsNull() || (long)e.Value == default || (long?)e.Value == default))
{
e.Value = YitIdHelper.NextId();
}
if (user.IsNull() || user.Id <= 0)
{
return;
}
if (e.AuditValueType == AuditValueType.Insert)
{
switch (e.Property.Name)
{
case "CreatedUserId":
if (e.Value.IsNull() || (long)e.Value == default || (long?)e.Value == default)
{
e.Value = user.Id;
}
break;
case "CreatedTime":
e.Value = DateTime.Now;
break;
}
}
else if (e.AuditValueType == AuditValueType.Update)
{
switch (e.Property.Name)
{
case "ModifiedUserId":
e.Value = user.Id;
break;
case "ModifiedTime":
e.Value = DateTime.Now;
break;
}
}
}
}
}

67
src/Znyc.Recruitment.Api/Db/ServiceCollectionExtensions.cs

@ -0,0 +1,67 @@
using FreeSql;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Linq;
using Znyc.Recruitment.Common.Attributes;
using Znyc.Recruitment.Common.Auth;
using Znyc.Recruitment.Common.Configs;
using Znyc.Recruitment.Common.Helpers;
namespace Znyc.Recruitment.Db
{
public static class ServiceCollectionExtensions
{
/// <summary>
/// 添加数据库
/// </summary>
/// <param name="services"></param>
/// <param name="env"></param>
public static void AddDb(this IServiceCollection services, IHostEnvironment env)
{
DbConfig dbConfig = new ConfigHelper().Get<AppConfig>("appconfig", env.EnvironmentName).DbConfig;
FreeSqlBuilder freeSqlBuilder = new FreeSqlBuilder()
.UseConnectionString(dbConfig.Type, dbConfig.ConnectionString)
.UseLazyLoading(false)
.UseNoneCommandParameter(true);
// 监听所有命令
if (dbConfig.MonitorCommand)
{
freeSqlBuilder.UseMonitorCommand(cmd => { },
(cmd, traceLog) => { Console.WriteLine($"{cmd.CommandText}\r\n"); });
}
IFreeSql fsql = freeSqlBuilder.Build();
services.AddSingleton(fsql);
services.AddScoped<UnitOfWorkManager>();
//重定义统一平台用户表名
fsql.Aop.ConfigEntity += (s, e) =>
{
if (e.EntityType.GetCustomAttributes(typeof(MasterTableAttribute), false).FirstOrDefault() is
MasterTableAttribute attr)
{
e.ModifyResult.Name = attr.Name; //表名
}
};
// 监听所有sql语句
if (dbConfig.Curd)
{
fsql.Aop.CurdAfter += (s, e) =>
{
Console.WriteLine($"{e.Sql}\r\n");
Console.WriteLine($"耗时:{e.ElapsedMilliseconds}ms\r\n");
};
}
//审计数据
IUser user = services.BuildServiceProvider().GetService<IUser>();
fsql.Aop.AuditValue += (s, e) => { DbHelper.AuditValue(e, user); };
}
}
}

29
src/Znyc.Recruitment.Api/Dockerfile

@ -0,0 +1,29 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Znyc.Recruitment.Api/Znyc.Recruitment.Api.csproj", "Znyc.Recruitment.Api/"]
COPY ["Znyc.Recruitment.Services/Znyc.Recruitment.Service.csproj", "Znyc.Recruitment.Services/"]
COPY ["Znyc.Recruitment.Repository/Znyc.Recruitment.Repository.csproj", "Znyc.Recruitment.Repository/"]
COPY ["Znyc.Recruitment.Model/Znyc.Recruitment.Model.csproj", "Znyc.Recruitment.Model/"]
COPY ["Znyc.Recruitment.Common/Znyc.Recruitment.Common.csproj", "Znyc.Recruitment.Common/"]
RUN dotnet restore "Znyc.Recruitment.Api/Znyc.Recruitment.Api.csproj"
COPY . .
WORKDIR "/src/Znyc.Recruitment.Api"
RUN dotnet build "Znyc.Recruitment.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Znyc.Recruitment.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Znyc.Recruitment.Api.dll"]

18
src/Znyc.Recruitment.Api/Enums/ApiVersion.cs

@ -0,0 +1,18 @@
namespace Znyc.Recruitment.Enums
{
/// <summary>
/// 接口版本
/// </summary>
public enum ApiVersion
{
/// <summary>
/// V1 版本
/// </summary>
v1 = 1,
/// <summary>
/// V2 版本
/// </summary>
v2 = 2
}
}

40
src/Znyc.Recruitment.Api/Enums/StatusCodes.cs

@ -0,0 +1,40 @@
using System.ComponentModel;
namespace Znyc.Recruitment.Enums
{
/// <summary>
/// 状态码枚举
/// </summary>
public enum StatusCodes
{
/// <summary>
/// 操作失败
/// </summary>
[Description("操作失败")] Status0NotOk = 0,
/// <summary>
/// 操作成功
/// </summary>
[Description("操作成功")] Status1Ok = 1,
/// <summary>
/// 未登录(需要重新登录)
/// </summary>
[Description("未登录")] Status401Unauthorized = 401,
/// <summary>
/// 权限不足
/// </summary>
[Description("权限不足")] Status403Forbidden = 403,
/// <summary>
/// 资源不存在
/// </summary>
[Description("资源不存在")] Status404NotFound = 404,
/// <summary>
/// 系统内部错误(非业务代码里显式抛出的异常,例如由于数据不正确导致空指针异常、数据库异常等等)
/// </summary>
[Description("系统内部错误")] Status500InternalServerError = 500
}
}

55
src/Znyc.Recruitment.Api/Extensions/EventBusExtension.cs

@ -0,0 +1,55 @@
using Autofac;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using Znyc.Recruitment.Common.Configs;
using Znyc.Recruitment.Common.Helpers;
using Znyc.Recruitment.Evenbus;
using Znyc.Recruitment.Service;
namespace Znyc.Recruitment.Api.Extensions
{
/// <summary>
/// EventBus 事件总线服务
/// </summary>
public static class EventBusExtension
{
public static void AddEventBusSetup(this IServiceCollection services, IHostEnvironment env)
{
RabbitMQConfig rabbitMQConfig = new ConfigHelper().Get<AppConfig>("appconfig", env.EnvironmentName).RabbitMQConfig;
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
string subscriptionClientName = rabbitMQConfig.Connection;
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
services.AddTransient<ApplyJobdIntegrationEventHandler>();
services.AddTransient<ActivitydIntegrationEventHandler>();
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
IRabbitMQPersistentConnection rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
ILifetimeScope iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
ILogger<EventBusRabbitMQ> logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
IEventBusSubscriptionsManager eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
int retryCount = rabbitMQConfig.RetryCount;
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
});
}
public static void ConfigureEventBus(this IApplicationBuilder app)
{
IEventBus eventBus = app.ApplicationServices.GetRequiredService<IEventBus>();
eventBus.Subscribe<ApplyJobdIntegrationEvent, ApplyJobdIntegrationEventHandler>();
eventBus.Subscribe<ActivitydIntegrationEvent, ActivitydIntegrationEventHandler>();
}
}
}

75
src/Znyc.Recruitment.Api/Extensions/HangFireExtension.cs

@ -0,0 +1,75 @@
using Hangfire;
using Hangfire.Dashboard.BasicAuthorization;
using Hangfire.Redis;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using Znyc.Recruitment.Common.Configs;
using Znyc.Recruitment.Common.Helpers;
using Znyc.Recruitment.HangFire;
namespace Znyc.Recruitment.Api.Extensions
{
/// <summary>
/// HangFire启动服务
/// </summary>
public static class HangFireExtension
{
public static void AddHangFireSetup(this IServiceCollection services, IHostEnvironment env)
{
RedisConfig redisConfig = new ConfigHelper().Get<AppConfig>("appconfig", env.EnvironmentName).RedisConfig;
services.AddHangfire(x => x.UseRedisStorage(redisConfig.ConnectionString));
services.AddHangfireServer(options =>
{
options.Queues = new[] { HangFireQueuesConfig.@default.ToString(), HangFireQueuesConfig.apis.ToString(), HangFireQueuesConfig.web.ToString(), HangFireQueuesConfig.recurring.ToString() };
options.ServerTimeout = TimeSpan.FromMinutes(4);
options.SchedulePollingInterval = TimeSpan.FromSeconds(15);//秒级任务需要配置短点,一般任务可以配置默认时间,默认15秒
options.ShutdownTimeout = TimeSpan.FromMinutes(30); //超时时间
options.WorkerCount = Math.Max(Environment.ProcessorCount, 20); //工作线程数,当前允许的最大线程,默认20
});
}
public static void ConfigureHangFire(this IApplicationBuilder app, IHostEnvironment env)
{
HangFireConfig hangFireConfig = new ConfigHelper().Get<AppConfig>("appconfig", env.EnvironmentName).HangfireConfig;
//授权
var filter = new BasicAuthAuthorizationFilter(
new BasicAuthAuthorizationFilterOptions
{
SslRedirect = false,
// Require secure connection for dashboard
RequireSsl = false,
// Case sensitive login checking
LoginCaseSensitive = false,
// Users
Users = new[]
{
new BasicAuthAuthorizationUser
{
Login =hangFireConfig.Login ,//App.Configuration["Hangfire:Login"],
PasswordClear =hangFireConfig.Password //App.Configuration["Hangfire:Password"]
}
}
});
var options = new DashboardOptions
{
AppPath = "/",//返回时跳转的地址
DisplayStorageConnectionString = false,//是否显示数据库连接信息
Authorization = new[]
{
filter
},
IsReadOnlyFunc = Context =>
{
return false;//是否只读面板
}
};
app.UseHangfireDashboard("/rm_job", options);
HangfireDispose.HangfireService();
}
}
}

41
src/Znyc.Recruitment.Api/Extensions/RabbitMQExtension.cs

@ -0,0 +1,41 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using RabbitMQ.Client;
using System;
using Znyc.Recruitment.Common.Configs;
using Znyc.Recruitment.Common.Helpers;
using Znyc.Recruitment.Evenbus;
namespace Znyc.Recruitment.Api.Extensions
{
/// <summary>
/// RabbitMQ启动服务
/// </summary>
public static class RabbitMQExtension
{
public static void AddRabbitMQSetup(this IServiceCollection services, IHostEnvironment env)
{
RabbitMQConfig rabbitMQConfig = new ConfigHelper().Get<AppConfig>("appconfig", env.EnvironmentName).RabbitMQConfig;
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
{
ILogger<RabbitMQPersistentConnection> logger = sp.GetRequiredService<ILogger<RabbitMQPersistentConnection>>();
ConnectionFactory factory = new ConnectionFactory()
{
HostName = rabbitMQConfig.Connection,
DispatchConsumersAsync = true
};
factory.UserName = rabbitMQConfig.UserName;
factory.Password = rabbitMQConfig.Password;
int retryCount = rabbitMQConfig.RetryCount;
return new RabbitMQPersistentConnection(factory, logger, retryCount);
});
}
}
}

36
src/Znyc.Recruitment.Api/Extensions/UploadConfigApplicationBuilderExtensions.cs

@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.FileProviders;
using System;
using System.IO;
using Znyc.Recruitment.Common.Configs;
using Znyc.Recruitment.Common.Const;
using Znyc.Recruitment.Common.Helpers;
namespace Znyc.Recruitment.Extensions
{
public static class UploadConfigApplicationBuilderExtensions
{
private static void UseFileUploadConfig(IApplicationBuilder app, FileUploadConfig config)
{
if (!Directory.Exists(config.UploadPath))
{
Directory.CreateDirectory(config.UploadPath);
}
app.UseStaticFiles(new StaticFileOptions
{
RequestPath = config.RequestPath,
FileProvider = new PhysicalFileProvider(config.UploadPath)
});
}
public static IApplicationBuilder UseUploadConfig(this IApplicationBuilder app)
{
UploadConfig uploadConfig = new ConfigHelper().Get<AppConfig>("appconfig", Environment.GetEnvironmentVariable(CommonConst.ASPNETCORE_ENVIRONMENT)).UploadConfig;
UseFileUploadConfig(app, uploadConfig.Avatar);
UseFileUploadConfig(app, uploadConfig.Document);
return app;
}
}
}

59
src/Znyc.Recruitment.Api/Filters/ExceptionFilter.cs

@ -0,0 +1,59 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Extensions;
using Znyc.Recruitment.Common.Output;
using Znyc.Recruitment.Enums;
namespace Znyc.Recruitment.Filters
{
/// <summary>
/// 异常错误过滤
/// </summary>
public class ExceptionFilter : IExceptionFilter, IAsyncExceptionFilter
{
private readonly IWebHostEnvironment _env;
private readonly ILogger<ExceptionFilter> _logger;
public ExceptionFilter(IWebHostEnvironment env, ILogger<ExceptionFilter> logger)
{
_env = env;
_logger = logger;
}
public Task OnExceptionAsync(ExceptionContext context)
{
OnException(context);
return Task.CompletedTask;
}
public void OnException(ExceptionContext context)
{
string message;
if (_env.IsProduction())
{
message = StatusCodes.Status500InternalServerError.ToDescription();
}
else
{
message = context.Exception.Message;
}
//_logger.LogError(context.Exception, message);
IResponseOutput data = ResponseOutput.Fail(message);
context.Result = new InternalServerErrorResult(data);
}
}
public class InternalServerErrorResult : ObjectResult
{
public InternalServerErrorResult(object value) : base(value)
{
StatusCode = Microsoft.AspNetCore.Http.StatusCodes.Status500InternalServerError;
}
}
}

69
src/Znyc.Recruitment.Api/Program.cs

@ -0,0 +1,69 @@
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog;
using NLog.Web;
using System;
using System.Threading.Tasks;
using Znyc.Recruitment.Common.Configs;
using Znyc.Recruitment.Common.Const;
using Znyc.Recruitment.Common.Helpers;
namespace Znyc.Recruitment.Api
{
public class Program
{
private static readonly AppConfig AppConfig =
new ConfigHelper().Get<AppConfig>("appconfig",
Environment.GetEnvironmentVariable(CommonConst.ASPNETCORE_ENVIRONMENT)) ?? new AppConfig();
public static async Task<int> Main(string[] args)
{
Logger logger = LogManager.GetCurrentClassLogger();
try
{
Console.WriteLine("project initialization....");
Console.WriteLine(Environment.GetEnvironmentVariable(CommonConst.ASPNETCORE_ENVIRONMENT));
IHost host = CreateHostBuilder(args).Build();
await host.RunAsync();
return 0;
}
catch (Exception ex)
{
Console.WriteLine(ex);
logger.Error(ex, "Stopped program because of exception");
return 1;
}
finally
{
LogManager.Shutdown();
}
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder
// .UseEnvironment(Environments.Production)
.UseStartup<Startup>()
.ConfigureAppConfiguration((host, config) =>
{
})
.UseUrls(AppConfig.Urls);
})
.ConfigureLogging(logging =>
{
// LogManager.LoadConfiguration("Config/nlog.config"); logging.ConfigureNLog($"nlog.{Environment.GetEnvironmentVariable(CommonConst.ASPNETCORE_ENVIRONMENT)}.config");
logging.ClearProviders();
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Warning);
})
.UseNLog();
}
}
}

34
src/Znyc.Recruitment.Api/Properties/launchSettings.json

@ -0,0 +1,34 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5001",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Znyc.Recruitment.Api": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true",
"applicationUrl": "http://localhost"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true
}
}
}

398
src/Znyc.Recruitment.Api/Startup.cs

@ -0,0 +1,398 @@
using Autofac;
using Autofac.Extras.DynamicProxy;
using CSRedis;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Senparc.CO2NET;
using Senparc.CO2NET.AspNet;
using Senparc.Weixin;
using Senparc.Weixin.Entities;
using Senparc.Weixin.RegisterServices;
using Senparc.Weixin.TenPay;
using Swashbuckle.AspNetCore.SwaggerUI;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using Yitter.IdGenerator;
using Znyc.Recruitment.Aop;
using Znyc.Recruitment.Api.Auth;
using Znyc.Recruitment.Api.Extensions;
using Znyc.Recruitment.Auth;
using Znyc.Recruitment.Common.Attributes;
using Znyc.Recruitment.Common.Auth;
using Znyc.Recruitment.Common.Cache;
using Znyc.Recruitment.Common.Configs;
using Znyc.Recruitment.Common.Helpers;
using Znyc.Recruitment.Db;
using Znyc.Recruitment.Enums;
using Znyc.Recruitment.Extensions;
using Znyc.Recruitment.Filters;
using NLog;
using Senparc.Weixin.MP.Containers;
namespace Znyc.Recruitment
{
public class Startup
{
private const string DefaultCorsPolicyName = "Allow";
private readonly AppConfig _appConfig;
private readonly ConfigHelper _configHelper;
private readonly IConfiguration _configuration;
private readonly IHostEnvironment _env;
public Startup(IConfiguration configuration, IWebHostEnvironment env)
{
_configuration = configuration;
_env = env;
_configHelper = new ConfigHelper();
_appConfig = _configHelper.Get<AppConfig>("appconfig", env.EnvironmentName) ?? new AppConfig();
}
private static string BasePath => AppContext.BaseDirectory;
public void ConfigureServices(IServiceCollection services)
{
//雪花漂移算法
YitIdHelper.SetIdGenerator(new IdGeneratorOptions(1) { WorkerIdBitLength = 6 });
// ClaimType不被更改
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
//用户信息
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.TryAddSingleton<IUser, User>();
//数据库
services.AddDb(_env);
//应用配置
services.AddSingleton(_appConfig);
#region AutoMapper 自动映射
var serviceAssembly = Assembly.Load("Znyc.Recruitment.Service");
services.AddAutoMapper(serviceAssembly);
#endregion AutoMapper 自动映射
#region Cors 跨域
if (_appConfig.CorUrls?.Length > 0)
{
services.AddCors(options =>
{
options.AddPolicy(DefaultCorsPolicyName, policy =>
{
policy
.WithOrigins(_appConfig.CorUrls)
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
}
#endregion Cors 跨域
#region Jwt身份认证授权
var jwtConfig = _appConfig.JwtConfig;
services.AddAuthentication(options =>
{
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = nameof(ResponseAuthenticationHandler); //401
options.DefaultForbidScheme = nameof(ResponseAuthenticationHandler); //403
})
.AddJwtBearer(options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = jwtConfig.Issuer,
ValidAudience = jwtConfig.Audience,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtConfig.SecurityKey)),
ClockSkew = TimeSpan.Zero
};
})
.AddScheme<AuthenticationSchemeOptions, ResponseAuthenticationHandler>(
nameof(ResponseAuthenticationHandler), o => { });
#endregion Jwt身份认证授权
#region Swagger Api文档
if (_appConfig.Swagger)
{
services.AddSwaggerGen(options =>
{
typeof(ApiVersion).GetEnumNames().ToList().ForEach(version =>
{
options.SwaggerDoc(version, new OpenApiInfo
{
Version = version,
Title = "Znyc.Recruitment"
});
options.OrderActionsBy(o => o.RelativePath);
});
//生成api文档
var basePath = AppContext.BaseDirectory;
var xmlPath = Path.Combine(basePath, "Znyc.Recruitment.Api.xml");
options.IncludeXmlComments(xmlPath);
#region 添加设置Token的按钮
//添加Jwt验证设置
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Id = "Bearer",
Type = ReferenceType.SecurityScheme
}
},
new List<string>()
}
});
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = "Value: Bearer {token}",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey
});
#endregion 添加设置Token的按钮
});
}
#endregion Swagger Api文档
#region 操作日志
//if (_appConfig.Log.Operation)
//{
// services.AddSingleton<ILogHandler, LogHandler>();
//}
#endregion 操作日志
#region 控制器
services.AddControllers(options =>
{
options.Filters.Add<ExceptionFilter>();
//禁止去除ActionAsync后缀
options.SuppressAsyncSuffixInActionNames = false;
})
.AddNewtonsoftJson(options =>
{
//忽略循环引用
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
//使用驼峰 首字母小写
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
//设置时间格式
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
//设置时区
options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Local;
});
#endregion 控制器
#region 缓存
var cacheConfig = _appConfig.RedisConfig;
var csredis = new CSRedisClient(cacheConfig.ConnectionString);
RedisHelper.Initialization(csredis);
services.AddSingleton<IRedisCache, RedisCache>();
#endregion 缓存
#region Senparc.Weixin 注册
services.AddSenparcWeixinServices(_configuration).AddMemoryCache();
services.TryAddSingleton<IApiHandler, ApiHandler>();
Senparc.Weixin.WxOpen.Containers.AccessTokenContainer.RegisterAsync("wx71f2b227f8eaf00a", "bf868056d4e58f4b2831ff74308120ac");
AccessTokenContainer.RegisterAsync("wx71f2b227f8eaf00a", "bf868056d4e58f4b2831ff74308120ac");
AccessTokenContainer.RegisterAsync("wx78474b2ab9ac3e6c", "a2349cf1dc0871e799109f0f824d38a3");
#endregion
#region RabbitMQ
services.AddRabbitMQSetup(_env);
services.AddEventBusSetup(_env);
#endregion
#region HangFire
services.AddHangFireSetup(_env);
#endregion
#region Nlog
services.Configure<ConsoleLifetimeOptions>(opts => opts.SuppressStatusMessages = true);
if(_env.IsProduction())
LogManager.LoadConfiguration($"nlog.Production.config");
#endregion
}
public void ConfigureContainer(ContainerBuilder builder)
{
#region AutoFac IOC容器
try
{
#region SingleInstance
//无接口注入单例
var assemblyCore = Assembly.Load("Znyc.Recruitment.Api");
var assemblyCommon = Assembly.Load("Znyc.Recruitment.Common");
builder.RegisterAssemblyTypes(assemblyCore, assemblyCommon)
.Where(t => t.GetCustomAttribute<SingleInstanceAttribute>() != null)
.SingleInstance();
//有接口注入单例
builder.RegisterAssemblyTypes(assemblyCore, assemblyCommon)
.Where(t => t.GetCustomAttribute<SingleInstanceAttribute>() != null)
.AsImplementedInterfaces()
.SingleInstance();
#endregion SingleInstance
#region Aop
var interceptorServiceTypes = new List<Type>();
if (_appConfig.Aop.Transaction)
{
builder.RegisterType<TransactionInterceptor>();
interceptorServiceTypes.Add(typeof(TransactionInterceptor));
}
#endregion Aop
#region Repository
var assemblyRepository = Assembly.Load("Znyc.Recruitment.Repository");
builder.RegisterAssemblyTypes(assemblyRepository)
.AsImplementedInterfaces()
.InstancePerDependency();
#endregion Repository
#region Service
var assemblyServices = Assembly.Load("Znyc.Recruitment.Service");
builder.RegisterAssemblyTypes(assemblyServices)
.AsImplementedInterfaces()
.InstancePerDependency()
.EnableInterfaceInterceptors()
.InterceptedBy(interceptorServiceTypes.ToArray());
#endregion Service
}
catch (Exception ex)
{
throw new Exception(ex.Message + "\n" + ex.InnerException);
}
#endregion AutoFac IOC容器
}
public void Configure(IApplicationBuilder app, IOptions<SenparcSetting> senparcSetting,
IOptions<SenparcWeixinSetting> senparcWeixinSetting)
{
#region app配置
//IP限流
//if (_appConfig.RateLimit)
//{
// app.UseIpRateLimiting();
//}
//异常
app.UseExceptionHandler("/Error");
//静态文件
app.UseUploadConfig();
//注册 Senparc.Weixin 及基础库
var registerService = app.UseSenparcGlobal(_env, senparcSetting.Value, _ => { }, true)
.UseSenparcWeixin(senparcWeixinSetting.Value, weixinRegister => weixinRegister
// .RegisterMpAccount(senparcWeixinSetting.Value))
.RegisterTenpayV3(senparcWeixinSetting.Value, "云车招聘"));
//路由
app.UseRouting();
//跨域
if (_appConfig.CorUrls?.Length > 0)
{
app.UseCors(DefaultCorsPolicyName);
}
//认证
app.UseAuthentication();
//授权
app.UseAuthorization();
//Https
// app.UseHsts();
//配置端点
app.UseEndpoints(endpoints => { endpoints.MapDefaultControllerRoute(); });
#endregion app配置
#region Swagger Api文档
if (_appConfig.Swagger)
{
app.UseSwagger();
app.UseSwaggerUI(c =>
{
typeof(ApiVersion).GetEnumNames().OrderBy(e => e).ToList().ForEach(version =>
{
c.SwaggerEndpoint($"/swagger/{version}/swagger.json", $"api {version}");
});
c.RoutePrefix = ""; //直接根目录访问,如果是IIS发布可以注释该语句,并打开launchSettings.launchUrl
c.DocExpansion(DocExpansion.None);
c.DefaultModelsExpandDepth(-1); //不显示Models
});
}
#endregion Swagger Api文档
// 事件总线,订阅服务
app.ConfigureEventBus();
#region HangFire
app.ConfigureHangFire(_env);
#endregion
}
}
}

116
src/Znyc.Recruitment.Api/Znyc.Recruitment.Api.csproj

@ -0,0 +1,116 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<!--<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>-->
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>1.0.0</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Authors>jiaoqi</Authors>
<Company>jiaoqi</Company>
<RepositoryType>git</RepositoryType>
<Description>WebApi</Description>
<PackageProjectUrl>https://gitee.com/guangzhou-zhongneng-cloud-car_1/Znyc.-recruitment.git</PackageProjectUrl>
<RepositoryUrl>https://gitee.com/guangzhou-zhongneng-cloud-car_1/Znyc.-recruitment.git</RepositoryUrl>
<PackageTags>;WebApi</PackageTags>
<PackageId>Znyc.Recruitment</PackageId>
<Product>Znyc.Recruitment</Product>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
<UserSecretsId>717d3417-b18a-454d-aa5f-870d08b412a9</UserSecretsId>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<!-- <DocumentationFile>E:\Znyc\项目\人才招聘\Code\recruitment\src\Znyc.Recruitment.Api\Znyc.Recruitment.Api.xml</DocumentationFile> -->
<NoWarn>1701;1702;1591</NoWarn>
<OutputPath></OutputPath>
<checkforoverflowunderflow>false</checkforoverflowunderflow>
<DocumentationFile>D:\Code\广州众能云车科技有限公司\znyc.recruitment.api\src\Znyc.Recruitment.Api\Znyc.Recruitment.Api.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Remove="AutoMapper\**" />
<Compile Remove="Hubs\**" />
<Compile Remove="wwwroot\**" />
<Content Remove="AutoMapper\**" />
<Content Remove="Hubs\**" />
<Content Remove="wwwroot\**" />
<EmbeddedResource Remove="AutoMapper\**" />
<EmbeddedResource Remove="Hubs\**" />
<EmbeddedResource Remove="wwwroot\**" />
<None Remove="AutoMapper\**" />
<None Remove="Hubs\**" />
<None Remove="wwwroot\**" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Controllers\ApiController.cs" />
<Compile Remove="Controllers\CacheController.cs" />
<Compile Remove="Controllers\DbLogsController.cs" />
<Compile Remove="Controllers\ExceptionsLogsController.cs" />
<Compile Remove="Controllers\LoginLogsController.cs" />
<Compile Remove="Controllers\OperationLogsController.cs" />
<Compile Remove="Controllers\PermissionController.cs" />
<Compile Remove="Controllers\RoleController.cs" />
<Compile Remove="Controllers\UserWxInformationController.cs" />
<Compile Remove="Controllers\ViewController.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="internal-nlog.log" />
<None Remove="Znyc.Recruitment.Repository.dll" />
<None Remove="admin.db" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
<PackageReference Include="CSRedisCore" Version="3.6.8" />
<PackageReference Include="Exceptionless.NLog" Version="4.6.2" />
<PackageReference Include="FluentValidation.AspNetCore" Version="10.3.6" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.12" />
<PackageReference Include="Senparc.Weixin" Version="6.14.0" />
<PackageReference Include="Senparc.Weixin.Cache.Redis" Version="2.14.0" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.17.4" />
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.14.4" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\PublishProfiles\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Znyc.Recruitment.Evenbus\Znyc.Recruitment.Evenbus.csproj" />
<ProjectReference Include="..\Znyc.Recruitment.HangFire\Znyc.Recruitment.HangFire.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="Znyc.Recruitment.Api.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Znyc.Recruitment.Common.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Znyc.Recruitment.Model.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ProjectExtensions>
<VisualStudio><UserProperties properties_4launchsettings_1json__JsonSchema="" /></VisualStudio>
</ProjectExtensions>
</Project>

904
src/Znyc.Recruitment.Api/Znyc.Recruitment.Api.xml

@ -0,0 +1,904 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Znyc.Recruitment.Api</name>
</assembly>
<members>
<member name="T:Znyc.Recruitment.Attributes.HiddenApiAttribute">
<summary>
隐藏接口,不生成到swagger文档展示(Swashbuckle.AspNetCore 5.0.0)
</summary>
</member>
<member name="M:Znyc.Recruitment.Attributes.HiddenApiFilter.Apply(Microsoft.OpenApi.Models.OpenApiDocument,Swashbuckle.AspNetCore.SwaggerGen.DocumentFilterContext)">
<summary>
重写Apply方法,移除隐藏接口的生成
</summary>
<param name="swaggerDoc">swagger文档文件</param>
<param name="context"></param>
</member>
<member name="T:Znyc.Recruitment.Attributes.LoginAttribute">
<summary>
启用登录
</summary>
</member>
<member name="T:Znyc.Recruitment.Attributes.NoOprationLogAttribute">
<summary>
禁用操作日志
</summary>
</member>
<member name="T:Znyc.Recruitment.Attributes.PermissionAttribute">
<summary>
启用权限
</summary>
</member>
<member name="T:Znyc.Recruitment.Attributes.QuartzAttribute">
<summary>
定时任务启动密钥
</summary>
</member>
<member name="T:Znyc.Recruitment.Attributes.ValidateInputAttribute">
<summary>
输入模型验证
</summary>
</member>
<member name="T:Znyc.Recruitment.Attributes.VersionRouteAttribute">
<summary>
自定义路由 /api/{version}/[controler]/[action]
</summary>
</member>
<member name="T:Znyc.Recruitment.Api.Auth.ApiHandler">
<summary>
定时任务
</summary>
</member>
<member name="T:Znyc.Recruitment.Api.Auth.IApiHandler">
<summary>
定时任务
</summary>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.ActivityController">
<summary>
活动页
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ActivityController.GetListAsync">
<summary>
查询活动列表
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ActivityController.GetAsync(System.Int64)">
<summary>
根据Id查询活动详情
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ActivityController.GetInviteTopAsync(System.Int32,System.Int32)">
<summary>
邀请排行榜
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ActivityController.GetTotalSeriesDaysAsync(System.Int32,System.Int32)">
<summary>
累计签到排行榜
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ActivityController.GetAvailableCreditsAsync(System.Int32,System.Int32)">
<summary>
积分排行榜
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ActivityController.GetApplyJobPageViewAsync(System.Int32,System.Int32)">
<summary>
求职浏览量排行榜
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ActivityController.GetRecruitmentPageViewAsync(System.Int32,System.Int32)">
<summary>
招聘浏览量排行榜
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.AuditController">
<summary>
审核记录管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.AuditController.PageAsync(System.Int32,System.Int32)">
<summary>
审核记录
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.AuthController">
<summary>
授权管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.AuthController.GetAccessTokenAsync">
<summary>
百度地图获取AccessToken
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.AuthController.GetWxAccessTokenAsync">
<summary>
微信获取AccessToken
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.AuthController.GetUnlimitedAsync(System.String)">
<summary>
获取小程序码
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.BannerController">
<summary>
广告页
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.BannerController.GetBannerListAsync(System.Int32)">
<summary>
查询广告列表
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.BrowseController">
<summary>
用户浏览信息管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.BrowseController.ApplyJobPageAsync(System.Int32,System.Int32)">
<summary>
用户浏览求职信息
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.BrowseController.RecruitmentPageAsync(System.Int32,System.Int32)">
<summary>
用户浏览招聘信息
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.CallFeedbackController">
<summary>
通话评价
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CallFeedbackController.AddCallFeedbackAsync(Znyc.Recruitment.Service.CallFeedbackAddInput)">
<summary>
新增通话评价
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.CertificationController">
<summary>
实名认证管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CertificationController.GetAsync">
<summary>
查询实名认证信息
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CertificationController.AddAsync(Znyc.Recruitment.Service.CertificationAddInput)">
<summary>
新增实名认证信息
</summary>
<param name="certificationAddInput"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CertificationController.UpdateAsync(Znyc.Recruitment.Service.CertificationUpdateInput)">
<summary>
更新实名认证信息
</summary>
<param name="certificationUpdateInput"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CityEncyclopediaController.GetListByIdAsync">
<summary>
查询行业岗位
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.CollectionController">
<summary>
用户收藏信息管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CollectionController.ApplyJobPageAsync(System.Int32,System.Int32)">
<summary>
用户收藏求职信息
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CollectionController.RecruitmentPageAsync(System.Int32,System.Int32)">
<summary>
用户收藏招聘信息
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CollectionController.AddAsync(System.Int32,System.Int64)">
<summary>
</summary>
<param name="productType"></param>
<param name="productId"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CollectionController.CancelAsync(System.Int32,System.Int64)">
<summary>
取消收藏
</summary>
<param name="productType"></param>
<param name="productId"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.CurrencyController">
<summary>
用户云币管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CurrencyController.GetAsync">
<summary>
获取用户云币信息
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CurrencyController.PageAsync(System.Int32,System.Int32,System.Int32)">
<summary>
云币账单
</summary>
<param name="currencyType">0-全部/1-增加/2-减少</param>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.CurrencyIntroController">
<summary>
用户云币管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.CurrencyIntroController.ListAsync">
<summary>
获取云币来源列表
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.DeliveryResumeController">
<summary>
用户投递简历信息管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.DeliveryResumeController.ApplyJobPageAsync(Znyc.Recruitment.Common.Enums.DeliveryType,System.Int32,System.Int32)">
<summary>
我的求职--我的投递/对我感兴趣
</summary>
<param name="deliveryType">1-我的投递/2-对我感兴趣</param>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.DeliveryResumeController.RecruitmentPageAsync(Znyc.Recruitment.Common.Enums.DeliveryType,System.Int32,System.Int32)">
<summary>
我的招聘——我感兴趣的/收到的求职
</summary>
<param name="deliveryType">1-收到的求职/2-我感兴趣的</param>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.DeliveryResumeController.AddAsync(Znyc.Recruitment.Service.DeliveryResumeAddInput)">
<summary>
新增用户投递简历信息
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.DeliveryResumeController.UpdateAsync(System.Int32)">
<summary>
已查看用户投递简历信息
</summary>
<param name="productType">1--求职/2--招聘</param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.DocumentController">
<summary>
文档管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.DocumentController.UploadImageAsync">
<summary>
上传文档图片
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.FeedbackController">
<summary>
意见反馈
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.FeedbackController.AddFeedbackAsync(Znyc.Recruitment.Service.FeedbackAddInput)">
<summary>
新增意见反馈
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.IndustryJobsController">
<summary>
行业岗位管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.IndustryJobsController.GetListByIdAsync(System.Int64)">
<summary>
查询行业岗位
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.LoginController">
<summary>
登录管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.LoginController.Login(Znyc.Recruitment.Service.LoginInput)">
<summary>
Wx登录授权
</summary>
<param name="loginInput"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.MessageController">
<summary>
信息通知管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.MessageController.MessageLogsPageAsync(System.Int32,System.Int32,System.Int32)">
<summary>
查询消息通知列表
</summary>
<param name="productType"></param>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.MessageController.UpdateAsync(System.Int32)">
<summary>
已读消息记录
</summary>
<param name="productType">1--求职/2--招聘/3--实名</param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.MessageController.GetRegistUserListAsync">
<summary>
获取新用户滚动播放列表
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.MessageController.GetInviteNewUserAsync">
<summary>
邀请新用户信息滚动播放列表
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.ProductCategoryController">
<summary>
商品品牌表
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ProductCategoryController.ListAsync">
<summary>
产品图片
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.ProductInfoController">
<summary>
商品服务
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ProductInfoController.PageAsync(System.Int64,System.Int64,System.String,System.Int32,System.Int32)">
<summary>
分页获取商品信息
</summary>
<param name="key"></param>
<param name="brandId">品牌</param>
<param name="categoryId">分类</param>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.ProductPicController">
<summary>
产品图片
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ProductPicController.ListAsync">
<summary>
产品图片
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.ProudctWarehouseController">
<summary>
Banner
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ProudctWarehouseController.ListAsync">
<summary>
产品图片
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.QuartzController">
<summary>
定时调度
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.QuartzController.CancelTopAsync">
<summary>
置顶到期取消
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.QuartzController.ResetSignAsync">
<summary>
月重置签到次数
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.QuartzController.ResetTemporaryCurrencyAsync">
<summary>
每日清空临时积分
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.QuartzController.ResetCurrencyIntroAsync">
<summary>
每日清空云币来源缓存
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.QuartzController.PageViewAsync">
<summary>
同步浏览量
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.RechargeController">
<summary>
充值活动服务
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RechargeController.GetAsync">
<summary>
获取充值活动
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.RecruitmentController">
<summary>
招聘信息管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.GetByIdAsync(System.Int64)">
<summary>
单条查询
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.MyRecruitmentPageAsync(Znyc.Recruitment.Common.Enums.ProductStatusEnum,System.Int32,System.Int32)">
<summary>
我的招聘信息
</summary>
<param name="productStatus">招聘状态</param>
<param name="currentPage">当前页码</param>
<param name="pageSize">页数</param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.PageAsync(System.String,System.Int64,System.Int64,System.Int64,System.Int64,System.Int64,System.String,System.Int32,System.Int32)">
<summary>
分页查询招聘信息
</summary>
<param name="key">标题</param>
<param name="provinceId"></param>
<param name="cityId"></param>
<param name="industryId">行业Id</param>
<param name="jobId">岗位Id</param>
<param name="sort">排序</param>
<param name="currentPage">当前页码</param>
<param name="pageSize">页数</param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.GetPhoneAndReleaseAsync(System.Int64)">
<summary>
获取上一次发布信息的手机号码和发布人
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.GetPhoneAsync(System.Int64)">
<summary>
获取手机号码
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.AddAsync(Znyc.Recruitment.Service.RecruitmentAddInput)">
<summary>
新增招聘信息
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.UpdateAsync(Znyc.Recruitment.Service.RecruitmentUpdateInput)">
<summary>
编辑招聘信息
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.RefreshAsync(System.Int64)">
<summary>
刷新招聘信息
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.TopAsync(System.Int64)">
<summary>
置顶招聘信息
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.UpdateStateAsync(System.Int64,System.Int32)">
<summary>
更改招聘信息状态
</summary>
<param name="id"></param>
<param name="status">招聘状态</param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.RecruitmentController.IsPublicAsync(System.Int64,System.Boolean)">
<summary>
是否公开招聘信息
</summary>
<param name="id"></param>
<param name="isPublic"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.ShareController">
<summary>
分享管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.ShareController.ShareAsync(System.String,System.Int64)">
<summary>
分享
</summary>
<param name="userId"></param>
<param name="shareType">newusers(邀请新用户)/dailyshare(每日分享)/personalposter(生成海报)</param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.SignController">
<summary>
用户签到管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.SignController.GetAsync(System.String)">
<summary>
月签到记录
</summary>
<param name="date"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.SignController.SignAsync">
<summary>
今日签到
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.UserController">
<summary>
用户管理
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.UserController.UpdateAsync(Znyc.Recruitment.Service.UserUpdateInput)">
<summary>
修改用户信息
</summary>
<param name="userUpdateInput"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.UserController.UnreadMessage">
<summary>
未读提示
</summary>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.UserController.InvitePageAsync(System.Int32,System.Int32)">
<summary>
我的邀请记录
</summary>
<param name="currentPage"></param>
<param name="pageSize"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Controllers.WxPayController">
<summary>
支付服务
</summary>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.WxPayController.WxPay(System.Int64)">
<summary>
微信小程序支付
</summary>
<param name="productId">商品Id</param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Api.Controllers.WxPayController.NotifyUrl">
<summary>
微信小程序支付回调
</summary>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Api.Extensions.EventBusExtension">
<summary>
EventBus 事件总线服务
</summary>
</member>
<member name="T:Znyc.Recruitment.Api.Extensions.HangFireExtension">
<summary>
HangFire启动服务
</summary>
</member>
<member name="T:Znyc.Recruitment.Api.Extensions.RabbitMQExtension">
<summary>
RabbitMQ启动服务
</summary>
</member>
<member name="T:Znyc.Recruitment.Auth.IPermissionHandler">
<summary>
权限处理接口
</summary>
</member>
<member name="M:Znyc.Recruitment.Auth.IPermissionHandler.ValidateAsync(System.String,System.String)">
<summary>
权限验证
</summary>
<param name="api"></param>
<param name="httpMethod"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Auth.PermissionHandler">
<summary>
权限处理
</summary>
</member>
<member name="M:Znyc.Recruitment.Auth.PermissionHandler.ValidateAsync(System.String,System.String)">
<summary>
权限验证 v1.1.0后增加权限验证
</summary>
<param name="api"> 接口路径 </param>
<param name="httpMethod">http请求方法</param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Auth.ResponseAuthenticationHandler">
<summary>
响应认证处理器
</summary>
</member>
<member name="T:Znyc.Recruitment.Controllers.BaseController">
<summary>
基础控制器
</summary>
</member>
<member name="T:Znyc.Recruitment.Controllers.DictionaryController">
<summary>
数据字典
</summary>
</member>
<member name="M:Znyc.Recruitment.Controllers.DictionaryController.GetByIdAsync(System.Int32)">
<summary>
根据Id获取字典
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.Recruitment.Controllers.DictionaryController.GetListByCodeAsync(System.String)">
<summary>
</summary>
<param name="code"></param>
<returns></returns>
</member>
<member name="T:Znyc.Recruitment.Db.Data">
<summary>
数据
</summary>
</member>
<member name="M:Znyc.Recruitment.Db.DbHelper.AuditValue(FreeSql.Aop.AuditValueEventArgs,Znyc.Recruitment.Common.Auth.IUser)">
<summary>
审计数据
</summary>
<param name="e"></param>
<param name="user"></param>
</member>
<member name="M:Znyc.Recruitment.Db.ServiceCollectionExtensions.AddDb(Microsoft.Extensions.DependencyInjection.IServiceCollection,Microsoft.Extensions.Hosting.IHostEnvironment)">
<summary>
添加数据库
</summary>
<param name="services"></param>
<param name="env"></param>
</member>
<member name="T:Znyc.Recruitment.Enums.ApiVersion">
<summary>
接口版本
</summary>
</member>
<member name="F:Znyc.Recruitment.Enums.ApiVersion.v1">
<summary>
V1 版本
</summary>
</member>
<member name="F:Znyc.Recruitment.Enums.ApiVersion.v2">
<summary>
V2 版本
</summary>
</member>
<member name="T:Znyc.Recruitment.Enums.StatusCodes">
<summary>
状态码枚举
</summary>
</member>
<member name="F:Znyc.Recruitment.Enums.StatusCodes.Status0NotOk">
<summary>
操作失败
</summary>
</member>
<member name="F:Znyc.Recruitment.Enums.StatusCodes.Status1Ok">
<summary>
操作成功
</summary>
</member>
<member name="F:Znyc.Recruitment.Enums.StatusCodes.Status401Unauthorized">
<summary>
未登录(需要重新登录)
</summary>
</member>
<member name="F:Znyc.Recruitment.Enums.StatusCodes.Status403Forbidden">
<summary>
权限不足
</summary>
</member>
<member name="F:Znyc.Recruitment.Enums.StatusCodes.Status404NotFound">
<summary>
资源不存在
</summary>
</member>
<member name="F:Znyc.Recruitment.Enums.StatusCodes.Status500InternalServerError">
<summary>
系统内部错误(非业务代码里显式抛出的异常,例如由于数据不正确导致空指针异常、数据库异常等等)
</summary>
</member>
<member name="T:Znyc.Recruitment.Filters.ExceptionFilter">
<summary>
异常错误过滤
</summary>
</member>
<member name="T:Znyc.apply.Api.Controllers.ApplyJobController">
<summary>
求职信息管理
</summary>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.GetAsync(System.Int64)">
<summary>
单条查询
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.GetMyApplyAsync">
<summary>
我的求职简历
</summary>
<returns></returns>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.PageAsync(System.String,System.String,System.String,System.Int64,System.Int64,System.Int64,System.String,System.Int32,System.Int32)">
<summary>
分页查询
</summary>
<param name="key">内容</param>
<param name="provinceId"></param>
<param name="cityId"></param>
<param name="industryId">行业id</param>
<param name="jobId">岗位类型</param>
<param name="sort">排序</param>
<param name="currentPage">当前页</param>
<param name="pageSize">页数</param>
<returns></returns>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.GetPhoneAsync(System.Int64)">
<summary>
获取手机号码
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.AddAsync(Znyc.Recruitment.Service.ApplyJobAddInput)">
<summary>
添加求职信息
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.UpdateAsync(Znyc.Recruitment.Service.ApplyJobUpdateInput)">
<summary>
修改求职信息
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.RefreshAsync(System.Int64)">
<summary>
一键刷新
</summary>
<returns></returns>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.UpdateTopAsync(System.Int64)">
<summary>
置顶求职信息
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.UpdateStateAsync(System.Int32,System.Int64)">
<summary>
更改求职信息状态
</summary>
<param name="id"></param>
<param name="status">求职状态1-正在找/2-已找到</param>
<returns></returns>
</member>
<member name="M:Znyc.apply.Api.Controllers.ApplyJobController.IsPublicAsync(System.Boolean,System.Int64)">
<summary>
是否公开求职信息
</summary>
<param name="id"></param>
<param name="isPublic"></param>
<returns></returns>
</member>
</members>
</doc>

38
src/Znyc.Recruitment.Api/appsettings.Development.json

@ -0,0 +1,38 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Trace",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
//CO2NET
"SenparcSetting": {
"DefaultCacheNamespace": "DefaultCache",
"IsDebug": true,
"SenparcUnionAgentKey": "#{SenparcUnionAgentKey}#"
},
//Senparc.Weixin SDK
"SenparcWeixinSetting": {
//
"IsDebug": true,
//
"WxOpenAppId": "wx71f2b227f8eaf00a",
"WxOpenAppSecret": "8bf5367798b22856f4daf0d0fd4db6b0",
"WxOpenToken": "#{WxOpenToken}#",
"WxOpenEncodingAESKey": "#{WxOpenEncodingAESKey}#",
////
"WeixinAppId": "wx78474b2ab9ac3e6c",
"WeixinAppSecret": "a2349cf1dc0871e799109f0f824d38a3",
//V3
"TenPayV3_AppId": "wx71f2b227f8eaf00a",
"TenPayV3_AppSecret": "8bf5367798b22856f4daf0d0fd4db6b0",
"TenPayV3_MchId": "1610262173",
"TenPayV3_Key": "KlRZJKvAstv4SJapStuyHhCOzqrrjSUD",
"TenPayV3_TenpayNotify": "https://znyc.natapp4.cc/api/v1/wxpay/notify",
"TenPayV3_WxOpenTenpayNotify": "https://znyc.natapp4.cc/api/v1/wxpay/notify"
}
}

40
src/Znyc.Recruitment.Api/appsettings.Production.json

@ -0,0 +1,40 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Trace",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
//CO2NET
"SenparcSetting": {
"DefaultCacheNamespace": "DefaultCache",
"IsDebug": true,
"SenparcUnionAgentKey": "#{SenparcUnionAgentKey}#"
},
//Senparc.Weixin SDK
"SenparcWeixinSetting": {
//
"IsDebug": true,
//
"WxOpenAppId": "wx71f2b227f8eaf00a",
"WxOpenAppSecret": "8bf5367798b22856f4daf0d0fd4db6b0",
"WxOpenToken": "#{WxOpenToken}#",
"WxOpenEncodingAESKey": "#{WxOpenEncodingAESKey}#",
////
//"WeixinAppId": "wx78474b2ab9ac3e6c",
//"WeixinAppSecret": "a2349cf1dc0871e799109f0f824d38a3",
//V3
"TenPayV3_AppId": "wx71f2b227f8eaf00a",
"TenPayV3_AppSecret": "8bf5367798b22856f4daf0d0fd4db6b0",
"TenPayV3_MchId": "1610262173",
"TenPayV3_Key": "KlRZJKvAstv4SJapStuyHhCOzqrrjSUD",
"TenPayV3_TenpayNotify": "https://znyunche.com/api/v1/wxpay/notify",
"TenPayV3_WxOpenTenpayNotify": "https://znyunche.com/api/v1/wxpay/notify"
}
}

41
src/Znyc.Recruitment.Api/appsettings.Staging.json

@ -0,0 +1,41 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Trace",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
//CO2NET
"SenparcSetting": {
"DefaultCacheNamespace": "DefaultCache",
"IsDebug": true,
"SenparcUnionAgentKey": "#{SenparcUnionAgentKey}#"
},
//Senparc.Weixin SDK
"SenparcWeixinSetting": {
//
"IsDebug": true,
//
"WxOpenAppId": "wx71f2b227f8eaf00a",
"WxOpenAppSecret": "8bf5367798b22856f4daf0d0fd4db6b0",
"WxOpenToken": "#{WxOpenToken}#",
"WxOpenEncodingAESKey": "#{WxOpenEncodingAESKey}#",
////
//"WeixinAppId": "wx78474b2ab9ac3e6c",
//"WeixinAppSecret": "a2349cf1dc0871e799109f0f824d38a3",
//V3
"TenPayV3_AppId": "wx71f2b227f8eaf00a",
"TenPayV3_AppSecret": "8bf5367798b22856f4daf0d0fd4db6b0",
"TenPayV3_MchId": "1610262173",
"TenPayV3_Key": "KlRZJKvAstv4SJapStuyHhCOzqrrjSUD",
"TenPayV3_TenpayNotify": "https://znyunche.com/api/v1/wxpay/notify",
"TenPayV3_WxOpenTenpayNotify": "https://znyunche.com/api/v1/wxpay/notify"
}
}

289
src/Znyc.Recruitment.Api/configs/appconfig.Development.json

@ -0,0 +1,289 @@
{
//Api
"urls": [ "http://*:80" ],
//
"corUrls": [ "http://*:9000" ],
//Swagger
"swagger": true,
//
"IdentityServer": {
//
"enable": false,
"url": ""
},
//
"aop": {
//
"transaction": true
},
//
"rateLimit": false,
"BaiduConfig": {
"AppID": "23954973",
"ApiKey": "zCU8ZvomVm3upmIlI9kY8svK",
"SecretKey": "H4m3G8adKbRpIICyKtX8rqjHmjCugld9"
},
"RedisConfig": {
//
"connectionString": "81.71.148.57:46379,password=dfeFEgeGH/,defaultdatabase=0"
//
//"connectionStringRateLimit": "81.71.148.57:46379,password=dfeFEgeGH/,defaultdatabase=0"
},
"DbConfig": {
//
"monitorCommand": true,
//Curd
"curd": true,
// MySql = 0,
"type": 0,
//
//
"connectionString": "Server=81.71.148.57; Port=43306; Database=znyc_recruitment; Uid=znyc; Pwd=bIQISVSO; Charset=utf8mb4",
//
"slaveConnectionStringList": [
//"Server=81.71.148.57; Port=43306; Database=znyc_recruitment; Uid=znyc; Pwd=bIQISVSO; Charset=utf8mb4",
]
},
"JwtConfig": {
//
"issuer": "Znyc",
//
"audience": "Znyc",
//
"securityKey": "ertJKl#521*a@790asD&1#",
//() 2880 = 2
"expires": 2880,
//() 4320 = 3
"refreshExpires": 4320
},
"RateLimiting": {
/*
https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/IpRateLimitMiddleware
https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Using-Redis-as-a-distributed-counter-store
*/
"IpRateLimiting": {
"EnableEndpointRateLimiting": true,
"StackBlockedRequests": false,
"RealIpHeader": "X-Real-IP",
"ClientIdHeader": "X-ClientId",
"IpWhitelist": [], // "127.0.0.1"
"EndpointWhitelist": [ "get:/api/auth/refresh" ], // "get:/api/a", "*:/api/b"
"ClientWhitelist": [],
"HttpStatusCode": 429,
"QuotaExceededResponse": {
"Content": "{{\"code\":429,\"msg\":\"访问过于频繁!\"}}",
"ContentType": "application/json",
"StatusCode": 429
},
"GeneralRules": [
{
"Endpoint": "*",
"Period": "1s",
"Limit": 3
},
{
"Endpoint": "*",
"Period": "10m",
"Limit": 200
}
]
}
},
"SMSConfig": {
"SecretId": "AKIDGSN2VjJkZ7pIYzcdo0zjDCKCnQpEhXbW",
"SecretKey": "rQDI7fuoUyIEvLT5RWKqkUyGQJwBiU2P",
"SmsSdkAppid": "1400497500",
//
"Sign": "众能云车",
"Region": "ap-guangzhou",
//
"TemplateList": [
{
//
"ChangePhoneTemplateId": "900754",
//
"CertificationTemplateId": "925734"
}
]
},
"UploadConfig": {
//
"avatar": {
// D:/upload/admin/avatar
"uploadPath": "../upload/avatar",
//
"requestPath": "/upload/avatar",
//
"readPath": "https://znyc-rm-1306377152.cos.ap-guangzhou.myqcloud.com/",
// yyyy/MM/dd
"dateTimeFormat": "",
//{}
"format": "",
// 1M = 1 * 1024 * 1024
"maxSize": 1048576,
//-1
"limit": 1,
//
"contentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif" ]
},
//
"document": {
// D:/upload/admin/document
"uploadPath": "../upload/document",
//
"requestPath": "/images",
// yyyy/MM/dd
"dateTimeFormat": "",
//{}
"format": "",
// 1M = 1 * 1024 * 1024
"maxSize": 1048576,
//-1
"limit": -1,
//
"contentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif" ]
}
},
"CosConfig": {
"secretId": "AKIDGMBk7D3cuvf8KFtGMBj00iALFsEJ7dsq",
"secretKey": "i9IBn8Bzav0pMcbJkunPjmY3HsCF2Zom",
"bucket": "Znyc-images-1306377152",
"region": "ap-guangzhou",
"allowPrefix": "a.jpg",
"durationSeconds": 1800,
"allowActions": [
"name/cos:PutObject",
//
"name/cos:PostObject",
//
"name/cos:InitiateMultipartUpload",
"name/cos:ListMultipartUploads",
"name/cos:ListParts",
"name/cos:UploadPart",
"name/cos:CompleteMultipartUpload"
]
},
"WxConfig": {
//AppID(ID)
"AppId": "wx71f2b227f8eaf00a",
//AppSecret()
"AppSecret": "bf868056d4e58f4b2831ff74308120ac",
"EnvVersion": "trial",
//
"WxTemplateList": [
{
//
"CurrencyChangeTemplate": "6YXRyjN8An9fcxqsZeyEJLn_fp9fA-ic1eksWqnSu-s",
//
"ApprovalResultsTemplate": "dm1yuO5nVqiRQyMWcS4VZOjOZY5rDCjhiqiUcueyMJc",
"CallFeedbackTemplate": "4-TN3LtOf5cUq_xhHg4Aymq3_t2ywbt4nljwxGEqhBk"
}
],
//
////
"WeixinAppId": "wx78474b2ab9ac3e6c",
"WxOpenAppSecret": "a2349cf1dc0871e799109f0f824d38a3",
"WxOpenToken": "rzC0pRTuBznwd3",
"WxOpenEncodingAESKey": "Z9ifQKA8kvQjybOXuXl8I0r9cFHWJGwW2q5iE5e37AM",
//V3
"TenPayV3_MchId": "#{TenPayV3_MchId}#",
"TenPayV3_SubMchId": "#{TenPayV3_SubMchId}#", //
"TenPayV3_Key": "#{TenPayV3_Key}#",
"TenPayV3_AppId": "#{TenPayV3_AppId}#",
"TenPayV3_AppSecret": "#{TenPayV3_AppSecret}#",
"TenPayV3_TenpayNotify": "#{TenPayV3_TenpayNotify}#", //http://YourDomainName/TenpayV3/PayNotifyUrl
//TenPayV3_WxOpenTenpayNotify TenPayV3_TenpayNotify "WxOpen"
"TenPayV3_WxOpenTenpayNotify": "#{TenPayV3_WxOpenTenpayNotify}#" //http://YourDomainName/TenpayV3/PayNotifyUrlWxOpen
},
"LogConfig": {
/*
* https://nlog-project.org/config/
* use
private readonly ILogger<T> _logger;
constructor(ILogger<T> logger)
{
_logger = logger;
}
_logger.LogDebug(1, "调试");
private readonly ILogger _logger;
constructor()
{
_logger = LogManager.GetLogger("loggerName");
_logger = LogManager.GetCurrentClassLogger();
}
_logger.Error("错误");
*/
"nLog": {
"extensions": {
"NLog.Web.AspNetCore": {
"assembly": "NLog.Web.AspNetCore"
}
},
"targets": {
//
"debug": {
"type": "File",
"fileName": "../logs/debug-${shortdate}.log",
"layout": "${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}"
},
//
"warn": {
"type": "File",
"fileName": "../logs/warn-${shortdate}.log",
"layout": "${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}"
},
//
"error": {
"type": "File",
"fileName": "../logs/error-${shortdate}.log",
"layout": "${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}"
}
},
"rules": [
{
"logger": "*",
"minLevel": "Trace",
"maxlevel": "Debug",
"writeTo": "debug"
},
{
"logger": "*",
"minLevel": "Info",
"maxlevel": "Warn",
"writeTo": "warn"
},
{
"logger": "*",
"minLevel": "Error",
"maxlevel": "Fatal",
"writeTo": "error"
},
//
{
"logger": "Microsoft.*",
"maxLevel": "Info",
"final": "true"
}
]
}
},
"RabbitMQConfig": {
"Connection": "81.71.148.57",
"UserName": "znyc",
"Password": "znyc2021",
"RetryCount": 3
},
"HangfireConfig": {
"Login": "znyc",
"Password": "znyc2021"
}
}

291
src/Znyc.Recruitment.Api/configs/appconfig.Production.json

@ -0,0 +1,291 @@
{
//Api
"urls": [ "http://*:80" ],
//
"corUrls": [ "http://*:9000" ],
//Swagger
"swagger": false,
//
"IdentityServer": {
//
"enable": true,
"url": ""
},
//
"aop": {
//
"transaction": true
},
//
"rateLimit": false,
//ocr
"BaiduConfig": {
"AppID": "23954973",
"ApiKey": "zCU8ZvomVm3upmIlI9kY8svK",
"SecretKey": "H4m3G8adKbRpIICyKtX8rqjHmjCugld9"
},
"RedisConfig": {
//
"connectionString": "172.16.0.17:6379"
//
//"connectionStringRateLimit": "172.16.0.17:6379"
},
"DbConfig": {
//
"monitorCommand": false,
//Curd
"curd": false,
// MySql = 0,
"type": 0,
//
"connectionString": "Server=172.16.0.6; Port=3306; Database=znyc_recruitment; Uid=znyc; Pwd=UhcAoRR5A3hnt^%U; Charset=utf8mb4;",
//
"slaveConnectionStringList": [
//Server=172.16.0.6; Port=3306; Database=Znyc_recruitment; Uid=Znyc; Pwd=UhcAoRR5A3hnt^%U; Charset=utf8mb4
]
},
"JwtConfig": {
//
"issuer": "Znyc",
//
"audience": "Znyc",
//
"securityKey": "ertJKl#521*a@790asD&1#",
//() 2880 = 2
"expires": 2880,
//() 4320 = 3
"refreshExpires": 4320
},
"RateLimiting": {
/*
https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/IpRateLimitMiddleware
https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Using-Redis-as-a-distributed-counter-store
*/
"IpRateLimiting": {
"EnableEndpointRateLimiting": true,
"StackBlockedRequests": false,
"RealIpHeader": "X-Real-IP",
"ClientIdHeader": "X-ClientId",
"IpWhitelist": [], // "127.0.0.1"
"EndpointWhitelist": [ "get:/api/auth/refresh" ], // "get:/api/a", "*:/api/b"
"ClientWhitelist": [],
"HttpStatusCode": 429,
"QuotaExceededResponse": {
"Content": "{{\"code\":429,\"msg\":\"访问过于频繁!\"}}",
"ContentType": "application/json",
"StatusCode": 429
},
"GeneralRules": [
{
"Endpoint": "*",
"Period": "1s",
"Limit": 3
},
{
"Endpoint": "*",
"Period": "10m",
"Limit": 200
}
]
}
},
"SMSConfig": {
"SecretId": "AKIDGSN2VjJkZ7pIYzcdo0zjDCKCnQpEhXbW",
"SecretKey": "rQDI7fuoUyIEvLT5RWKqkUyGQJwBiU2P",
"SmsSdkAppid": "1400497500",
//
"Sign": "众能云车",
"Region": "ap-guangzhou",
//
"TemplateList": [
{
//
"ChangePhoneTemplateId": "900754",
//
"CertificationTemplateId": "925734"
}
]
},
"UploadConfig": {
//
"avatar": {
// D:/upload/admin/avatar
"uploadPath": "../upload/avatar",
//
"requestPath": "/upload/avatar",
//
"readPath": "https://Znyc-rm-1306377152.cos.ap-guangzhou.myqcloud.com/",
// yyyy/MM/dd
"dateTimeFormat": "",
//{}
"format": "",
// 1M = 1 * 1024 * 1024
"maxSize": 1048576,
//-1
"limit": 1,
//
"contentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif" ]
},
//
"document": {
// D:/upload/admin/document
"uploadPath": "../upload/document",
//
"requestPath": "/images",
// yyyy/MM/dd
"dateTimeFormat": "",
//{}
"format": "",
// 1M = 1 * 1024 * 1024
"maxSize": 1048576,
//-1
"limit": -1,
//
"contentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif" ]
},
"secretId": "AKIDGSN2VjJkZ7pIYzcdo0zjDCKCnQpEhXbW",
"secretKey": "rQDI7fuoUyIEvLT5RWKqkUyGQJwBiU2P",
"bucket": "Znyc-rm-1306377152",
"region": "ap-guangzhou"
},
"CosConfig": {
"secretId": "AKIDGMBk7D3cuvf8KFtGMBj00iALFsEJ7dsq",
"secretKey": "i9IBn8Bzav0pMcbJkunPjmY3HsCF2Zom",
"bucket": "Znyc-images-1306377152",
"region": "ap-guangzhou",
"allowPrefix": "a.jpg",
"durationSeconds": 1800,
"allowActions": [
"name/cos:PutObject",
//
"name/cos:PostObject",
//
"name/cos:InitiateMultipartUpload",
"name/cos:ListMultipartUploads",
"name/cos:ListParts",
"name/cos:UploadPart",
"name/cos:CompleteMultipartUpload"
]
},
"WxConfig": {
//AppID(ID)
"AppId": "wx71f2b227f8eaf00a",
//AppSecret()
"AppSecret": "bf868056d4e58f4b2831ff74308120ac",
"EnvVersion": "release",
//
"WxTemplateList": [
{
//
"CurrencyChangeTemplate": "6YXRyjN8An9fcxqsZeyEJLn_fp9fA-ic1eksWqnSu-s",
//
"ApprovalResultsTemplate": "dm1yuO5nVqiRQyMWcS4VZOjOZY5rDCjhiqiUcueyMJc",
"CallFeedbackTemplate": "4-TN3LtOf5cUq_xhHg4Aymq3_t2ywbt4nljwxGEqhBk"
}
],
//
"WeixinAppId": "wx78474b2ab9ac3e6c",
"WxOpenAppSecret": "a2349cf1dc0871e799109f0f824d38a3",
"WxOpenToken": "rzC0pRTuBznwd3",
"WxOpenEncodingAESKey": "Z9ifQKA8kvQjybOXuXl8I0r9cFHWJGwW2q5iE5e37AM",
//V3
"TenPayV3_MchId": "#{TenPayV3_MchId}#",
"TenPayV3_SubMchId": "#{TenPayV3_SubMchId}#", //
"TenPayV3_Key": "#{TenPayV3_Key}#",
"TenPayV3_AppId": "#{TenPayV3_AppId}#",
"TenPayV3_AppSecret": "#{TenPayV3_AppSecret}#",
"TenPayV3_TenpayNotify": "#{TenPayV3_TenpayNotify}#", //http://YourDomainName/TenpayV3/PayNotifyUrl
//TenPayV3_WxOpenTenpayNotify TenPayV3_TenpayNotify "WxOpen"
"TenPayV3_WxOpenTenpayNotify": "#{TenPayV3_WxOpenTenpayNotify}#" //http://YourDomainName/TenpayV3/PayNotifyUrlWxOpen
},
"LogConfig": {
/*
* https://nlog-project.org/config/
* use
private readonly ILogger<T> _logger;
constructor(ILogger<T> logger)
{
_logger = logger;
}
_logger.LogDebug(1, "调试");
private readonly ILogger _logger;
constructor()
{
_logger = LogManager.GetLogger("loggerName");
_logger = LogManager.GetCurrentClassLogger();
}
_logger.Error("错误");
*/
"nLog": {
"extensions": {
"NLog.Web.AspNetCore": {
"assembly": "NLog.Web.AspNetCore"
}
},
"targets": {
//
"debug": {
"type": "File",
"fileName": "../logs/debug-${shortdate}.log",
"layout": "${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}"
},
//
"warn": {
"type": "File",
"fileName": "../logs/warn-${shortdate}.log",
"layout": "${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}"
},
//
"error": {
"type": "File",
"fileName": "../logs/error-${shortdate}.log",
"layout": "${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}"
}
},
"rules": [
{
"logger": "*",
"minLevel": "Trace",
"maxlevel": "Debug",
"writeTo": "debug"
},
{
"logger": "*",
"minLevel": "Info",
"maxlevel": "Warn",
"writeTo": "warn"
},
{
"logger": "*",
"minLevel": "Error",
"maxlevel": "Fatal",
"writeTo": "error"
},
//
{
"logger": "Microsoft.*",
"maxLevel": "Info",
"final": "true"
}
]
}
},
"RabbitMQConfig": {
"Connection": "172.16.0.2",
"UserName": "root",
"Password": "znyc20219696",
"RetryCount": 3
},
"HangfireConfig": {
"Login": "root",
"Password": "5lh!#q6I"
}
}

295
src/Znyc.Recruitment.Api/configs/appconfig.Staging.json

@ -0,0 +1,295 @@
{
//Api
"urls": [ "http://*:80" ],
//
"corUrls": [ "http://*:9000" ],
//Swagger
"swagger": false,
//
"IdentityServer": {
//
"enable": false,
"url": ""
},
//
"aop": {
//
"transaction": true
},
//
"rateLimit": false,
"env": "p/s/d", //ocr
"BaiduConfig": {
"AppID": "23954973",
"ApiKey": "zCU8ZvomVm3upmIlI9kY8svK",
"SecretKey": "H4m3G8adKbRpIICyKtX8rqjHmjCugld9"
},
"RedisConfig": {
//
"connectionString": "10.0.8.16:46379,password=dfeFEgeGH/,defaultdatabase=0"
//"connectionString": "81.71.148.57:46379,password=dfeFEgeGH/,defaultdatabase=0"
//
//"connectionStringRateLimit": "49.234.103.173:46379,password=123456789,defaultdatabase=0"
//"connectionStringRateLimit": "81.71.15.59:46379,password=kl7$#DKbs4Gd,defaultdatabase=0"
},
"DbConfig": {
//
"monitorCommand": false,
//Curd
"curd": true,
// MySql = 0, SqlServer = 1, PostgreSQL = 2, Oracle = 3, Sqlite = 4, OdbcOracle = 5, OdbcSqlServer = 6, OdbcMySql = 7, OdbcPostgreSQL = 8, Odbc = 9, OdbcDameng = 10, MsAccess = 11
"type": 0,
//
"connectionString": "Server=10.0.8.16; Port=43306; Database=znyc_recruitment; Uid=znyc; Pwd=bIQISVSO; Charset=utf8mb4;SslMode=none;Max pool size=10",
//"connectionString": "Server=81.71.148.57; Port=43306; Database=znyc_recruitment; Uid=znyc; Pwd=bIQISVSO; Charset=utf8mb4",
//
"slaveConnectionStringList": [
//"Server=49.234.221.158; Port=43306; Database=znyc_test; Uid=znyc; Pwd=987654321;Charset=utf8mb4",
]
},
"JwtConfig": {
//
"issuer": "znyc",
//
"audience": "znyc",
//
"securityKey": "ertJKl#521*a@790asD&1#",
//() 2880 = 2
"expires": 2880,
//() 4320 = 3
"refreshExpires": 4320
},
"RateLimiting": {
/*
https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/IpRateLimitMiddleware
https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Using-Redis-as-a-distributed-counter-store
*/
"IpRateLimiting": {
"EnableEndpointRateLimiting": true,
"StackBlockedRequests": false,
"RealIpHeader": "X-Real-IP",
"ClientIdHeader": "X-ClientId",
"IpWhitelist": [], // "127.0.0.1"
"EndpointWhitelist": [ "get:/api/auth/refresh" ], // "get:/api/a", "*:/api/b"
"ClientWhitelist": [],
"HttpStatusCode": 429,
"QuotaExceededResponse": {
"Content": "{{\"code\":429,\"msg\":\"访问过于频繁!\"}}",
"ContentType": "application/json",
"StatusCode": 429
},
"GeneralRules": [
{
"Endpoint": "*",
"Period": "1s",
"Limit": 3
},
{
"Endpoint": "*",
"Period": "10m",
"Limit": 200
}
]
}
},
"SMSConfig": {
"SecretId": "AKIDGSN2VjJkZ7pIYzcdo0zjDCKCnQpEhXbW",
"SecretKey": "rQDI7fuoUyIEvLT5RWKqkUyGQJwBiU2P",
"SmsSdkAppid": "1400497500",
//
"Sign": "众能云车",
"Region": "ap-guangzhou",
//
"TemplateList": [
{
//
"ChangePhoneTemplateId": "900754",
//
"CertificationTemplateId": "925734"
}
]
},
"UploadConfig": {
//
"avatar": {
// D:/upload/admin/avatar
"uploadPath": "../upload/avatar",
//
"requestPath": "/upload/avatar",
//
"readPath": "https://znyc-rm-1306377152.cos.ap-guangzhou.myqcloud.com/",
// yyyy/MM/dd
"dateTimeFormat": "",
//{}
"format": "",
// 1M = 1 * 1024 * 1024
"maxSize": 1048576,
//-1
"limit": 1,
//
"contentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif" ]
},
//
"document": {
// D:/upload/admin/document
"uploadPath": "../upload/document",
//
"requestPath": "/images",
// yyyy/MM/dd
"dateTimeFormat": "",
//{}
"format": "",
// 1M = 1 * 1024 * 1024
"maxSize": 1048576,
//-1
"limit": -1,
//
"contentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif" ]
},
"secretId": "AKIDGSN2VjJkZ7pIYzcdo0zjDCKCnQpEhXbW",
"secretKey": "rQDI7fuoUyIEvLT5RWKqkUyGQJwBiU2P",
"bucket": "znyc-rm-1306377152",
"region": "ap-guangzhou"
},
"CosConfig": {
"secretId": "AKIDGMBk7D3cuvf8KFtGMBj00iALFsEJ7dsq",
"secretKey": "i9IBn8Bzav0pMcbJkunPjmY3HsCF2Zom",
"bucket": "znyc-images-1306377152",
"region": "ap-guangzhou",
"allowPrefix": "a.jpg",
"durationSeconds": 1800,
"allowActions": [
"name/cos:PutObject",
//
"name/cos:PostObject",
//
"name/cos:InitiateMultipartUpload",
"name/cos:ListMultipartUploads",
"name/cos:ListParts",
"name/cos:UploadPart",
"name/cos:CompleteMultipartUpload"
]
},
"WxConfig": {
//AppID(ID)
"AppId": "wx71f2b227f8eaf00a",
//AppSecret()
"AppSecret": "bf868056d4e58f4b2831ff74308120ac",
"EnvVersion": "trial",
//
"WxTemplateList": [
{
//
"CurrencyChangeTemplate": "6YXRyjN8An9fcxqsZeyEJLn_fp9fA-ic1eksWqnSu-s",
//
"ApprovalResultsTemplate": "dm1yuO5nVqiRQyMWcS4VZOjOZY5rDCjhiqiUcueyMJc",
//
"RecruitmentFoundTemplate": "KrAHbKwd4WOdVP8dj-qY4h7CpBgYZxDY7TLha5wSPBg",
//
"CallFeedbackTemplate": "4-TN3LtOf5cUq_xhHg4Aymq3_t2ywbt4nljwxGEqhBk"
}
],
//
"WeixinAppId": "wx78474b2ab9ac3e6c",
"WxOpenAppSecret": "a2349cf1dc0871e799109f0f824d38a3",
"WxOpenToken": "rzC0pRTuBznwd3",
"WxOpenEncodingAESKey": "Z9ifQKA8kvQjybOXuXl8I0r9cFHWJGwW2q5iE5e37AM",
//V3
"TenPayV3_MchId": "#{TenPayV3_MchId}#",
"TenPayV3_SubMchId": "#{TenPayV3_SubMchId}#", //
"TenPayV3_Key": "#{TenPayV3_Key}#",
"TenPayV3_AppId": "#{TenPayV3_AppId}#",
"TenPayV3_AppSecret": "#{TenPayV3_AppSecret}#",
"TenPayV3_TenpayNotify": "#{TenPayV3_TenpayNotify}#", //http://YourDomainName/TenpayV3/PayNotifyUrl
//TenPayV3_WxOpenTenpayNotify TenPayV3_TenpayNotify "WxOpen"
"TenPayV3_WxOpenTenpayNotify": "#{TenPayV3_WxOpenTenpayNotify}#" //http://YourDomainName/TenpayV3/PayNotifyUrlWxOpen
},
"LogConfig": {
/*
* https://nlog-project.org/config/
* use
private readonly ILogger<T> _logger;
constructor(ILogger<T> logger)
{
_logger = logger;
}
_logger.LogDebug(1, "调试");
private readonly ILogger _logger;
constructor()
{
_logger = LogManager.GetLogger("loggerName");
_logger = LogManager.GetCurrentClassLogger();
}
_logger.Error("错误");
*/
"nLog": {
"extensions": {
"NLog.Web.AspNetCore": {
"assembly": "NLog.Web.AspNetCore"
}
},
"targets": {
//
"debug": {
"type": "File",
"fileName": "../logs/debug-${shortdate}.log",
"layout": "${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}"
},
//
"warn": {
"type": "File",
"fileName": "../logs/warn-${shortdate}.log",
"layout": "${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}"
},
//
"error": {
"type": "File",
"fileName": "../logs/error-${shortdate}.log",
"layout": "${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}"
}
},
"rules": [
{
"logger": "*",
"minLevel": "Trace",
"maxlevel": "Debug",
"writeTo": "debug"
},
{
"logger": "*",
"minLevel": "Info",
"maxlevel": "Warn",
"writeTo": "warn"
},
{
"logger": "*",
"minLevel": "Error",
"maxlevel": "Fatal",
"writeTo": "error"
},
//
{
"logger": "Microsoft.*",
"maxLevel": "Info",
"final": "true"
}
]
}
},
"RabbitMQConfig": {
"Connection": "10.0.8.16",
"UserName": "znyc",
"Password": "znyc2021",
"RetryCount": 3
},
"HangfireConfig": {
"Login": "znyc",
"Password": "znyc2021"
}
}

30
src/Znyc.Recruitment.Api/nlog.Production.config

@ -0,0 +1,30 @@
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwExceptions="true" internalLogFile="internal-nlog.log" internalLogLevel="Debug">
<extensions>
<!--添加扩展Exceptionless​程序集-->
<add assembly="Exceptionless.NLog" />
</extensions>
<targets async="true">
<!--写入本地文件--><!--
<target name="File" xsi:type="File" fileName="${basedir}/logs/${shortdate}.log"
layout=" ${longdate}|${event-properties:item=EventId_Id:whenEmpty=0}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}| ${newline}">
</target>-->
<target xsi:type="Exceptionless" name="Exceptionless" apiKey="BlHOeuNyA1x7gFbgVflzkZKElQuK5GbGek0UgWp0"
serverUrl="http://1.14.140.50:5000">
</target>
<target xsi:type="File" name="debug" fileName="../logs/debug-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<target xsi:type="File" name="warn" fileName="../logs/warn-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<target xsi:type="File" name="error" fileName="../logs/error-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<target xsi:type="Console" name="console" layout="${message}" />
</targets>
<rules>
<!--本地文件-->
<!--<logger name="*" writeTo="File" />-->
<!--上报Exceptionless-->
<logger name='*' writeTo='Exceptionless' />
</rules>
</nlog>

30
src/Znyc.Recruitment.Api/nlog.config

@ -0,0 +1,30 @@
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwExceptions="true" internalLogFile="internal-nlog.log" internalLogLevel="Debug">
<extensions>
<!--添加扩展Exceptionless​程序集-->
<add assembly="Exceptionless.NLog" />
</extensions>
<targets async="true">
<!--写入本地文件-->
<target name="File" xsi:type="File" fileName="${basedir}/logs/${shortdate}.log"
layout=" ${longdate}|${event-properties:item=EventId_Id:whenEmpty=0}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}| ${newline}">
</target>
<target xsi:type="Exceptionless" name="Exceptionless" apiKey="JlefqejPIZfmMTXhOhJhjc4LzL4Xs5IIkyYfniMg"
serverUrl="http://81.71.148.57:5000">
</target>
<target xsi:type="File" name="debug" fileName="../logs/debug-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<target xsi:type="File" name="warn" fileName="../logs/warn-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<target xsi:type="File" name="error" fileName="../logs/error-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<target xsi:type="Console" name="console" layout="${message}" />
</targets>
<rules>
<!--本地文件-->
<logger name="*" writeTo="File" />
<!--上报Exceptionless-->
<logger name='*' writeTo='Exceptionless' />
</rules>
</nlog>

19
src/Znyc.Recruitment.Common/Attributes/MasterTableAttribute.cs

@ -0,0 +1,19 @@
using System;
using Znyc.Recruitment.Common.Const;
namespace Znyc.Recruitment.Common.Attributes
{
[AttributeUsage(AttributeTargets.Class)]
public class MasterTableAttribute : Attribute
{
public MasterTableAttribute(string name)
{
Name = DbConst.PrefixName + name;
}
/// <summary>
/// 重定义统一平台用户表名
/// </summary>
public string Name { get; }
}
}

12
src/Znyc.Recruitment.Common/Attributes/SingleInstanceAttribute.cs

@ -0,0 +1,12 @@
using System;
namespace Znyc.Recruitment.Common.Attributes
{
/// <summary>
/// 单例注入
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property)]
public class SingleInstanceAttribute : Attribute
{
}
}

9
src/Znyc.Recruitment.Common/Attributes/SnowflakeAttribute.cs

@ -0,0 +1,9 @@
using System;
namespace Znyc.Recruitment.Common.Attributes
{
[AttributeUsage(AttributeTargets.Property)]
public class SnowflakeAttribute : Attribute
{
}
}

23
src/Znyc.Recruitment.Common/Attributes/TransactionAttribute.cs

@ -0,0 +1,23 @@
using FreeSql;
using System;
using System.Data;
namespace Znyc.Recruitment.Common.Attributes
{
/// <summary>
/// 启用事物
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public class TransactionAttribute : Attribute
{
/// <summary>
/// 事务传播方式 REQUIRED
/// </summary>
public Propagation Propagation { get; set; }
/// <summary>
/// 事务隔离级别
/// </summary>
public IsolationLevel? IsolationLevel { get; set; }
}
}

48
src/Znyc.Recruitment.Common/Auth/ClaimAttributes.cs

@ -0,0 +1,48 @@
namespace Znyc.Recruitment.Common.Auth
{
/// <summary>
/// Claim属性
/// </summary>
public static class ClaimAttributes
{
/// <summary>
/// 用户Id
/// </summary>
public const string UserId = "id";
/// <summary>
/// 姓名
/// </summary>
public const string UserName = "nn";
/// <summary>
/// 刷新有效期
/// </summary>
public const string RefreshExpires = "re";
/// <summary>
/// 微信认证Id
/// </summary>
public const string OpenId = "oid";
/// <summary>
/// 权限id
/// </summary>
public const string RoleId = "rid";
/// <summary>
/// 开放平台Id(区分用户唯一性)
/// </summary>
public const string UnionId = "uid";
/// <summary>
/// 头像url
/// </summary>
public const string AvatarUrl = "avatarurl";
/// <summary>
/// SessionKey
/// </summary>
public const string SessionKey = "sessionKey";
}
}

46
src/Znyc.Recruitment.Common/Auth/IUser.cs

@ -0,0 +1,46 @@
namespace Znyc.Recruitment.Common.Auth
{
/// <summary>
/// 用户信息接口
/// </summary>
public interface IUser
{
/// <summary>
/// 主键
/// </summary>
long Id { get; }
/// <summary>
/// 权限Id
/// </summary>
string RoleId { get; }
/// <summary>
/// 昵称
/// </summary>
string UserName { get; }
/// <summary>
/// 微信唯一用户信息
/// </summary>
string OpenId { get; }
/// <summary>
/// 头像
/// </summary>
string AvatarUrl { get; }
/// <summary>
/// SessionKey
/// </summary>
string SessionKey { get; }
/// <summary>
/// UnionId
/// </summary>
string UnionId { get; }
}
}

11
src/Znyc.Recruitment.Common/Auth/IUserToken.cs

@ -0,0 +1,11 @@
using System.Security.Claims;
namespace Znyc.Recruitment.Common.Auth
{
public interface IUserToken
{
string Create(Claim[] claims);
Claim[] Decode(string jwtToken);
}
}

146
src/Znyc.Recruitment.Common/Auth/User.cs

@ -0,0 +1,146 @@
using Microsoft.AspNetCore.Http;
using Znyc.Recruitment.Common.Helpers;
namespace Znyc.Recruitment.Common.Auth
{
/// <summary>
/// 用户信息
/// </summary>
public class User : IUser
{
private readonly IHttpContextAccessor _accessor;
public User(IHttpContextAccessor accessor)
{
_accessor = accessor;
}
/// <summary>
/// 用户Id
/// </summary>
public virtual long Id
{
get
{
System.Security.Claims.Claim id = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.UserId);
if (id != null && id.Value.NotNull())
{
return id.Value.ToLong();
}
return 0;
}
}
/// <summary>
/// 权限Id
/// </summary>
public string RoleId
{
get
{
System.Security.Claims.Claim name = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.RoleId);
if (name != null && name.Value.NotNull())
{
return name.Value;
}
return "";
}
}
/// <summary>
/// 昵称
/// </summary>
public string UserName
{
get
{
System.Security.Claims.Claim name = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.UserName);
if (name != null && name.Value.NotNull())
{
return name.Value;
}
return "";
}
}
/// <summary>
/// OpenId
/// </summary>
public string OpenId
{
get
{
System.Security.Claims.Claim name = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.OpenId);
if (name != null && name.Value.NotNull())
{
return name.Value;
}
return "";
}
}
/// <summary>
/// UnionId
/// </summary>
public string UnionId
{
get
{
System.Security.Claims.Claim name = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.UnionId);
if (name != null && name.Value.NotNull())
{
return name.Value;
}
return "";
}
}
/// <summary>
/// AvatarUrl
/// </summary>
public string AvatarUrl
{
get
{
System.Security.Claims.Claim name = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.AvatarUrl);
if (name != null && name.Value.NotNull())
{
return name.Value;
}
return "";
}
}
/// <summary>
/// SessionKey
/// </summary>
public string SessionKey
{
get
{
System.Security.Claims.Claim name = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.SessionKey);
if (name != null && name.Value.NotNull())
{
return name.Value;
}
return "";
}
}
}
}

51
src/Znyc.Recruitment.Common/Auth/UserToken.cs

@ -0,0 +1,51 @@
using Microsoft.IdentityModel.Tokens;
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;
using Znyc.Recruitment.Common.Attributes;
using Znyc.Recruitment.Common.Configs;
using Znyc.Recruitment.Common.Extensions;
namespace Znyc.Recruitment.Common.Auth
{
[SingleInstance]
public class UserToken : IUserToken
{
//private readonly JwtConfig _jwtConfig;
private readonly AppConfig _appConfig;
public UserToken(AppConfig appConfig)
{
_appConfig = appConfig;
}
public string Create(Claim[] claims)
{
SymmetricSecurityKey key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_appConfig.JwtConfig.SecurityKey));
SigningCredentials signingCredentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
string timestamp = DateTime.Now.AddMinutes(_appConfig.JwtConfig.Expires + _appConfig.JwtConfig.RefreshExpires).ToTimestamp()
.ToString();
claims = claims.Append(new Claim(ClaimAttributes.RefreshExpires, timestamp)).ToArray();
JwtSecurityToken token = new JwtSecurityToken(
_appConfig.JwtConfig.Issuer,
_appConfig.JwtConfig.Audience,
claims,
DateTime.Now,
DateTime.Now.AddMinutes(_appConfig.JwtConfig.Expires),
signingCredentials
);
return new JwtSecurityTokenHandler().WriteToken(token);
}
public Claim[] Decode(string jwtToken)
{
JwtSecurityTokenHandler jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
JwtSecurityToken jwtSecurityToken = jwtSecurityTokenHandler.ReadJwtToken(jwtToken);
return jwtSecurityToken?.Claims?.ToArray();
}
}
}

25
src/Znyc.Recruitment.Common/BaseModel/Entity.cs

@ -0,0 +1,25 @@
using FreeSql.DataAnnotations;
using System.ComponentModel;
using Znyc.Recruitment.Common.Attributes;
namespace Znyc.Recruitment.Common.BaseModel
{
public interface IEntity
{
}
public class Entity<TKey> : IEntity
{
/// <summary>
/// 编号
/// </summary>
[Description("主键Id")]
[Snowflake]
[Column(Position = 1, IsIdentity = false, IsPrimary = true)]
public virtual TKey Id { get; set; }
}
public class Entity : Entity<long>
{
}
}

39
src/Znyc.Recruitment.Common/BaseModel/EntityAdd.cs

@ -0,0 +1,39 @@
using FreeSql.DataAnnotations;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Znyc.Recruitment.Common.BaseModel
{
/// <summary>
/// 实体创建审计
/// </summary>
public class EntityAdd<TKey> : Entity<TKey>, IEntityAdd<TKey> where TKey : struct
{
/// <summary>
/// 创建者
/// </summary>
[Description("创建者")]
[Column(Position = -2, CanUpdate = false)]
[MaxLength(50)]
public string CreatedUserName { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
[Description("创建者Id")]
[Column(Position = -3, CanUpdate = false)]
public TKey CreatedUserId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Description("创建时间")]
[Column(Position = -1, CanUpdate = false, ServerTime = DateTimeKind.Local)]
public DateTime CreatedTime { get; set; }
}
public class EntityAdd : EntityAdd<int>
{
}
}

55
src/Znyc.Recruitment.Common/BaseModel/EntityBase.cs

@ -0,0 +1,55 @@
using FreeSql.DataAnnotations;
using System;
using System.ComponentModel;
namespace Znyc.Recruitment.Common.BaseModel
{
/// <summary>
/// 实体审计
/// </summary>
public class EntityBase<TKey> : Entity<TKey>, IEntitySoftDelete, IEntityAdd<TKey>, IEntityUpdate<TKey>
where TKey : struct
{
/// <summary>
/// 创建者Id
/// </summary>
[Description("创建者Id")]
[Column(Position = -1, CanUpdate = false)]
public TKey CreatedUserId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Description("创建时间")]
[Column(Position = -2, CanUpdate = false, ServerTime = DateTimeKind.Local)]
public DateTime CreatedTime { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
[Description("修改者Id")]
[Column(Position = -3, CanInsert = false)]
public TKey ModifiedUserId { get; set; }
/// <summary>
/// 修改时间
/// </summary>
[Description("修改时间")]
[Column(Position = -4, CanInsert = false, ServerTime = DateTimeKind.Local)]
public DateTime ModifiedTime { get; set; }
/// <summary>
/// 是否删除
/// </summary>
[Description("是否删除")]
[Column(Position = -5)]
public bool IsDeleted { get; set; } = false;
}
public class EntityBase : EntityBase<long>
{
}
}

22
src/Znyc.Recruitment.Common/BaseModel/EntitySoftDelete.cs

@ -0,0 +1,22 @@
using FreeSql.DataAnnotations;
using System.ComponentModel;
namespace Znyc.Recruitment.Common.BaseModel
{
/// <summary>
/// 实体软删除
/// </summary>
public class EntitySoftDelete<TKey> : Entity<TKey>, IEntitySoftDelete
{
/// <summary>
/// 是否删除
/// </summary>
[Description("是否删除")]
[Column(Position = -1)]
public bool IsDeleted { get; set; } = false;
}
public class EntitySoftDelete : EntitySoftDelete<int>
{
}
}

39
src/Znyc.Recruitment.Common/BaseModel/EntityUpdate.cs

@ -0,0 +1,39 @@
using FreeSql.DataAnnotations;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Znyc.Recruitment.Common.BaseModel
{
/// <summary>
/// 实体修改审计
/// </summary>
public class EntityUpdate<TKey> : Entity<TKey>, IEntityUpdate<TKey> where TKey : struct
{
/// <summary>
/// 修改者
/// </summary>
[Description("修改者")]
[Column(Position = -2, CanInsert = false)]
[MaxLength(50)]
public string ModifiedUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
[Description("修改者Id")]
[Column(Position = -3, CanInsert = false)]
public TKey ModifiedUserId { get; set; }
/// <summary>
/// 修改时间
/// </summary>
[Description("修改时间")]
[Column(Position = -1, CanInsert = false, ServerTime = DateTimeKind.Local)]
public DateTime ModifiedTime { get; set; }
}
public class EntityUpdate : EntityUpdate<int>
{
}
}

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

Loading…
Cancel
Save