Student.Core.API/Controllers/ConfigController.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Auth.Jwt;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Student.Core.API.Code.Attributes;
using Student.DTO;
using Student.IServices;
using yrjw.ORM.Chimp.Result;
namespace Student.Core.API.Controllers
{
[Description("配置信息")]
public class ConfigController : ControllerAbstract
{
private readonly Lazy<IConfigService> ConfigService;
public ConfigController(ILogger<ControllerAbstract> logger, Lazy<IConfigService> configService) : base(logger)
{
ConfigService = configService;
}
[Description("通过Code,返回当前配置信息")]
[OperationId("获取一条配置信息")]
[Parameters(name="code", param = "配置代码")]
[ResponseCache(Duration = 0)]
[AllowAnonymous]
[HttpGet("{code}")]
public async Task<IResultModel> Query([Required]string code)
{
_logger.LogDebug($"获取一条配置信息,Code:{code}");
return await ConfigService.Value.GetValue(code);
}
[Description("获取全部配置信息列表")]
[ResponseCache(Duration = 0)]
[HttpGet]
public async Task<IResultModel> GetListAll()
{
_logger.LogDebug($"获取全部配置信息列表");
return await ConfigService.Value.GetListAllAsync();
}
[Description("修改配置信息,成功后返回当前配置信息")]
[OperationId("修改配置信息")]
[HttpPut]
public async Task<IResultModel> Update([FromBody]ConfigDTO model)
{
_logger.LogDebug("修改配置信息");
return await ConfigService.Value.SetValue(model);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。