添加 dto
This commit is contained in:
parent
67e907e6c8
commit
cdf3fad718
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Milimoe.FunGame.Core.Api.Transmittal;
|
using Milimoe.FunGame.Core.Api.Transmittal;
|
||||||
|
using Milimoe.FunGame.WebAPI.Models;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.WebAPI.Controllers
|
namespace Milimoe.FunGame.WebAPI.Controllers
|
||||||
{
|
{
|
||||||
@ -12,8 +13,14 @@ namespace Milimoe.FunGame.WebAPI.Controllers
|
|||||||
public class APIController(SQLHelper sql, ILogger<APIController> logger) : ControllerBase
|
public class APIController(SQLHelper sql, ILogger<APIController> logger) : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpPost("scadd")]
|
[HttpPost("scadd")]
|
||||||
public string SCAdd(long uid, long group, double sc, int year = 0, int month = 0, string content = "")
|
public string SCAdd([FromBody] SCDTO dto)
|
||||||
{
|
{
|
||||||
|
long uid = dto.UID;
|
||||||
|
long group = dto.Group;
|
||||||
|
double sc = dto.SC;
|
||||||
|
int year = dto.Year;
|
||||||
|
int month = dto.Month;
|
||||||
|
string content = dto.Content;
|
||||||
string result = "";
|
string result = "";
|
||||||
if (year == 0) year = DateTime.Today.Year;
|
if (year == 0) year = DateTime.Today.Year;
|
||||||
if (month == 0) month = DateTime.Today.Month;
|
if (month == 0) month = DateTime.Today.Month;
|
||||||
|
|||||||
@ -29,7 +29,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Models\" />
|
|
||||||
<Folder Include="Services\" />
|
<Folder Include="Services\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
12
MilimoeWebAPI/Models/SCDTO.cs
Normal file
12
MilimoeWebAPI/Models/SCDTO.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace Milimoe.FunGame.WebAPI.Models
|
||||||
|
{
|
||||||
|
public class SCDTO
|
||||||
|
{
|
||||||
|
public long UID { get; set; }
|
||||||
|
public long Group { get; set; }
|
||||||
|
public double SC { get; set; }
|
||||||
|
public int Year { get; set; } = 0;
|
||||||
|
public int Month { get; set; } = 0;
|
||||||
|
public string Content { get; set; } = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user