Dun.Jason 1 rok pred
rodič
commit
57b7fe61a6

+ 4 - 0
src/Hotline.Api/Controllers/RoleController.cs

@@ -95,6 +95,10 @@ public class RoleController : BaseController
         var clientId = jwtOption.Issuer;
         if (string.IsNullOrEmpty(clientId))
             throw new UserFriendlyException("jwt.Issuer未配置");
+
+        if (string.IsNullOrEmpty(dto.Name))
+            throw UserFriendlyException.SameMessage("角色编码不能为空");
+
         var exists = await _roleRepository.Queryable(includeDeleted: true)
             .AnyAsync(d => d.ClientId == clientId && d.Name == dto.Name);
         if (exists)