public async Task <IActionResult> Login([FromBody] LoginInput input) { if (string.IsNullOrWhiteSpace(input.UserName) || string.IsNullOrWhiteSpace(input.Password)) { return(Ok(ResponseBody.Bad("用户名或密码不能为空"))); } var user = await _userService.LonginAsync(input); if (user != null) { return(Ok(ResponseBody.From(AuthenticateResult.Get(user, _requirement, _cache)))); } return(Ok(ResponseBody.Bad("用户名或密码错误"))); }
public async Task <object> RefreshToken(string token) { if (string.IsNullOrEmpty(token)) { return(Ok(ResponseBody.Bad("令牌无效,请重新登陆"))); } var uid = JwtToken.ReadJwtToken <int>(token); var user = await _userService.GetLoginUserAsync(uid); if (user != null) { return(Ok(ResponseBody.From(AuthenticateResult.Get(user, _requirement, _cache)))); } return(Ok(ResponseBody.Bad("认证失败"))); }
public async Task <IActionResult> GetCounts() { var num = new RandomNum { QQ = new Random().Next(10, 100), WeChat = new Random().Next(10, 100), Skype = new Random().Next(10, 100), Github = new Random().Next(10, 100), }; if (_configuration.GetValue <bool>("Startup:SignalR")) { await _hubContext.Clients.All.SendAsync("getCount", num); string.Format("SignalR:method:{0} arg1:{1} 时间:{2}", "getCount", JsonConvert.SerializeObject(num), DateTime.Now).WriteSuccessLine(); } return(Ok(ResponseBody.From(num, "获取成功"))); }
public async Task <IActionResult> Update([FromBody] AddScheduleInput input) { await _schedulerCenter.UpdateJobAsync(input); return(Ok(ResponseBody.From("修改成功"))); }
public async Task <IActionResult> GetJobLog([FromQuery] GetLogInput input) { var result = await _schedulerCenter.GetJobLogsAsync(input); return(Ok(ResponseBody.From(result))); }
public async Task <IActionResult> GetJobs() { var result = await _schedulerCenter.GetJobListAsync(); return(Ok(ResponseBody.From(result))); }
public IActionResult AddMailSetting([FromBody] AddMailSettingInput input) { _mailSettingService.AddMailSetting(input); return(Ok(ResponseBody.From("保存成功"))); }
public async Task <IActionResult> UpdateTest(int id, [FromBody] AddOrUpdateTestInput input) { await _testService.AddOrUpdateTest(id, input); return(Ok(ResponseBody.From("修改成功"))); }
public IActionResult GetTestList([FromQuery] GetTestInput input) { var result = _testService.GetTestList(input); return(Ok(ResponseBody.From(result))); }
public IActionResult GetAllMenus([FromQuery] GetMenuInput input) { var result = _menuService.GetAllMenus(input); return(Ok(ResponseBody.From(result))); }
public async Task <IActionResult> AddUser([FromBody] AddOrUpdateUserInput input) { await _userService.AddOrUpdateUser(null, input); return(Ok(ResponseBody.From("保存成功"))); }
public IActionResult DeleteMenu(int[] ids) { _menuService.DeleteMenu(ids); return(Ok(ResponseBody.From("删除成功"))); }
public IActionResult UpdateRole(int id, [FromBody] AddOrUpdateMenuInput input) { _menuService.AddOrUpdateMenu(id, input); return(Ok(ResponseBody.From("修改成功"))); }
public IActionResult AddMenu([FromBody] AddOrUpdateMenuInput input) { _menuService.AddOrUpdateMenu(null, input); return(Ok(ResponseBody.From("保存成功"))); }
public IActionResult GetCascadeMenus() { var result = _menuService.GetCascadeMenus(); return(Ok(ResponseBody.From(result))); }
public IActionResult GetMenusByRole() { var result = _menuService.GetMenusByRole(); return(Ok(ResponseBody.From(result))); }
public async Task <IActionResult> Run([FromBody] JobKeyInput input) { await _schedulerCenter.RunJobAsync(input.JobName, input.GroupName); return(Ok(ResponseBody.From("执行成功"))); }
public IActionResult GetUserList([FromQuery] GetUserInput input) { var users = _userService.GetUserList(input); return(Ok(ResponseBody.From(users))); }
public async Task <IActionResult> ModifyPassword(ModifyPasswordInput input) { await _userService.ModifyPassword(input); return(Ok(ResponseBody.From("密码修改成功"))); }
public async Task <IActionResult> ResetPassword(int id) { await _userService.ResetPassword(id); return(Ok(ResponseBody.From("密码已重置为 123456"))); }
public IActionResult GetRoleList([FromQuery] GetRoleInput input) { var roles = _roleService.GetRoleList(input); return(Ok(ResponseBody.From(roles))); }
public async Task <IActionResult> GetPermissions() { var permissions = await _userService.GetPermissions(); return(Ok(ResponseBody.From(permissions))); }
public async Task <IActionResult> AddRole([FromBody] AddOrUpdateRoleInput input) { await _roleService.AddOrUpdateRole(null, input); return(Ok(ResponseBody.From("保存成功"))); }
public async Task <IActionResult> AddTest([FromBody] AddOrUpdateTestInput input) { await _testService.AddOrUpdateTest(null, input); return(Ok(ResponseBody.From("保存成功"))); }
public IActionResult GetTransferRoles() { var roles = _roleService.GetTransferRoles(); return(Ok(ResponseBody.From(roles))); }
public async Task <IActionResult> DeleteTest(int[] ids) { await _testService.DeleteTest(ids); return(Ok(ResponseBody.From("删除成功"))); }
public IActionResult GetMailSettingList() { var result = _mailSettingService.GetMailSetting(); return(Ok(ResponseBody.From(result))); }