51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
namespace YLErp.Web.Controllers
|
|
{
|
|
public class ConfirmBookManageController : BaseController
|
|
{
|
|
[MyAuthorize("系统管理-交易权限")]
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public JsonResult UploadFiles()
|
|
{
|
|
try
|
|
{
|
|
foreach (var file in Request.Form.Files)
|
|
{
|
|
string filePath = Server.MapPath("~/App_Docs");
|
|
if (!Directory.Exists(filePath))
|
|
{
|
|
Directory.CreateDirectory(filePath);
|
|
}
|
|
file.SaveAs(Path.Combine(filePath, file.FileName));
|
|
}
|
|
|
|
return JsonSuccess("上传成功!");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogFactory.GetLogger<ConfirmBookManageController>().Error("上传交易确认书模板失败失败!", ex);
|
|
return JsonError("上传失败");
|
|
}
|
|
}
|
|
|
|
public JsonResult DownFile(string fileName)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(fileName))
|
|
{
|
|
return JsonError("请选择下载的模板");
|
|
}
|
|
string templateDir = Server.MapPath("~/App_Docs");
|
|
|
|
var filePath = Path.Combine(templateDir, fileName);
|
|
if (!System.IO.File.Exists(filePath))
|
|
{
|
|
return JsonError("未上传该模板!");
|
|
}
|
|
|
|
return Json(filePath);
|
|
}
|
|
}
|
|
} |