77 lines
2.5 KiB
C#
77 lines
2.5 KiB
C#
using CloudGaming.Repository.Game.Entities.Ext;
|
|
using CloudGaming.Api.Admin.ApplicationServices.Apps.Ext;
|
|
namespace CloudGaming.Api.Admin.Controllers.Apps.Ext;
|
|
|
|
/// <summary>
|
|
/// 图片列表 控制器
|
|
/// </summary>
|
|
[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "图片列表")]
|
|
public class T_App_ImageController(IServiceProvider serviceProvider)
|
|
: AdminGameControllerBase<T_App_ImageService, T_App_Image, int, T_App_Image, T_App_Image>(serviceProvider)
|
|
{
|
|
[AllowAnonymous]
|
|
[HttpGet("{language}/{imageId?}/{process?}")]
|
|
public async Task<RedirectResult> GetImageUrl([FromRoute] string language, [FromRoute] int? imageId, [FromRoute] int? process)
|
|
{
|
|
var url = await Service.GetImageUrl(imageId, language);
|
|
if (process == 0)
|
|
{
|
|
url += "?x-oss-process=image/quality,q_1/resize,w_100";
|
|
}
|
|
return Redirect(url);
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="imageType"></param>
|
|
/// <returns></returns>
|
|
[AllowAnonymous]
|
|
[HttpGet("{imageType}")]
|
|
public async Task<List<T_App_Image>> GetImageList([FromRoute] int imageType)
|
|
{
|
|
return await Service.GetImageList(imageType);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 查询表单数据
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[ActionDescriptor(DisplayName = "查看表单")]
|
|
[Microsoft.AspNetCore.Mvc.HttpGet("{language}/{id?}")]
|
|
public virtual Task<Dictionary<string, object?>> FindImageFormAsync([FromRoute] string language, [FromRoute] int imageId)
|
|
{
|
|
return Service.FindFormAsync(imageId, language);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加
|
|
/// </summary>
|
|
/// <param name="form"></param>
|
|
/// <returns></returns>
|
|
[RequestLimitFilter]
|
|
[ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")]
|
|
[Microsoft.AspNetCore.Mvc.HttpPost]
|
|
[ApiCheckModel]
|
|
public async Task<int> CreateImageAsync([FromBody] T_App_Image form)
|
|
{
|
|
return await Service.SaveFormAsync(form);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑
|
|
/// </summary>
|
|
/// <param name="form"></param>
|
|
/// <returns></returns>
|
|
[RequestLimitFilter]
|
|
[ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")]
|
|
[Microsoft.AspNetCore.Mvc.HttpPost]
|
|
[ApiCheckModel]
|
|
public async Task<int> UpdateImageAsync([FromBody] T_App_Image form)
|
|
{
|
|
return await Service.SaveFormAsync(form);
|
|
}
|
|
|
|
} |