忽略dll文件git
This commit is contained in:
@@ -1,131 +1,131 @@
|
||||
using Hncore.Infrastructure.EntitiesExtension;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Vpn.Service;
|
||||
using Hncore.Pass.OSS.Domain;
|
||||
using Hncore.Pass.OSS.Request;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.OSS.Controllers
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/oss/v{version:apiVersion}/asset/[action]")]
|
||||
public class AssetController : HncoreControllerBase
|
||||
{
|
||||
AssetGroupService m_AssetGroupService;
|
||||
AssetService m_AssetService;
|
||||
public AssetController(AssetGroupService assetGroupService, AssetService _AssetService)
|
||||
{
|
||||
m_AssetGroupService = assetGroupService;
|
||||
m_AssetService = _AssetService;
|
||||
}
|
||||
|
||||
#region group
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> AddGroup([FromBody] PostGroupRequest request)
|
||||
{
|
||||
var entity = request.MapTo<AssetGroup>();
|
||||
entity.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
await m_AssetGroupService.Add(entity);
|
||||
return Success();
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> UpdateGroup([FromBody] PostGroupRequest request)
|
||||
{
|
||||
var enitty = await m_AssetGroupService.GetById(request.Id);
|
||||
enitty.Name = request.Name;
|
||||
enitty.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
await m_AssetGroupService.Update(enitty);
|
||||
return Success();
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> DeleteGroup([FromQuery] int id)
|
||||
{
|
||||
await m_AssetGroupService.DeleteById(id);
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> GetGroups([FromQuery] int groupType)
|
||||
{
|
||||
var enitty = await m_AssetGroupService.Query(m => m.GroupType == groupType, true).ToListAsync();
|
||||
return Success(enitty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 添加
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Post([FromBody]PostAssetRequest request)
|
||||
{
|
||||
var entity = request.MapTo<Asset>();
|
||||
entity.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
await m_AssetService.Add(entity);
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Put([FromBody]PostAssetRequest request)
|
||||
{
|
||||
var entity = await m_AssetService.GetById(request.Id);
|
||||
if (entity == null)
|
||||
return Error("资源不存在");
|
||||
if (request.Name.Has())
|
||||
{
|
||||
entity.Name = request.Name;
|
||||
}
|
||||
if (request.GroupId > 0)
|
||||
{
|
||||
entity.GroupId = request.GroupId;
|
||||
}
|
||||
await m_AssetService.Update(entity);
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Delete([FromQuery]int id)
|
||||
{
|
||||
var flag = await m_AssetService.DeleteById(id);
|
||||
if (flag)
|
||||
return Success();
|
||||
else
|
||||
return Error("删除失败");
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> Page([FromQuery]int pageIndex,[FromQuery] int assetType,int groupId, [FromQuery] string name)
|
||||
{
|
||||
Expression<Func<Asset, bool>> expr = m => m.AssetType == assetType;
|
||||
if (groupId>0)
|
||||
{
|
||||
expr = expr.And(m => m.GroupId== groupId);
|
||||
}
|
||||
if (name.Has())
|
||||
{
|
||||
expr = expr.And(m => m.Name.Contains(name));
|
||||
}
|
||||
var enitty = await m_AssetService.Page(pageIndex,15,expr, true);
|
||||
return Success(enitty);
|
||||
}
|
||||
}
|
||||
}
|
||||
using Hncore.Infrastructure.EntitiesExtension;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Vpn.Service;
|
||||
using Hncore.Pass.OSS.Domain;
|
||||
using Hncore.Pass.OSS.Request;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.OSS.Controllers
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/oss/v{version:apiVersion}/asset/[action]")]
|
||||
public class AssetController : HncoreControllerBase
|
||||
{
|
||||
AssetGroupService m_AssetGroupService;
|
||||
AssetService m_AssetService;
|
||||
public AssetController(AssetGroupService assetGroupService, AssetService _AssetService)
|
||||
{
|
||||
m_AssetGroupService = assetGroupService;
|
||||
m_AssetService = _AssetService;
|
||||
}
|
||||
|
||||
#region group
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> AddGroup([FromBody] PostGroupRequest request)
|
||||
{
|
||||
var entity = request.MapTo<AssetGroup>();
|
||||
entity.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
await m_AssetGroupService.Add(entity);
|
||||
return Success();
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> UpdateGroup([FromBody] PostGroupRequest request)
|
||||
{
|
||||
var enitty = await m_AssetGroupService.GetById(request.Id);
|
||||
enitty.Name = request.Name;
|
||||
enitty.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
await m_AssetGroupService.Update(enitty);
|
||||
return Success();
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> DeleteGroup([FromQuery] int id)
|
||||
{
|
||||
await m_AssetGroupService.DeleteById(id);
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> GetGroups([FromQuery] int groupType)
|
||||
{
|
||||
var enitty = await m_AssetGroupService.Query(m => m.GroupType == groupType, true).ToListAsync();
|
||||
return Success(enitty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 添加
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Post([FromBody]PostAssetRequest request)
|
||||
{
|
||||
var entity = request.MapTo<Asset>();
|
||||
entity.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
await m_AssetService.Add(entity);
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Put([FromBody]PostAssetRequest request)
|
||||
{
|
||||
var entity = await m_AssetService.GetById(request.Id);
|
||||
if (entity == null)
|
||||
return Error("资源不存在");
|
||||
if (request.Name.Has())
|
||||
{
|
||||
entity.Name = request.Name;
|
||||
}
|
||||
if (request.GroupId > 0)
|
||||
{
|
||||
entity.GroupId = request.GroupId;
|
||||
}
|
||||
await m_AssetService.Update(entity);
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Delete([FromQuery]int id)
|
||||
{
|
||||
var flag = await m_AssetService.DeleteById(id);
|
||||
if (flag)
|
||||
return Success();
|
||||
else
|
||||
return Error("删除失败");
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> Page([FromQuery]int pageIndex,[FromQuery] int assetType,int groupId, [FromQuery] string name)
|
||||
{
|
||||
Expression<Func<Asset, bool>> expr = m => m.AssetType == assetType;
|
||||
if (groupId>0)
|
||||
{
|
||||
expr = expr.And(m => m.GroupId== groupId);
|
||||
}
|
||||
if (name.Has())
|
||||
{
|
||||
expr = expr.And(m => m.Name.Contains(name));
|
||||
}
|
||||
var enitty = await m_AssetService.Page(pageIndex,15,expr, true);
|
||||
return Success(enitty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Vpn.Service;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.OSS.Controllers
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/oss/v{version:apiVersion}/ImageCloud/[action]")]
|
||||
public class ImageCloudController : HncoreControllerBase
|
||||
{
|
||||
UploadService m_UploadService;
|
||||
|
||||
public ImageCloudController(UploadService _UploadService)
|
||||
{
|
||||
m_UploadService = _UploadService;
|
||||
}
|
||||
|
||||
[HttpPost, AllowAnonymous]
|
||||
public async Task<ApiResult> Upload()
|
||||
{
|
||||
var ret = await m_UploadService.GetStreamFromRequest(this.Request);
|
||||
|
||||
if (ret.Item2 == null)
|
||||
return Error("没有图片");
|
||||
|
||||
var url = m_UploadService.AliYunUpload(ret.Item1, ret.Item2,ret.Item3);
|
||||
return Success(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Vpn.Service;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.OSS.Controllers
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/oss/v{version:apiVersion}/ImageCloud/[action]")]
|
||||
public class ImageCloudController : HncoreControllerBase
|
||||
{
|
||||
UploadService m_UploadService;
|
||||
|
||||
public ImageCloudController(UploadService _UploadService)
|
||||
{
|
||||
m_UploadService = _UploadService;
|
||||
}
|
||||
|
||||
[HttpPost, AllowAnonymous]
|
||||
public async Task<ApiResult> Upload()
|
||||
{
|
||||
var ret = await m_UploadService.GetStreamFromRequest(this.Request);
|
||||
|
||||
if (ret.Item2 == null)
|
||||
return Error("没有图片");
|
||||
|
||||
var url = m_UploadService.AliYunUpload(ret.Item1, ret.Item2,ret.Item3);
|
||||
return Success(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UEditor.Core;
|
||||
|
||||
namespace Hncore.Pass.OSS.Controllers
|
||||
{
|
||||
[Route("api/ueditor")]
|
||||
[AllowAnonymous]
|
||||
public class UEditorController : Controller
|
||||
{
|
||||
private readonly UEditorService _ueditorService;
|
||||
public UEditorController(UEditorService ueditorService)
|
||||
{
|
||||
this._ueditorService = ueditorService;
|
||||
}
|
||||
|
||||
[HttpGet, HttpPost]
|
||||
public ContentResult Upload()
|
||||
{
|
||||
var response = _ueditorService.UploadAndGetResponse(this.Request.HttpContext);
|
||||
return Content(response.Result, response.ContentType);
|
||||
}
|
||||
|
||||
}
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UEditor.Core;
|
||||
|
||||
namespace Hncore.Pass.OSS.Controllers
|
||||
{
|
||||
[Route("api/ueditor")]
|
||||
[AllowAnonymous]
|
||||
public class UEditorController : Controller
|
||||
{
|
||||
private readonly UEditorService _ueditorService;
|
||||
public UEditorController(UEditorService ueditorService)
|
||||
{
|
||||
this._ueditorService = ueditorService;
|
||||
}
|
||||
|
||||
[HttpGet, HttpPost]
|
||||
public ContentResult Upload()
|
||||
{
|
||||
var response = _ueditorService.UploadAndGetResponse(this.Request.HttpContext);
|
||||
return Content(response.Result, response.ContentType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user