General.Web/Controllers/Admin/TemplateController.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using General.Core.Config;
using General.Entities.Data;
using General.Framework;
using General.Mvc.Filters;
using General.Services.Template;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace General.Mvc.Controllers.Admin
{
[Route("api/admin/[controller]/[action]")]
[ApiController]
[ServiceFilter(typeof(ResponseLogTimeFilter))]
public class TemplateController : Controller
{
private readonly ITemplateService templateService;
private readonly IMemoryCache memoryCache;
public TemplateController(ITemplateService templateService,
IMemoryCache memoryCache)
{
this.templateService = templateService;
this.memoryCache = memoryCache;
}
/// <summary>
/// 获取所有模板页面
/// </summary>
[HttpGet]
[ServiceFilter(typeof(AdminCheckFilter))]
public async Task<IActionResult> GetTemplatePages()
{
return Content(JsonHelper.Serialize(templateService.GetTemplatePages()));
}
/// <summary>
/// 设置模板
/// </summary>
/// <returns></returns>
[HttpPost]
[ServiceFilter(typeof(AdminCheckFilter))]
public async Task<IActionResult> SetTemplateName([FromForm]string templateSelect)
{
var res = await templateService.SetTemplateName(templateSelect);
if (res > 0)
{
return Content(JsonHelper.Serialize(new AjaxResult() { code = AjaxResultStateEnum.Ok, message = "修改成功!" }));
}
else
{
后面还有 61 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
