1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using Attribute;
- using Base;
- using Common;
- using Dto;
- using Enums;
- using Filters;
- using Infrastructure;
- using Infrastructure.Model;
- using Mapster;
- using Microsoft.AspNetCore.Mvc;
- using Middleware;
- using Model;
- using Model.Base;
- using Services;
- using Util;
- namespace Controllers
- {
- /// <summary>
- /// 主界面Controller
- /// </summary>
-
- [Route("/")]
- public class HomeController : BaseController
- {
- private readonly ISysPermissionService permissionService;
- public HomeController(ISysPermissionService permissionService)
- {
- this.permissionService = permissionService;
- }
- [HttpPost("testlogin")]
- public IActionResult Login([FromBody] LoginDto parm)
- {
- TokenModel loginUser = new(new TokenModel()
- {
- username = parm.AdminName,
- userId = 1
- }, new List<Roles>());
- List<string> permissions = permissionService.List();
- CacheService.SetUserPerms(GlobalConstant.UserPermKEY + "1", permissions);
- return SUCCESS(JwtUtil.GenerateJwtToken(JwtUtil.AddClaims(loginUser)));
- }
- [HttpGet(template: "test")]
- public IActionResult Test([FromQuery] LoginDto parm)
- {
- TokenModel loginUser = new(new TokenModel()
- {
- username = parm.AdminName,
- userId = 1
- }, new List<Roles>());
- List<string> permissions = permissionService.List();
- CacheService.SetUserPerms(GlobalConstant.UserPermKEY + "1", permissions);
- return SUCCESS(JwtUtil.GenerateJwtToken(JwtUtil.AddClaims(loginUser)));
- }
- // [HttpGet(template: "test1")]
- // public IActionResult Test1()
- // {
- // List<TestVo> list = new List<TestVo>();
- // list.Add(new TestVo());
- // list.Add(new TestVo(){
- // Subs = new TestSubVo()
- // });
- // return SUCCESS(list);
- // }
- }
- }
|