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
{
///
/// SysDeptController
///
[Route("api/[controller]/[action]")]
[ApiController]
public class CommonController : BaseApiUserController
{
///
/// _SysDeptService
///
private readonly ISysDeptService _SysDeptService;
private readonly ILogger _logger;
readonly ICaching caching;
///
/// 构造方法
///
///
///
///
///
public CommonController(ISysDeptService SysDeptService, ILogger logger, ICaching caching, ISysUserService sysUserService) : base(sysUserService)
{
_sysUserService = sysUserService;
_SysDeptService = SysDeptService;
_logger = logger;
this.caching = caching;
}
///
/// 上传文件
///
///
[HttpPost]
public async Task> Upload()
{
//获取Form提交的文件
var files = Request.Form.Files;
return await FileHelper.FileSaveByBlob(files);
}
///
/// 测试1
///
///
///
[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";
}
///
/// 测试2
///
///
///
[HttpGet]
public string GetValue(string id)
{
var aa = CookieHelper.GetCookies(HttpContext, "k1");
return HttpContext.Session.GetString("code") + HttpContext.Session.GetString("code1");
}
}
}