148 lines
4.5 KiB
C#
148 lines
4.5 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using VOL.Business.IServices;
|
|
using VOL.Core.Filters;
|
|
using VOL.Core.ManageUser;
|
|
using VOL.Core.Utilities;
|
|
using VOL.Entity.DomainModels;
|
|
using VOL.Entity.Enum;
|
|
using VOL.Model;
|
|
using VOL.Model.Ai;
|
|
using VOL.Model.Ai.Request;
|
|
using VOL.Model.IOT.Response;
|
|
using VOL.WebApi.Filter;
|
|
|
|
namespace VOL.WebApi.Controllers.Business
|
|
{
|
|
/// <summary>
|
|
/// 专项教学
|
|
/// </summary>
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
[ApiExplorerSettings(GroupName = "v3")]
|
|
[TypeFilter(typeof(CustomApiResponseFilter))]
|
|
public class SpecialController : ControllerBase
|
|
{
|
|
#region 初始化
|
|
|
|
private readonly IAi_SpecialService _specialService;
|
|
public SpecialController(
|
|
IAi_SpecialService specialService)
|
|
{
|
|
_specialService = specialService;
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 获取专项教学列表
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetSpecialList))]
|
|
public async Task<PageDataDto<Ai_SpecialDto>> GetSpecialList([FromQuery] Ai_SpecialRequest paramDto)
|
|
{
|
|
var result = await _specialService.GetSpecialList(paramDto);
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取专项水平列表
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetSpecialLevelList))]
|
|
public async Task<PageDataDto<Ai_SpecialLevelDto>> GetSpecialLevelList([FromQuery] Ai_SpecialLevelRequest paramDto)
|
|
{
|
|
var result = await _specialService.GetSpecialLevelList(paramDto);
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增专项动作
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
|
|
[HttpPost(nameof(AddSpecialAction))]
|
|
public async Task<ActionResult> AddSpecialAction([FromBody] SpecialActionParam paramDto)
|
|
{
|
|
await _specialService.AddSpecialAction(paramDto);
|
|
|
|
return Ok("新增成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新专项动作
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(ModifySpecialAction))]
|
|
public async Task<ActionResult> ModifySpecialAction([FromBody] SpecialActionParam paramDto)
|
|
{
|
|
await _specialService.ModifySpecialAction(paramDto);
|
|
|
|
return Ok("更新成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新专项动作视频
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(ModifySpecialActionVideo))]
|
|
public async Task<ActionResult> ModifySpecialActionVideo([FromBody] SpecialActionParam paramDto)
|
|
{
|
|
await _specialService.ModifySpecialActionVideo(paramDto);
|
|
|
|
return Ok("更新成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除专项动作
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(DeleteSpecialAction))]
|
|
public async Task<ActionResult> DeleteSpecialAction(int id)
|
|
{
|
|
await _specialService.DeleteSpecialAction(id);
|
|
return Ok("删除成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 专项上传视频
|
|
/// </summary>
|
|
/// <param name="file"></param>
|
|
/// <param name="levelId">水平Id</param>
|
|
/// <param name="videoName">视频名称</param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(SpecialUploadVideo))]
|
|
public async Task<string> SpecialUploadVideo(IFormFile file, int levelId, string videoName, int actionId)
|
|
{
|
|
var url = await _specialService.SpecialUploadVideo(file, levelId, videoName, actionId);
|
|
|
|
return url;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传封面图片
|
|
/// </summary>
|
|
/// <param name="file"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(UploadImage))]
|
|
public string UploadImage(IFormFile file)
|
|
{
|
|
var url = _specialService.UploadImage(file);
|
|
return url;
|
|
}
|
|
}
|
|
}
|