增加权限控制
This commit is contained in:
parent
a3b0b24db6
commit
2538372303
|
|
@ -126,6 +126,10 @@ namespace HuanMeng.MiaoYu.Code.Music
|
|||
/// <returns></returns>
|
||||
public async Task<BaseResponse<bool>> CreateUserMusicGenres(string genresName)
|
||||
{
|
||||
if (_UserId == 0)
|
||||
{
|
||||
throw new Exception("请先登录");
|
||||
}
|
||||
var genresCount = MiaoYuCacheExtend.GetMiaoYuDataEntityCacheList<M_MusicGenres>(this, it => it.IsEnabled)?.Where(it => it.GenreName == genresName).Count();
|
||||
if (genresCount > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using HuanMeng.MiaoYu.Model.Dto.Music;
|
|||
using HuanMeng.MiaoYu.Model.EnumModel.User;
|
||||
using HuanMeng.MiaoYu.WebApi.Base;
|
||||
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -16,6 +17,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
|
|||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class MusicController : MiaoYuControllerBase
|
||||
{
|
||||
public MusicController(IServiceProvider _serviceProvider) : base(_serviceProvider)
|
||||
|
|
@ -27,6 +29,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<BaseResponse<List<MusicGenresDto>>> GetMusicGenresList()
|
||||
{
|
||||
MusicBLL musicBLL = new MusicBLL(ServiceProvider);
|
||||
|
|
@ -38,6 +41,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
|
|||
/// <param name="genresId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<BaseResponse<List<MusicSongInfoDto>>> GetMusicGenresInfo(int genresId)
|
||||
{
|
||||
MusicBLL musicBLL = new MusicBLL(ServiceProvider);
|
||||
|
|
@ -49,6 +53,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<BaseResponse<List<MusicUserGenresDto>>> GetUserMusicGenresList()
|
||||
{
|
||||
MusicBLL musicBLL = new MusicBLL(ServiceProvider);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user