36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using LiveForum.Code.Base;
|
|
using LiveForum.IService.Others;
|
|
using LiveForum.Model.Dto.Others;
|
|
using LiveForum.Code.AttributeExtend;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace LiveForum.WebApi.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 轮播图相关接口
|
|
/// </summary>
|
|
/// <param name="banners"></param>
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class BannersController(IBannersService banners) : ControllerBase
|
|
{
|
|
/// <summary>
|
|
/// 获取轮播图列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[ResponseCacheExtend(Duration = 600)] // 10分钟缓存
|
|
public Task<BaseResponseList<BannerDto>> GetBanners() => banners.GetBanners();
|
|
|
|
/// <summary>
|
|
/// 点击轮播图
|
|
/// </summary>
|
|
/// <param name="request">请求参数</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public Task<BaseResponse<BannerClickRespDto>> ClickBanner([FromBody] BannerClickReq request) => banners.ClickBanner(request);
|
|
}
|
|
}
|