69 lines
2.1 KiB
C#
69 lines
2.1 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using YD_WeChatApplet.Commons.Dto.HomeWork;
|
|
using YD_WeChatApplet.Commons.Dto.Patriarch;
|
|
using YD_WeChatApplet.Services;
|
|
|
|
namespace YD_WeChatApplet.Api.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 用户偏好
|
|
/// </summary>
|
|
[ApiController]
|
|
[ApiExplorerSettings(GroupName = "v1")]
|
|
[Route("[controller]")]
|
|
public class UserPreferenceController : ControllerBase
|
|
{
|
|
private readonly IUserPreferenceService _userPreferenceService;
|
|
public UserPreferenceController(IUserPreferenceService userPreferenceService)
|
|
{
|
|
_userPreferenceService = userPreferenceService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增偏好
|
|
/// </summary>
|
|
/// <param name="dto"></param>
|
|
/// <returns></returns>
|
|
//[HttpPost("AddPreference")]
|
|
//public async Task<IActionResult> AddPreference([FromBody] AddPreferenceDto dto)
|
|
//{
|
|
// await _userPreferenceService.AddPreference(dto);
|
|
// return Ok("新增成功");
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 获取个人偏好
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("GetPreferences")]
|
|
public async Task<GetPreferenceDto> GetPreferences()
|
|
{
|
|
var res = await _userPreferenceService.GetPreferences();
|
|
return res;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置偏好
|
|
/// </summary>
|
|
/// <param name="dto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("SetPreferences")]
|
|
public async Task<IActionResult> SetPreferences([FromBody] SetPreferenceDto dto)
|
|
{
|
|
await _userPreferenceService.SetPreferences(dto);
|
|
return Ok("设置成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取背景音乐列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("GetBackgroundMusics")]
|
|
public async Task<List<GeBackgroundMusicDto>> GetBackgroundMusics()
|
|
{
|
|
var res = await _userPreferenceService.GetBackgroundMusics();
|
|
return res;
|
|
}
|
|
|
|
}
|
|
} |