去掉用户管理里的trycatch
This commit is contained in:
		
							parent
							
								
									27732189fd
								
							
						
					
					
						commit
						5297e85067
					
				| 
						 | 
				
			
			@ -92,8 +92,6 @@ namespace langguanApi.Service
 | 
			
		|||
        /// <param name="id">当前菜单id</param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task<ApiResult> DeleteMenu(string id)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
        {
 | 
			
		||||
            var entity = await base.GetAsync(id);
 | 
			
		||||
            if (entity == null)
 | 
			
		||||
| 
						 | 
				
			
			@ -102,21 +100,6 @@ namespace langguanApi.Service
 | 
			
		|||
            }
 | 
			
		||||
            entity.IsDelete = true;
 | 
			
		||||
            await base.UpdateAsync(id, entity);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                _logger.LogError($"删除菜单出现异常,请求参数:{Newtonsoft.Json.JsonConvert.SerializeObject(id)}," +
 | 
			
		||||
                                $"请求接口:'api/Menu/DeleteMenu'," +
 | 
			
		||||
                                $"异常信息:{ex.Message}," +
 | 
			
		||||
                                $"异常位置:{ex.StackTrace}"
 | 
			
		||||
                                );
 | 
			
		||||
                return new ApiResult { code = 1, msg = "删除菜单失败", data = false };
 | 
			
		||||
            }
 | 
			
		||||
            finally
 | 
			
		||||
            {
 | 
			
		||||
                _logger.LogInformation($"删除菜单参数:menuId:{id}");
 | 
			
		||||
            }
 | 
			
		||||
            return new ApiResult() { code = 0, data = true, msg = "删除菜单成功" };
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -118,8 +118,7 @@ namespace langguanApi.Service
 | 
			
		|||
        public async Task<ApiResult> GetUserList(UserQueryDto input)
 | 
			
		||||
        {
 | 
			
		||||
            List<UserDetailDto> list = new List<UserDetailDto>();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
            #region 组织查询条件
 | 
			
		||||
            Expression<Func<UserEntity, bool>> exp = filter => filter.IsDelete == false;
 | 
			
		||||
            if (!string.IsNullOrEmpty(input.key))
 | 
			
		||||
| 
						 | 
				
			
			@ -153,20 +152,6 @@ namespace langguanApi.Service
 | 
			
		|||
                });
 | 
			
		||||
            }
 | 
			
		||||
            #endregion
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                _logger.LogError($"获取用户列表出现异常,请求参数:userQuery:{Newtonsoft.Json.JsonConvert.SerializeObject(input)}," +
 | 
			
		||||
                                 $"请求接口:'api/User/GetUserList'," +
 | 
			
		||||
                                 $"异常信息:{ex.Message}," +
 | 
			
		||||
                                 $"异常位置:{ex.StackTrace}"
 | 
			
		||||
                                 );
 | 
			
		||||
                return new ApiResult { code = 1, msg = "获取用户列表失败" };
 | 
			
		||||
            }
 | 
			
		||||
            finally
 | 
			
		||||
            {
 | 
			
		||||
                _logger.LogInformation($"获取用户列表参数:userQuery:{Newtonsoft.Json.JsonConvert.SerializeObject(input)}");
 | 
			
		||||
            }
 | 
			
		||||
            return new ApiResult { code = 0, data = list, msg = "获取信息成功" };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -178,8 +163,7 @@ namespace langguanApi.Service
 | 
			
		|||
        public async Task<ApiResult> GetUserById(string userId)
 | 
			
		||||
        {
 | 
			
		||||
            UserDetailDto userDetail = null;
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
            #region 校验数据
 | 
			
		||||
            if (string.IsNullOrEmpty(userId))
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -209,20 +193,6 @@ namespace langguanApi.Service
 | 
			
		|||
                Tel = user.Phone
 | 
			
		||||
            };
 | 
			
		||||
            #endregion
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                _logger.LogError($"获取用户信息出现异常,请求参数:userId:{userId}," +
 | 
			
		||||
                $"请求接口:'api/User/GetUserById'," +
 | 
			
		||||
                $"异常信息:{ex.Message}," +
 | 
			
		||||
                $"异常位置:{ex.StackTrace}"
 | 
			
		||||
                );
 | 
			
		||||
                return new ApiResult { code = 1, msg = "获取用户信息失败" };
 | 
			
		||||
            }
 | 
			
		||||
            finally
 | 
			
		||||
            {
 | 
			
		||||
                _logger.LogInformation($"获取用户信息参数:userId:{userId}");
 | 
			
		||||
            }
 | 
			
		||||
            return new ApiResult { code = 0, data = userDetail };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -230,8 +200,7 @@ namespace langguanApi.Service
 | 
			
		|||
        //更新用户信息方法
 | 
			
		||||
        public async Task<ApiResult> UpdateUser(UserDto input)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
            #region 校验参数
 | 
			
		||||
            if (string.IsNullOrEmpty(input.Id))
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -265,20 +234,6 @@ namespace langguanApi.Service
 | 
			
		|||
            #region 更新数据
 | 
			
		||||
            await base.UpdateAsync(input.Id, userEntity);//更新用户信息
 | 
			
		||||
            #endregion
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                _logger.LogError($"更新用户信息出现异常,请求参数:user:{Newtonsoft.Json.JsonConvert.SerializeObject(input)}," +
 | 
			
		||||
                                 $"请求接口:'api/User/UpdateUser'," +
 | 
			
		||||
                                 $"异常信息:{ex.Message}," +
 | 
			
		||||
                                 $"异常位置:{ex.StackTrace}"
 | 
			
		||||
                                 );
 | 
			
		||||
                return new ApiResult { code = 1, msg = "更新用户信息失败" };
 | 
			
		||||
            }
 | 
			
		||||
            finally
 | 
			
		||||
            {
 | 
			
		||||
                _logger.LogInformation($"更新用户信息参数:user:{Newtonsoft.Json.JsonConvert.SerializeObject(input)}");
 | 
			
		||||
            }
 | 
			
		||||
            return new ApiResult { code = 0, msg = "更新用户信息成功" };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -289,8 +244,7 @@ namespace langguanApi.Service
 | 
			
		|||
        /// <returns></returns>
 | 
			
		||||
        public async Task<ApiResult> DeleteUser(string userId)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
            #region 校验数据
 | 
			
		||||
            if (string.IsNullOrEmpty(userId))
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -306,20 +260,6 @@ namespace langguanApi.Service
 | 
			
		|||
            user.IsDelete = true;
 | 
			
		||||
            await base.UpdateAsync(userId, user);//更新用户信息
 | 
			
		||||
            #endregion
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                _logger.LogError($"删除用户信息出现异常,请求参数:userId:{userId}," +
 | 
			
		||||
                                 $"请求接口:'api/User/DeleteUser'," +
 | 
			
		||||
                                 $"异常信息:{ex.Message}," +
 | 
			
		||||
                                 $"异常位置:{ex.StackTrace}"
 | 
			
		||||
                                 );
 | 
			
		||||
                return new ApiResult { code = 1, msg = "删除用户信息失败" };
 | 
			
		||||
            }
 | 
			
		||||
            finally
 | 
			
		||||
            {
 | 
			
		||||
                _logger.LogInformation($"删除用户信息参数:userId:{userId}");
 | 
			
		||||
            }
 | 
			
		||||
            return new ApiResult { code = 0, msg = "删除用户信息成功" };
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue