提交.Net6版本
@@ -0,0 +1,222 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common;
|
||||
using Yi.Framework.Common.Const;
|
||||
using Yi.Framework.Common.Helper;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.Common.QueueModel;
|
||||
using Yi.Framework.Core;
|
||||
using Yi.Framework.DTOModel;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.WebCore;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class AccountController : Controller
|
||||
{
|
||||
private readonly ILogger<UserController> _logger;
|
||||
|
||||
private IUserService _userService;
|
||||
private IMenuService _menuService;
|
||||
private RabbitMQInvoker _rabbitMQInvoker;
|
||||
private CacheClientDB _cacheClientDB;
|
||||
private IRoleService _roleService;
|
||||
private IHttpContextAccessor _httpContext;
|
||||
public AccountController(ILogger<UserController> logger, IUserService userService, IMenuService menuService,RabbitMQInvoker rabbitMQInvoker,CacheClientDB cacheClientDB, IRoleService roleService, IHttpContextAccessor httpContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_userService = userService;
|
||||
_menuService = menuService;
|
||||
_rabbitMQInvoker = rabbitMQInvoker;
|
||||
_cacheClientDB = cacheClientDB;
|
||||
_roleService = roleService;
|
||||
_httpContext = httpContext;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 登录方法,要返回data:{user,token} token
|
||||
/// </summary>
|
||||
/// <param name="_user"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> Login(user _user)
|
||||
{
|
||||
var user_data = await _userService.Login(_user);
|
||||
if (user_data == null)
|
||||
{
|
||||
return Result.Error("该用户不存在");
|
||||
}
|
||||
var menuList = await _menuService.GetTopMenuByUserId(user_data.id);
|
||||
if ( user_data!=null)
|
||||
{
|
||||
var token = MakeJwt.app(new jwtUser() {user=user_data,menuIds= menuList});
|
||||
|
||||
JobModel.visitNum += 1;
|
||||
return Result.Success().SetData(new { user = new { user_data.id, user_data.username, user_data.introduction, user_data.icon, user_data.nick }, token });
|
||||
}
|
||||
return Result.Error();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不用写,单纯制作日志
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Result Logout()
|
||||
{
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// code为验证码,从redis中判断一下code是否正确
|
||||
/// </summary>
|
||||
/// <param name="_user"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> Register(user _user, string code)
|
||||
{
|
||||
_user.username=_user.username.Trim();
|
||||
if(string.IsNullOrEmpty(_user.username))
|
||||
code = code.Trim();
|
||||
|
||||
string trueCode= _cacheClientDB.Get<string>(RedisConst.keyCode + _user.phone);
|
||||
if (code == trueCode)
|
||||
{
|
||||
//设置默认头像
|
||||
var setting = JsonHelper.StrToObj<SettingDto>(_cacheClientDB.Get<string>(RedisConst.key));
|
||||
_user.icon = setting.InitIcon;
|
||||
_user.ip = _httpContext.HttpContext.Request.Headers["X-Real-IP"].FirstOrDefault();//通过上下文获取ip
|
||||
//设置默认角色
|
||||
if (string.IsNullOrEmpty(setting.InitRole))
|
||||
{
|
||||
return Result.Error("无默认角色,请初始化数据库");
|
||||
}
|
||||
_user.roles = new List<role>();
|
||||
_user.roles.Add(await _roleService.GetEntity(u => u.role_name == setting.InitRole));
|
||||
await _userService.Register(_user);
|
||||
|
||||
return Result.Success("恭喜,你已加入我们!");
|
||||
}
|
||||
return Result.Error("验证码有误,请重新输入!");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送短信,需要将生成的sms+code存入redis
|
||||
/// </summary>
|
||||
/// <param name="SMSAddress"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> SendSMS(string SMSAddress)
|
||||
{
|
||||
if (string.IsNullOrEmpty(SMSAddress))
|
||||
{
|
||||
return Result.Error("请输入电话号码");
|
||||
}
|
||||
SMSAddress = SMSAddress.Trim();
|
||||
if (!await _userService.PhoneIsExsit(SMSAddress))
|
||||
{
|
||||
SMSQueueModel sMSQueueModel = new SMSQueueModel();
|
||||
sMSQueueModel.phone = SMSAddress;
|
||||
sMSQueueModel.code =RandomHelper.GenerateCheckCodeNum(6);
|
||||
|
||||
//10分钟过期
|
||||
_cacheClientDB.Set(RedisConst.keyCode+sMSQueueModel.phone, sMSQueueModel.code, TimeSpan.FromMinutes(10));
|
||||
|
||||
_rabbitMQInvoker.Send(new Common.IOCOptions.RabbitMQConsumerModel() { ExchangeName = RabbitConst.SMS_Exchange, QueueName = RabbitConst.SMS_Queue_Send }, JsonHelper.ObjToStr(sMSQueueModel));
|
||||
return Result.Success("发送短信成功,10分钟后过期,请留意短信接收");
|
||||
}
|
||||
return Result.Error("该号码已被注册");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送邮箱,需要先到数据库判断该邮箱是否被人注册过,到userservice写mail_exist方法,还有接口别忘了。
|
||||
/// </summary>
|
||||
/// <param name="emailAddress"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]//邮箱验证
|
||||
public async Task<Result> Email(string emailAddress)
|
||||
{
|
||||
emailAddress = emailAddress.Trim().ToLower();
|
||||
//先判断邮箱是否被注册使用过,如果被使用过,便不让操作
|
||||
if (!await _userService.EmailIsExsit(emailAddress))
|
||||
{
|
||||
string code = RandomHelper.GenerateRandomLetter(6);
|
||||
code = code.ToUpper();//全部转为大写
|
||||
EmailHelper.sendMail(code, emailAddress);
|
||||
|
||||
//我要把邮箱和对应的code加进到数据库,还有申请时间
|
||||
//设置10分钟过期
|
||||
//set不存在便添加,如果存在便替换
|
||||
//CacheHelper.SetCache<string>(emailAddress, code, TimeSpan.FromSeconds(10));
|
||||
|
||||
return Result.Success("发送邮件成功,请查看邮箱(可能在垃圾箱)");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Result.Error("该邮箱已被注册");
|
||||
}
|
||||
// 邮箱和验证码都要被记住,然后注册时候比对邮箱和验证码是不是都和现在生成的一样
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改密码
|
||||
/// </summary>
|
||||
/// <param name="pwdDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[Authorize]
|
||||
public async Task<Result> ChangePassword(ChangePwdDto pwdDto)
|
||||
{
|
||||
var user_data = await _userService.GetUserById(pwdDto.user.id);
|
||||
string msg = "修改成功";
|
||||
if (! string.IsNullOrEmpty( pwdDto.newPassword))
|
||||
{
|
||||
if (user_data.password == pwdDto.user.password)
|
||||
{
|
||||
|
||||
user_data.password = pwdDto.newPassword;
|
||||
user_data.phone = pwdDto.user.phone;
|
||||
user_data.introduction = pwdDto.user.introduction;
|
||||
user_data.email = pwdDto.user.email;
|
||||
user_data.age = pwdDto.user.age;
|
||||
user_data.address = pwdDto.user.address;
|
||||
user_data.nick = pwdDto.user.nick;
|
||||
|
||||
|
||||
await _userService.UpdateAsync(user_data);
|
||||
user_data.password = null;
|
||||
return Result.Success(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "密码错误";
|
||||
return Result.Error(msg);
|
||||
}
|
||||
}
|
||||
|
||||
user_data.phone = pwdDto.user.phone;
|
||||
user_data.introduction = pwdDto.user.introduction;
|
||||
user_data.email = pwdDto.user.email;
|
||||
user_data.age = pwdDto.user.age;
|
||||
user_data.address = pwdDto.user.address;
|
||||
user_data.nick = pwdDto.user.nick;
|
||||
|
||||
await _userService.UpdateAsync(user_data);
|
||||
|
||||
|
||||
return Result.Success(msg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.WebCore;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class FileController : ControllerBase
|
||||
{
|
||||
private IUserService _userService;
|
||||
private readonly IHostEnvironment _env;
|
||||
public FileController(IUserService userService, IHostEnvironment env)
|
||||
{
|
||||
_userService = userService;
|
||||
_env = env;
|
||||
}
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<Result> EditIcon(IFormFile file)
|
||||
{
|
||||
try
|
||||
{
|
||||
var _user = HttpContext.GetCurrentUserInfo();
|
||||
var user_data = await _userService.GetUserById(_user.id);
|
||||
var type = "image";
|
||||
var filename = await Upload(type, file);
|
||||
user_data.icon = filename;
|
||||
await _userService.UpdateAsync(user_data);
|
||||
return Result.Success();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Result.Error();
|
||||
}
|
||||
}
|
||||
|
||||
[Route("/api/{type}/{fileName}")]
|
||||
[HttpGet]
|
||||
public IActionResult Get(string type, string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = Path.Combine($"wwwroot/{type}", fileName);
|
||||
var stream = System.IO.File.OpenRead(path);
|
||||
var MimeType = Common.Helper.MimeHelper.GetMimeMapping(fileName);
|
||||
return new FileStreamResult(stream, MimeType);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new NotFoundResult();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 该方法不对外暴露
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<string> Upload(string type, IFormFile file)
|
||||
{
|
||||
string filename = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName);
|
||||
using (var stream = new FileStream(Path.Combine($"wwwroot/{type}", filename), FileMode.CreateNew, FileAccess.Write))
|
||||
{
|
||||
await file.CopyToAsync(stream);
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> ExportFile()
|
||||
{
|
||||
var userdata = await _userService.GetAllEntitiesTrueAsync();
|
||||
var userList = userdata.ToList();
|
||||
List<string> header = new() { "用户", "密码", "头像", "昵称", "邮箱", "ip", "年龄", "个人介绍", "地址", "手机", "角色" };
|
||||
var filename = Common.Helper.ExcelHelper.CreateExcelFromList(userList, header, _env.ContentRootPath.ToString());
|
||||
var MimeType = Common.Helper.MimeHelper.GetMimeMapping(filename);
|
||||
return new FileStreamResult(new FileStream(Path.Combine(_env.ContentRootPath+@"/wwwroot/Excel", filename), FileMode.Open),MimeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common;
|
||||
using Yi.Framework.Common.Const;
|
||||
using Yi.Framework.Common.Helper;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.Core;
|
||||
using Yi.Framework.DTOModel;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class JobController : Controller
|
||||
{
|
||||
private readonly ILogger<JobController> _logger;
|
||||
private QuartzInvoker _quartzInvoker;
|
||||
public JobController(ILogger<JobController> logger,QuartzInvoker quartzInvoker)
|
||||
{
|
||||
_logger = logger;
|
||||
_quartzInvoker = quartzInvoker;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> startJob()
|
||||
{
|
||||
//任务1
|
||||
//await _quartzInvoker.start("*/1 * * * * ? ", new Quartz.JobKey("test", "my"), "VisitJob");
|
||||
|
||||
//任务2
|
||||
Dictionary<string, object> data = new Dictionary<string, object>()
|
||||
{
|
||||
{JobConst.method,"get" },
|
||||
{JobConst.url,"https://www.baidu.com" }
|
||||
};
|
||||
await _quartzInvoker.start("*/1 * * * * ? ", new Quartz.JobKey("test", "my"), "HttpJob",data: data);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> getRunJobList()
|
||||
{
|
||||
return Result.Success().SetData(await _quartzInvoker.getRunJobList());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Result getJobClass()
|
||||
{
|
||||
return Result.Success().SetData(_quartzInvoker.getJobClassList());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<Result> stopJob()
|
||||
{
|
||||
await _quartzInvoker.Stop(new Quartz.JobKey("test", "my"));
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public async Task<Result> DeleteJob()
|
||||
{
|
||||
await _quartzInvoker.Delete(new Quartz.JobKey("test", "my"));
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<Result> ResumeJob()
|
||||
{
|
||||
await _quartzInvoker.Resume(new Quartz.JobKey("test", "my"));
|
||||
return Result.Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DTOModel;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.WebCore;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class MenuController : ControllerBase
|
||||
{
|
||||
private IMenuService _menuService;
|
||||
public MenuController(IMenuService menuService)
|
||||
{
|
||||
_menuService = menuService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 这个是要递归的,但是要过滤掉删除的,所以,可以写一个通用过滤掉删除的方法
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetMenuInMould()
|
||||
{
|
||||
return Result.Success().SetData(await _menuService.GetMenuInMould());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更
|
||||
/// </summary>
|
||||
/// <param name="_menu"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<Result> UpdateMenu(menu _menu)
|
||||
{
|
||||
await _menuService.UpdateAsync(_menu);
|
||||
return Result.Success();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删
|
||||
/// </summary>
|
||||
/// <param name="_ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public async Task<Result> DelListMenu(List<int> _ids)
|
||||
{
|
||||
await _menuService.DelListByUpdateAsync(_ids);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增
|
||||
/// 现在,top菜单只允许为一个
|
||||
/// </summary>
|
||||
/// <param name="_menu"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> AddTopMenu(menu _menu)
|
||||
{
|
||||
await _menuService.AddTopMenu(_menu);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给一个菜单设置一个接口,Id1为菜单id,Id2为接口id
|
||||
/// 用于给菜单设置接口
|
||||
/// </summary>
|
||||
/// <param name="idDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> SetMouldByMenu(IdDto<int> idDto)
|
||||
{
|
||||
await _menuService.SetMouldByMenu(idDto.id1, idDto.id2);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 给一个菜单添加子节点(注意:添加,不是覆盖)
|
||||
/// </summary>
|
||||
/// <param name="childrenDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> AddChildrenMenu(ChildrenDto<menu> childrenDto)
|
||||
{
|
||||
await _menuService.AddChildrenMenu(childrenDto.parentId, childrenDto.data);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户的目录菜单,不包含接口
|
||||
/// 用于账户信息页面,显示这个用户有哪些菜单,需要并列
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetTopMenusByHttpUser()
|
||||
{
|
||||
HttpContext.GetCurrentUserInfo(out List<int> menuIds);
|
||||
|
||||
return Result.Success().SetData(await _menuService.GetTopMenusByTopMenuIds(menuIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class MouldController : ControllerBase
|
||||
{
|
||||
private IMouldService _mouldService;
|
||||
public MouldController(IMouldService mouldService)
|
||||
{
|
||||
_mouldService = mouldService;
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<Result> GetMould()
|
||||
{
|
||||
return Result.Success().SetData(await _mouldService.GetAllEntitiesTrueAsync());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更
|
||||
/// </summary>
|
||||
/// <param name="_mould"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<Result> UpdateMould(mould _mould)
|
||||
{
|
||||
await _mouldService.UpdateAsync(_mould);
|
||||
return Result.Success();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删
|
||||
/// </summary>
|
||||
/// <param name="_ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public async Task<Result> DelListMould(List<int> _ids)
|
||||
{
|
||||
await _mouldService.DelListByUpdateAsync(_ids);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增
|
||||
/// </summary>
|
||||
/// <param name="_mould"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> AddMould(mould _mould)
|
||||
{
|
||||
await _mouldService.AddAsync(_mould);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DTOModel;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.WebCore;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class RoleController : ControllerBase
|
||||
{
|
||||
private IRoleService _roleService;
|
||||
public RoleController(IRoleService roleService)
|
||||
{
|
||||
_roleService = roleService;
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<Result> GetRole()
|
||||
{
|
||||
return Result.Success().SetData(await _roleService.GetAllEntitiesTrueAsync());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更
|
||||
/// </summary>
|
||||
/// <param name="_role"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<Result> UpdateRole(role _role)
|
||||
{
|
||||
await _roleService.UpdateAsync(_role);
|
||||
return Result.Success();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删
|
||||
/// </summary>
|
||||
/// <param name="_ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public async Task<Result> DelListRole(List<int> _ids)
|
||||
{
|
||||
await _roleService.DelListByUpdateAsync(_ids);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增
|
||||
/// </summary>
|
||||
/// <param name="_role"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> AddRole(role _role)
|
||||
{
|
||||
await _roleService.AddAsync(_role);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据用户id得到该用户有哪些角色
|
||||
/// 用于显示用户详情中的角色说明
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetRolesByUserId(int userId)
|
||||
{
|
||||
|
||||
return Result.Success().SetData(await _roleService.GetRolesByUserId(userId));
|
||||
}
|
||||
/// <summary>
|
||||
/// 给角色设置菜单,多个角色与多个菜单,让每一个角色都设置,ids1为角色,ids2为菜单
|
||||
/// 用于设置角色
|
||||
/// </summary>
|
||||
/// <param name="idsListDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> SetMenuByRole(IdsListDto<int> idsListDto)
|
||||
{
|
||||
await _roleService.SetMenusByRolesId(idsListDto.ids2, idsListDto.ids1);
|
||||
return Result.Success();
|
||||
}
|
||||
/// <summary>
|
||||
/// 用于给角色设置菜单的时候,点击一个角色,显示这个角色拥有的并列的菜单
|
||||
/// </summary>
|
||||
/// <param name="roleId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetTopMenusByRoleId(int roleId)
|
||||
{
|
||||
|
||||
return Result.Success().SetData(await _roleService.GetTopMenusByRoleId(roleId) ); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Const;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.Core;
|
||||
using Yi.Framework.DTOModel;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.WebCore;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[Authorize]
|
||||
public class SettingController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<SettingController> _logger;
|
||||
private readonly CacheClientDB _cacheClientDB;
|
||||
|
||||
public SettingController(ILogger<SettingController> logger, CacheClientDB cacheClientDB)
|
||||
{
|
||||
_logger = logger;
|
||||
_cacheClientDB = cacheClientDB;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Result GetSetting()
|
||||
{
|
||||
var setDto = Common.Helper.JsonHelper.StrToObj<SettingDto>(_cacheClientDB.Get<string>(RedisConst.key));
|
||||
return Result.Success().SetData( setDto);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更
|
||||
/// </summary>
|
||||
/// <param name="settingDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public Result UpdateSetting(SettingDto settingDto)
|
||||
{
|
||||
var setDto = Common.Helper.JsonHelper.ObjToStr(settingDto);
|
||||
|
||||
_cacheClientDB.Set(RedisConst.key, setDto);
|
||||
return Result.Success();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DTOModel;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.WebCore;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[Authorize]
|
||||
public class UserController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<UserController> _logger;
|
||||
|
||||
private IUserService _userService;
|
||||
public UserController(ILogger<UserController> logger, IUserService userService)
|
||||
{
|
||||
_logger = logger;
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetUser()
|
||||
{
|
||||
return Result.Success().SetData(await _userService.GetAllEntitiesTrueAsync());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更
|
||||
/// </summary>
|
||||
/// <param name="_user"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<Result> UpdateUser(user _user)
|
||||
{
|
||||
await _userService.UpdateAsync(_user);
|
||||
return Result.Success();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删
|
||||
/// </summary>
|
||||
/// <param name="_ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public async Task<Result> DelListUser(List<int> _ids)
|
||||
{
|
||||
await _userService.DelListByUpdateAsync(_ids);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增
|
||||
/// </summary>
|
||||
/// <param name="_user"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> AddUser(user _user)
|
||||
{
|
||||
await _userService.AddAsync(_user);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SetRoleByUser
|
||||
/// 给多个用户设置多个角色,ids有用户id与 角色列表ids,多对多,ids1用户,ids2为角色
|
||||
/// 用户设置给用户设置角色
|
||||
/// </summary>
|
||||
/// <param name="idsListDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> SetRoleByUser(IdsListDto<int> idsListDto)
|
||||
{
|
||||
await _userService.SetRoleByUser(idsListDto.ids2, idsListDto.ids1);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据http上下文的用户得到该用户信息,关联角色
|
||||
/// 用于显示账号信息页中的用户信息和角色信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetUserInRolesByHttpUser()
|
||||
{
|
||||
var _user = HttpContext.GetCurrentUserInfo();
|
||||
return Result.Success().SetData( await _userService.GetUserInRolesByHttpUser(_user.id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到登录用户的递归菜单,放到导航栏
|
||||
/// 用户放到导航栏中
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetMenuByHttpUser()
|
||||
{
|
||||
HttpContext.GetCurrentUserInfo(out var allMenuIds);
|
||||
return Result.Success().SetData(await _userService.GetMenuByHttpUser(allMenuIds));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到请求模型
|
||||
/// </summary>
|
||||
/// <param name="router"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetAxiosByRouter(string router)
|
||||
{
|
||||
|
||||
var _user = HttpContext.GetCurrentUserInfo(out List<int> menuIds);
|
||||
if (menuIds == null)
|
||||
{
|
||||
return Result.Error();
|
||||
}
|
||||
var menuList= await _userService.GetAxiosByRouter(router, _user.id, menuIds);
|
||||
AxiosUrlsModel urlsModel = new();
|
||||
menuList.ForEach(u =>
|
||||
{
|
||||
switch (u.menu_name)
|
||||
{
|
||||
case "get":urlsModel.get = u.mould.url;break;
|
||||
case "del": urlsModel.del = u.mould.url; break;
|
||||
case "add": urlsModel.add = u.mould.url; break;
|
||||
case "update": urlsModel.update = u.mould.url; break;
|
||||
}
|
||||
});
|
||||
|
||||
return Result.Success().SetData(urlsModel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<log4net>
|
||||
<!-- 将日志以回滚文件的形式写到文件中 -->
|
||||
<!-- 按日期切分日志文件,并将日期作为日志文件的名字 -->
|
||||
<!--Error-->
|
||||
<appender name="ErrorLog" type="log4net.Appender.RollingFileAppender">
|
||||
<!--不加utf-8编码格式,中文字符将显示成乱码-->
|
||||
<param name="Encoding" value="utf-8" />
|
||||
<file value="log/"/>
|
||||
<appendToFile value="true" />
|
||||
<rollingStyle value="Date" />
|
||||
<!--日期的格式,每天换一个文件记录,如不设置则永远只记录一天的日志,需设置-->
|
||||
<datePattern value=""GlobalExceptionLogs_"yyyyMMdd".log"" />
|
||||
<!--日志文件名是否为静态-->
|
||||
<StaticLogFileName value="false"/>
|
||||
<!--多线程时采用最小锁定-->
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
|
||||
<!--布局(向用户显示最后经过格式化的输出信息)-->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date| %-5level %newline%message%newline--------------------------------%newline" />
|
||||
</layout>
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<levelMin value="ERROR" />
|
||||
<levelMax value="FATAL" />
|
||||
</filter>
|
||||
</appender>
|
||||
<!--Error-->
|
||||
|
||||
|
||||
|
||||
<!--Info-->
|
||||
<appender name="InfoLog" type="log4net.Appender.RollingFileAppender">
|
||||
<!--不加utf-8编码格式,中文字符将显示成乱码-->
|
||||
<param name="Encoding" value="utf-8" />
|
||||
<!--定义文件存放位置-->
|
||||
<file value="log/"/>
|
||||
<appendToFile value="true" />
|
||||
<rollingStyle value="Date" />
|
||||
<!--日志文件名是否为静态-->
|
||||
<StaticLogFileName value="false"/>
|
||||
<!--日期的格式,每天换一个文件记录,如不设置则永远只记录一天的日志,需设置-->
|
||||
<datePattern value=""GlobalInfoLogs_"yyyyMMdd".log"" />
|
||||
<!--多线程时采用最小锁定-->
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
|
||||
<!--布局(向用户显示最后经过格式化的输出信息)-->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date| %-5level%c %newline%message%newline--------------------------------%newline" />
|
||||
</layout>
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<levelMin value="DEBUG" />
|
||||
<levelMax value="WARN" />
|
||||
</filter>
|
||||
</appender>
|
||||
<!--Info-->
|
||||
|
||||
<root>
|
||||
<!-- 控制级别,由低到高:ALL|DEBUG|INFO|WARN|ERROR|FATAL|OFF -->
|
||||
<!-- 比如定义级别为INFO,则INFO级别向下的级别,比如DEBUG日志将不会被记录 -->
|
||||
<!-- 如果没有定义LEVEL的值,则缺省为DEBUG -->
|
||||
<level value="ALL" />
|
||||
<!-- 按日期切分日志文件,并将日期作为日志文件的名字 -->
|
||||
<appender-ref ref="ErrorLog" />
|
||||
<appender-ref ref="InfoLog" />
|
||||
</root>
|
||||
</log4net>
|
||||
157
Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs
Normal file
@@ -0,0 +1,157 @@
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Yi.Framework.WebCore.BuilderExtend;
|
||||
using Yi.Framework.Core;
|
||||
using Yi.Framework.Model.ModelFactory;
|
||||
using Yi.Framework.WebCore.MiddlewareExtend;
|
||||
using Yi.Framework.WebCore.Utility;
|
||||
using Autofac;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Host.ConfigureAppConfiguration((hostBuilderContext, configurationBuilder) =>
|
||||
{
|
||||
configurationBuilder.AddCommandLine(args);
|
||||
configurationBuilder.AddJsonFileService();
|
||||
#region
|
||||
//Apollo<6C><6F><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
configurationBuilder.AddApolloService("Yi");
|
||||
});
|
||||
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||
builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder =>
|
||||
{
|
||||
#region
|
||||
//<2F><><EFBFBD><EFBFBD>Module<6C><65><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
containerBuilder.RegisterModule<CustomAutofacModule>();
|
||||
});
|
||||
builder.Host.ConfigureLogging(loggingBuilder =>
|
||||
{
|
||||
loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning);
|
||||
loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning);
|
||||
loggingBuilder.AddLog4Net();
|
||||
});
|
||||
#region
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//builder.Host.ConfigureWebHostDefaults(webBuilder =>
|
||||
// {
|
||||
// //webBuilder.UseStartup<Startup>();
|
||||
// });
|
||||
#endregion
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
#region
|
||||
//Ioc<6F><63><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddIocService(builder.Configuration);
|
||||
|
||||
#region
|
||||
//Quartz<74><7A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddQuartzService();
|
||||
#region
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddControllers(optios => {
|
||||
//optios.Filters.Add(typeof(CustomExceptionFilterAttribute));
|
||||
}).AddJsonFileService();
|
||||
#region
|
||||
//Swagger<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddSwaggerService<Program>();
|
||||
#region
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddCorsService();
|
||||
#region
|
||||
//Jwt<77><74>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddJwtService();
|
||||
#region
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddDbService();
|
||||
#region
|
||||
//Redis<69><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddRedisService();
|
||||
#region
|
||||
//RabbitMQ<4D><51><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddRabbitMQService();
|
||||
#region
|
||||
//ElasticSeach<63><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddElasticSeachService();
|
||||
#region
|
||||
//<2F><><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddSMSService();
|
||||
#region
|
||||
//CAP<41><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddCAPService<Program>();
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
var app = builder.Build();
|
||||
//if (app.Environment.IsDevelopment())
|
||||
{
|
||||
#region
|
||||
//<2F><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseDeveloperExceptionPage();
|
||||
#region
|
||||
//Swagger<65><72><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseSwaggerService();
|
||||
}
|
||||
#region
|
||||
//<2F><><EFBFBD><EFBFBD>ץȡ<D7A5><C8A1><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseErrorHandlingService();
|
||||
#region
|
||||
//<2F><>̬<EFBFBD>ļ<EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
//app.UseStaticFiles();
|
||||
#region
|
||||
//HttpsRedirectionע<6E><D7A2>
|
||||
#endregion
|
||||
app.UseHttpsRedirection();
|
||||
#region
|
||||
//·<><C2B7>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseRouting();
|
||||
#region
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseCorsService();
|
||||
#region
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseHealthCheckMiddleware();
|
||||
#region
|
||||
//<2F><>Ȩע<C8A8><D7A2>
|
||||
#endregion
|
||||
app.UseAuthentication();
|
||||
#region
|
||||
//<2F><>Ȩע<C8A8><D7A2>
|
||||
#endregion
|
||||
app.UseAuthorization();
|
||||
#region
|
||||
//Consul<75><6C><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseConsulService();
|
||||
#region
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseDbSeedInitService(app.Services.GetService<IDbContextFactory>());
|
||||
#region
|
||||
//redis<69><73><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseRedisSeedInitService(app.Services.GetService<CacheClientDB>());
|
||||
#region
|
||||
//Endpointsע<73><D7A2>
|
||||
#endregion
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
app.Run();
|
||||
278
Yi.Framework.Net6/Yi.Framework.ApiMicroservice/SwaggerDoc.xml
Normal file
@@ -0,0 +1,278 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Yi.Framework.ApiMicroservice</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Login(Yi.Framework.Model.Models.user)">
|
||||
<summary>
|
||||
登录方法,要返回data:{user,token} token
|
||||
</summary>
|
||||
<param name="_user"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Logout">
|
||||
<summary>
|
||||
不用写,单纯制作日志
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Register(Yi.Framework.Model.Models.user,System.String)">
|
||||
<summary>
|
||||
code为验证码,从redis中判断一下code是否正确
|
||||
</summary>
|
||||
<param name="_user"></param>
|
||||
<param name="code"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.SendSMS(System.String)">
|
||||
<summary>
|
||||
发送短信,需要将生成的sms+code存入redis
|
||||
</summary>
|
||||
<param name="SMSAddress"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Email(System.String)">
|
||||
<summary>
|
||||
发送邮箱,需要先到数据库判断该邮箱是否被人注册过,到userservice写mail_exist方法,还有接口别忘了。
|
||||
</summary>
|
||||
<param name="emailAddress"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.ChangePassword(Yi.Framework.DTOModel.ChangePwdDto)">
|
||||
<summary>
|
||||
修改密码
|
||||
</summary>
|
||||
<param name="pwdDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.FileController.Upload(System.String,Microsoft.AspNetCore.Http.IFormFile)">
|
||||
<summary>
|
||||
该方法不对外暴露
|
||||
</summary>
|
||||
<param name="type"></param>
|
||||
<param name="file"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.JobController.startJob">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.JobController.getRunJobList">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.JobController.getJobClass">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.JobController.stopJob">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.JobController.DeleteJob">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.JobController.ResumeJob">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.GetMenuInMould">
|
||||
<summary>
|
||||
这个是要递归的,但是要过滤掉删除的,所以,可以写一个通用过滤掉删除的方法
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.UpdateMenu(Yi.Framework.Model.Models.menu)">
|
||||
<summary>
|
||||
更
|
||||
</summary>
|
||||
<param name="_menu"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.DelListMenu(System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
删
|
||||
</summary>
|
||||
<param name="_ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.AddTopMenu(Yi.Framework.Model.Models.menu)">
|
||||
<summary>
|
||||
增
|
||||
现在,top菜单只允许为一个
|
||||
</summary>
|
||||
<param name="_menu"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.SetMouldByMenu(Yi.Framework.DTOModel.IdDto{System.Int32})">
|
||||
<summary>
|
||||
给一个菜单设置一个接口,Id1为菜单id,Id2为接口id
|
||||
用于给菜单设置接口
|
||||
</summary>
|
||||
<param name="idDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.AddChildrenMenu(Yi.Framework.DTOModel.ChildrenDto{Yi.Framework.Model.Models.menu})">
|
||||
<summary>
|
||||
给一个菜单添加子节点(注意:添加,不是覆盖)
|
||||
</summary>
|
||||
<param name="childrenDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.GetTopMenusByHttpUser">
|
||||
<summary>
|
||||
获取用户的目录菜单,不包含接口
|
||||
用于账户信息页面,显示这个用户有哪些菜单,需要并列
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MouldController.UpdateMould(Yi.Framework.Model.Models.mould)">
|
||||
<summary>
|
||||
更
|
||||
</summary>
|
||||
<param name="_mould"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MouldController.DelListMould(System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
删
|
||||
</summary>
|
||||
<param name="_ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MouldController.AddMould(Yi.Framework.Model.Models.mould)">
|
||||
<summary>
|
||||
增
|
||||
</summary>
|
||||
<param name="_mould"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.UpdateRole(Yi.Framework.Model.Models.role)">
|
||||
<summary>
|
||||
更
|
||||
</summary>
|
||||
<param name="_role"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.DelListRole(System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
删
|
||||
</summary>
|
||||
<param name="_ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.AddRole(Yi.Framework.Model.Models.role)">
|
||||
<summary>
|
||||
增
|
||||
</summary>
|
||||
<param name="_role"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GetRolesByUserId(System.Int32)">
|
||||
<summary>
|
||||
根据用户id得到该用户有哪些角色
|
||||
用于显示用户详情中的角色说明
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.SetMenuByRole(Yi.Framework.DTOModel.IdsListDto{System.Int32})">
|
||||
<summary>
|
||||
给角色设置菜单,多个角色与多个菜单,让每一个角色都设置,ids1为角色,ids2为菜单
|
||||
用于设置角色
|
||||
</summary>
|
||||
<param name="idsListDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.GetTopMenusByRoleId(System.Int32)">
|
||||
<summary>
|
||||
用于给角色设置菜单的时候,点击一个角色,显示这个角色拥有的并列的菜单
|
||||
</summary>
|
||||
<param name="roleId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.SettingController.GetSetting">
|
||||
<summary>
|
||||
查
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.SettingController.UpdateSetting(Yi.Framework.DTOModel.SettingDto)">
|
||||
<summary>
|
||||
更
|
||||
</summary>
|
||||
<param name="settingDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetUser">
|
||||
<summary>
|
||||
查
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateUser(Yi.Framework.Model.Models.user)">
|
||||
<summary>
|
||||
更
|
||||
</summary>
|
||||
<param name="_user"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.DelListUser(System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
删
|
||||
</summary>
|
||||
<param name="_ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.AddUser(Yi.Framework.Model.Models.user)">
|
||||
<summary>
|
||||
增
|
||||
</summary>
|
||||
<param name="_user"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.SetRoleByUser(Yi.Framework.DTOModel.IdsListDto{System.Int32})">
|
||||
<summary>
|
||||
SetRoleByUser
|
||||
给多个用户设置多个角色,ids有用户id与 角色列表ids,多对多,ids1用户,ids2为角色
|
||||
用户设置给用户设置角色
|
||||
</summary>
|
||||
<param name="idsListDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetUserInRolesByHttpUser">
|
||||
<summary>
|
||||
根据http上下文的用户得到该用户信息,关联角色
|
||||
用于显示账号信息页中的用户信息和角色信息
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetMenuByHttpUser">
|
||||
<summary>
|
||||
得到登录用户的递归菜单,放到导航栏
|
||||
用户放到导航栏中
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetAxiosByRouter(System.String)">
|
||||
<summary>
|
||||
得到请求模型
|
||||
</summary>
|
||||
<param name="router"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,40 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>D:\CC.Yi\CC.Yi\Yi.Framework\Yi.Framework.ApiMicroservice\SwaggerDoc.xml</DocumentationFile>
|
||||
<NoWarn>1701;1702;CS1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="wwwrooot\**" />
|
||||
<Content Remove="wwwrooot\**" />
|
||||
<EmbeddedResource Remove="wwwrooot\**" />
|
||||
<None Remove="wwwrooot\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Yi.Framework.DTOModel\Yi.Framework.DTOModel.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Service\Yi.Framework.Service.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.WebCore\Yi.Framework.WebCore.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\file\" />
|
||||
<Folder Include="wwwroot\image\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 18 KiB |