HuanMengProject/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/CategoryController.cs
2024-07-16 06:42:12 +08:00

70 lines
2.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using HuanMeng.DotNetCore.Base;
using HuanMeng.MiaoYu.Code.Cache;
using HuanMeng.MiaoYu.Code.Category;
using HuanMeng.MiaoYu.Model.Dto.Category;
using HuanMeng.MiaoYu.Model.Dto.Character;
using HuanMeng.MiaoYu.Model.Dto.Find;
using HuanMeng.MiaoYu.WebApi.Base;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace HuanMeng.MiaoYu.WebApi.Controllers
{
/// <summary>
/// 分类页面控制器
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class CategoryController : MiaoYuControllerBase
{
public CategoryController(IServiceProvider _serviceProvider) : base(_serviceProvider)
{
}
/// <summary>
/// 获取分类列表
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public BaseResponse<List<CategoryInfo>> GetCategoryList()
{
CategoryBLL categoryBLL = new CategoryBLL(ServiceProvider);
return categoryBLL.GetCategoryList();
}
/// <summary>
/// 获取类型中的角色信息
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public BaseResponse<List<CharacterSummary>> GetCategoryInfoList(int CategoryId)
{
CategoryBLL categoryBLL = new CategoryBLL(ServiceProvider);
return categoryBLL.GetCategoryInfoList(CategoryId);
}
/// <summary>
/// 获取推荐页数据
/// 返回的data是一个数组当数组中的对象type为bannerdata类型看201当数组中的对象type为tuijian、xiaoshuo时data类型看202
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[ProducesResponseType(typeof(BaseResponse<List<RecommendDto<DataListBaseDto>>>), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(CommonRecommendData), StatusCodes.Status201Created)]
[ProducesResponseType(typeof(DataListDto), StatusCodes.Status202Accepted)]
public BaseResponse<List<RecommendDto<DataListBaseDto>>> GetCategoryFindList()
{
CategoryBLL categoryBLL = new CategoryBLL(ServiceProvider);
//var x = categoryBLL.GetRecommendList();
//var json = JsonConvert.SerializeObject(x);
return categoryBLL.GetRecommendList();
}
}
}