feat:第一次提交
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NapCatRobotClient.Service.Dispatcher.Service;
|
||||
|
||||
namespace NapCatRobotClient.API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class EntryController : ControllerBase
|
||||
{
|
||||
private readonly IDispatcherService _dispatcherService;
|
||||
|
||||
public EntryController(IDispatcherService dispatcherService)
|
||||
{
|
||||
_dispatcherService = dispatcherService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Post()
|
||||
{
|
||||
using StreamReader reader = new(Request.Body);
|
||||
string body = await reader.ReadToEndAsync();
|
||||
bool result = await _dispatcherService.ReceiveMessageAndProcess(body);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NapCatRobotClient.Service\NapCatRobotClient.Service.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
using Furion;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using NapCatRobotClient.Core.Helper;
|
||||
using System.Net;
|
||||
|
||||
namespace NapCatRobotClient.API
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args).Inject();
|
||||
builder.WebHost.UseUrls(App.Configuration["AppSettings:Urls"]);
|
||||
|
||||
builder.Services.AddRedis(App.Configuration["ConnectionStrings:Redis"]);
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseInject(string.Empty);
|
||||
|
||||
app.EnableBuffering();
|
||||
|
||||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||
{
|
||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto,
|
||||
KnownProxies = { IPAddress.Parse("127.0.0.1") }
|
||||
});
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:39930",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"NapCatRobotClient.API": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"AppSettings": {
|
||||
"Urls": "http://0.0.0.0:5000"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Redis": "127.0.0.1:6379,defaultDatabase=0,max pool size=50,tryit=0"
|
||||
},
|
||||
"QQConfig": {
|
||||
"SendApiUrl": "http://192.168.142.133:3000",
|
||||
"AccessToken": "123456",
|
||||
"RobotQQ": "3902582794",
|
||||
"XiuXianGroupId": "705807264"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user