/// <summary> /// 根据id获取角色信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <IActionResult> GetRoleById([FromQuery] string id) { var result = new DataResult <RoleModel>(); Guid gid; if (!Guid.TryParse(id, out gid)) { result.code = (int)StatusCodeEnum.HttpMehtodError; result.msg = StatusCodeEnum.HttpMehtodError.GetEnumText(); return(Json(result)); } var getResult = await _roleServices.GetAsync(gid); if (getResult.data != null) { var role = new RoleModel(); role.Id = getResult.data.Id; role.RoleName = getResult.data.Name; role.Remarks = getResult.data.Remarks; role.IsDefault = getResult.data.IsDefault; result.data = role; result.code = getResult.code; result.msg = getResult.msg; } return(Json(result)); }