| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using Microsoft.AspNetCore.Mvc;
- using Common;
- using Services;
- using Infrastructure;
- namespace Controllers.Client
- {
- /// <summary>
- /// User)Controller
- /// </summary>
- // [ApiExplorerSettings(GroupName = "User")]
- public class UploadController : BaseController
- {
- private readonly IUploadService _UploadService;
- public UploadController(IUploadService UploadService)
- {
- _UploadService = UploadService;
- }
- /// <summary>
- /// 上传图片
- /// </summary>
- /// <param name="file">文件对象</param>
- /// <returns>上传图片</returns>
- [HttpPut]
- [Route("/v1/omega_upload/uploadImage")]
- public IActionResult uploadImage(IFormFile file)
- {
- string path = _UploadService.getPicPath(file);
- Dictionary<string, string> obj = new();
- var option = App.OptionsSetting;
- obj.Add("uploadUrl", option.Upload.UploadUrl + path);
- obj.Add("saveUrl", path);
- return SUCCESS(obj);
- }
- /// <summary>
- /// 上传文件
- /// </summary>
- /// <param name="file">文件对象</param>
- /// <returns>上传文件</returns>
- [HttpPut]
- [Route("/v1/omega_upload/uploadfile")]
- public IActionResult uploadFile(IFormFile file)
- {
- string path = _UploadService.getPicPath(file);
- Dictionary<string, string> obj = new();
- var option = App.OptionsSetting;
- obj.Add("uploadUrl", option.Upload.UploadUrl + path);
- obj.Add("saveUrl", path);
- return SUCCESS(obj);
- }
- }
- }
|