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
{
///
/// 分类页面控制器
///
[Route("api/[controller]/[action]")]
[ApiController]
public class CategoryController : MiaoYuControllerBase
{
public CategoryController(IServiceProvider _serviceProvider) : base(_serviceProvider)
{
}
///
/// 获取分类列表
///
///
[HttpGet]
[AllowAnonymous]
public BaseResponse> GetCategoryList()
{
CategoryBLL categoryBLL = new CategoryBLL(ServiceProvider);
return categoryBLL.GetCategoryList();
}
///
/// 获取类型中的角色信息
///
///
[HttpGet]
[AllowAnonymous]
public BaseResponse> GetCategoryInfoList(int CategoryId)
{
CategoryBLL categoryBLL = new CategoryBLL(ServiceProvider);
return categoryBLL.GetCategoryInfoList(CategoryId);
}
///
/// 获取推荐页数据
/// 返回的data是一个数组,当数组中的对象type为banner,data类型看201,当数组中的对象type为tuijian、xiaoshuo时,data类型看202
///
///
[HttpGet]
[AllowAnonymous]
[ProducesResponseType(typeof(BaseResponse>>), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(CommonRecommendData), StatusCodes.Status201Created)]
[ProducesResponseType(typeof(DataListDto), StatusCodes.Status202Accepted)]
public BaseResponse>> GetCategoryFindList()
{
CategoryBLL categoryBLL = new CategoryBLL(ServiceProvider);
//var x = categoryBLL.GetRecommendList();
//var json = JsonConvert.SerializeObject(x);
return categoryBLL.GetRecommendList();
}
}
}