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.
88 lines
2.6 KiB
C#
88 lines
2.6 KiB
C#
using Admin.Core.Model;
|
|
using Admin.Core.Common.Resource;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Linq.Expressions;
|
|
using Admin.Core.Common;
|
|
using Microsoft.Extensions.Logging;
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
using Microsoft.AspNetCore.Http;
|
|
using System.Threading.Tasks;
|
|
using Admin.Core.IService.ISys;
|
|
|
|
namespace Admin.Core.Api
|
|
{
|
|
/// <summary>
|
|
/// SysDeptController
|
|
/// </summary>
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class CommonController : BaseApiUserController
|
|
{
|
|
|
|
/// <summary>
|
|
/// _SysDeptService
|
|
/// </summary>
|
|
private readonly ISysDeptService _SysDeptService;
|
|
private readonly ILogger<CommonController> _logger;
|
|
readonly ICaching caching;
|
|
|
|
/// <summary>
|
|
/// 构造方法
|
|
/// </summary>
|
|
/// <param name="SysDeptService"></param>
|
|
/// <param name="logger"></param>
|
|
/// <param name="caching"></param>
|
|
/// <param name="sysUserService"></param>
|
|
public CommonController(ISysDeptService SysDeptService, ILogger<CommonController> logger, ICaching caching, ISysUserService sysUserService) : base(sysUserService)
|
|
{
|
|
_sysUserService = sysUserService;
|
|
_SysDeptService = SysDeptService;
|
|
_logger = logger;
|
|
this.caching = caching;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传文件
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<MessageModel<string>> Upload()
|
|
{
|
|
//获取Form提交的文件
|
|
var files = Request.Form.Files;
|
|
|
|
return await FileHelper.FileSaveByBlob(files);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 测试1
|
|
/// </summary>
|
|
/// <param name="str"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public string Get(string str)
|
|
{
|
|
HttpContext.Session.SetString("code", str);
|
|
HttpContext.Session.SetString("code1", str);
|
|
HttpContext.Response.Cookies.Append("k1", "str");
|
|
CookieHelper.SetCookies(HttpContext, "k1", "jojo");
|
|
|
|
return "value";
|
|
}
|
|
|
|
/// <summary>
|
|
/// 测试2
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public string GetValue(string id)
|
|
{
|
|
var aa = CookieHelper.GetCookies(HttpContext, "k1");
|
|
return HttpContext.Session.GetString("code") + HttpContext.Session.GetString("code1");
|
|
}
|
|
}
|
|
}
|