70 lines
2.4 KiB
C#
70 lines
2.4 KiB
C#
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为banner,data类型看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();
|
||
}
|
||
}
|
||
}
|