You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.2 KiB
C#
83 lines
2.2 KiB
C#
using Estsh.Core.IServices;
|
|
using Estsh.Core.Model.Result;
|
|
using Estsh.Core.Models;
|
|
using Estsh.Core.Services;
|
|
using Estsh.Core.Util;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
using System.Collections;
|
|
using System.Text.Json;
|
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
{
|
|
[Route("[controller]")]
|
|
[ApiController]
|
|
public class TestApiController : Controller
|
|
{
|
|
private IAccountService service;
|
|
private readonly IMemoryCache memoryCache;
|
|
|
|
public TestApiController(IAccountService _service, IMemoryCache _memoryCache)
|
|
{
|
|
this.service = _service;
|
|
this.memoryCache = _memoryCache;
|
|
}
|
|
[HttpGet("Index0")]
|
|
public IActionResult Index0(string a,string b)
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[HttpPost("Index1")]
|
|
public IActionResult Index1(string a, string b)
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
[HttpPost("Index2")]
|
|
public IActionResult Index2([FromForm] string a, [FromForm] string b, [FromForm] string c)
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[HttpPost("Index3")]
|
|
public IActionResult Index3(Pager pager)
|
|
{
|
|
LogHelper.Error("这是一个错误日志,程序执行异常了!!");
|
|
LogHelper.Info("这是一个信息日志,业务逻辑处理错误!!");
|
|
LogHelper.Warn("这是一个警告日志,程序执行警告信息!!");
|
|
LogHelper.Debug("这是一个调试日志,程序调试过程中出错!!");
|
|
|
|
return View();
|
|
}
|
|
|
|
[HttpPost("Index4")]
|
|
public IActionResult Index4(RequestBody requestBody)
|
|
{
|
|
throw new Exception();
|
|
return View();
|
|
}
|
|
|
|
[HttpPost("SetMemoryCache")]
|
|
public IActionResult SetMemoryCache()
|
|
{
|
|
SysEmp emp = new SysEmp();
|
|
emp.EmpId = 11;
|
|
emp.EmpNo = "admin";
|
|
emp.EmpName = "admin Name";
|
|
memoryCache.Set("user", emp);
|
|
return Json(emp);
|
|
}
|
|
|
|
[HttpPost("GetMemoryCache")]
|
|
public IActionResult GetMemoryCache()
|
|
{
|
|
SysEmp emp = (SysEmp) memoryCache.Get("user");
|
|
return Json(emp);
|
|
}
|
|
|
|
|
|
}
|
|
}
|