示例#1
0
        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("用户名或密码错误")));
        }
示例#2
0
        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("认证失败")));
        }
示例#3
0
        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, "获取成功")));
        }
示例#4
0
        public async Task <IActionResult> Update([FromBody] AddScheduleInput input)
        {
            await _schedulerCenter.UpdateJobAsync(input);

            return(Ok(ResponseBody.From("修改成功")));
        }
示例#5
0
        public async Task <IActionResult> GetJobLog([FromQuery] GetLogInput input)
        {
            var result = await _schedulerCenter.GetJobLogsAsync(input);

            return(Ok(ResponseBody.From(result)));
        }
示例#6
0
        public async Task <IActionResult> GetJobs()
        {
            var result = await _schedulerCenter.GetJobListAsync();

            return(Ok(ResponseBody.From(result)));
        }
示例#7
0
 public IActionResult AddMailSetting([FromBody] AddMailSettingInput input)
 {
     _mailSettingService.AddMailSetting(input);
     return(Ok(ResponseBody.From("保存成功")));
 }
示例#8
0
        public async Task <IActionResult> UpdateTest(int id, [FromBody] AddOrUpdateTestInput input)
        {
            await _testService.AddOrUpdateTest(id, input);

            return(Ok(ResponseBody.From("修改成功")));
        }
示例#9
0
        public IActionResult GetTestList([FromQuery] GetTestInput input)
        {
            var result = _testService.GetTestList(input);

            return(Ok(ResponseBody.From(result)));
        }
示例#10
0
        public IActionResult GetAllMenus([FromQuery] GetMenuInput input)
        {
            var result = _menuService.GetAllMenus(input);

            return(Ok(ResponseBody.From(result)));
        }
示例#11
0
        public async Task <IActionResult> AddUser([FromBody] AddOrUpdateUserInput input)
        {
            await _userService.AddOrUpdateUser(null, input);

            return(Ok(ResponseBody.From("保存成功")));
        }
示例#12
0
 public IActionResult DeleteMenu(int[] ids)
 {
     _menuService.DeleteMenu(ids);
     return(Ok(ResponseBody.From("删除成功")));
 }
示例#13
0
 public IActionResult UpdateRole(int id, [FromBody] AddOrUpdateMenuInput input)
 {
     _menuService.AddOrUpdateMenu(id, input);
     return(Ok(ResponseBody.From("修改成功")));
 }
示例#14
0
 public IActionResult AddMenu([FromBody] AddOrUpdateMenuInput input)
 {
     _menuService.AddOrUpdateMenu(null, input);
     return(Ok(ResponseBody.From("保存成功")));
 }
示例#15
0
        public IActionResult GetCascadeMenus()
        {
            var result = _menuService.GetCascadeMenus();

            return(Ok(ResponseBody.From(result)));
        }
示例#16
0
        public IActionResult GetMenusByRole()
        {
            var result = _menuService.GetMenusByRole();

            return(Ok(ResponseBody.From(result)));
        }
示例#17
0
        public async Task <IActionResult> Run([FromBody] JobKeyInput input)
        {
            await _schedulerCenter.RunJobAsync(input.JobName, input.GroupName);

            return(Ok(ResponseBody.From("执行成功")));
        }
示例#18
0
        public IActionResult GetUserList([FromQuery] GetUserInput input)
        {
            var users = _userService.GetUserList(input);

            return(Ok(ResponseBody.From(users)));
        }
示例#19
0
        public async Task <IActionResult> ModifyPassword(ModifyPasswordInput input)
        {
            await _userService.ModifyPassword(input);

            return(Ok(ResponseBody.From("密码修改成功")));
        }
示例#20
0
        public async Task <IActionResult> ResetPassword(int id)
        {
            await _userService.ResetPassword(id);

            return(Ok(ResponseBody.From("密码已重置为 123456")));
        }
示例#21
0
        public IActionResult GetRoleList([FromQuery] GetRoleInput input)
        {
            var roles = _roleService.GetRoleList(input);

            return(Ok(ResponseBody.From(roles)));
        }
示例#22
0
        public async Task <IActionResult> GetPermissions()
        {
            var permissions = await _userService.GetPermissions();

            return(Ok(ResponseBody.From(permissions)));
        }
示例#23
0
        public async Task <IActionResult> AddRole([FromBody] AddOrUpdateRoleInput input)
        {
            await _roleService.AddOrUpdateRole(null, input);

            return(Ok(ResponseBody.From("保存成功")));
        }
示例#24
0
        public async Task <IActionResult> AddTest([FromBody] AddOrUpdateTestInput input)
        {
            await _testService.AddOrUpdateTest(null, input);

            return(Ok(ResponseBody.From("保存成功")));
        }
示例#25
0
        public IActionResult GetTransferRoles()
        {
            var roles = _roleService.GetTransferRoles();

            return(Ok(ResponseBody.From(roles)));
        }
示例#26
0
        public async Task <IActionResult> DeleteTest(int[] ids)
        {
            await _testService.DeleteTest(ids);

            return(Ok(ResponseBody.From("删除成功")));
        }
示例#27
0
        public IActionResult GetMailSettingList()
        {
            var result = _mailSettingService.GetMailSetting();

            return(Ok(ResponseBody.From(result)));
        }