using Learun.Application.Extention.PortalSiteManage;
using Learun.Util;
using System.Web.Mvc;
namespace Learun.Application.Website.Controllers
{
///
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创建人:力软-框架开发组
/// 日 期:2018.12.25
/// 描 述:主页控制器
///
public class HomeController : MvcControllerBase
{
private HomeConfigIBLL homeConfigIBLL = new HomeConfigBLL();
private ArticleIBLL articleIBLL = new ArticleBLL();
private PageIBLL pageIBLL = new PageBLL();
#region 视图功能
///
/// 首页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 子页面
///
///
[HttpGet]
public ActionResult ChildIndex()
{
return View();
}
///
/// 列表页面
///
///
[HttpGet]
public ActionResult ListIndex()
{
return View();
}
///
/// 图表页面
///
///
[HttpGet]
public ActionResult ImgListIndex()
{
return View();
}
///
/// 详情页面
///
///
[HttpGet]
public ActionResult DetailIndex()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取全部数据
///
///
[HttpGet]
public ActionResult GetAllList()
{
var data = homeConfigIBLL.GetALLList();
return Success(data);
}
///
/// 获取数据
///
///
[HttpGet]
public ActionResult GetList(string type)
{
var data = homeConfigIBLL.GetList(type);
return Success(data);
}
///
/// 获取表单数据
/// 主键
///
///
[HttpGet]
public ActionResult GetPageData(string keyValue)
{
var data = pageIBLL.GetEntity(keyValue);
return Success(data);
}
#endregion
#region 扩展功能
///
/// 获取设置图片
///
/// 类型
///
[HttpGet]
public ActionResult GetImg(string type)
{
homeConfigIBLL.GetImg(type);
return Success("获取成功。");
}
///
/// 获取设置图片
///
/// 主键
///
[HttpGet]
public ActionResult GetImg2(string keyValue)
{
homeConfigIBLL.GetImg2(keyValue);
return Success("获取成功。");
}
///
/// 获取设置图片
///
/// 主键
///
[HttpGet]
public ActionResult GetArticleImg(string keyValue)
{
articleIBLL.GetImg(keyValue);
return Success("获取成功。");
}
///
/// 获取表单数据
/// 主键
///
///
[HttpGet]
public ActionResult GetArticle(string keyValue)
{
var data = articleIBLL.GetEntity(keyValue);
return Success(data);
}
///
/// 获取列表分页数据
/// 分页参数
///
///
[HttpGet]
public ActionResult GetArticlePageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = articleIBLL.GetPageList(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取设置图片
///
/// 主键
///
[HttpGet]
public ActionResult GetPageImg(string keyValue)
{
pageIBLL.GetImg2(keyValue);
return Success("获取成功。");
}
///
/// 获取设置图片
///
/// 主键
///
[HttpGet]
public ActionResult GetUeditorImg(string id)
{
string path = Config.GetValue("imgPath")+ "/ueditor/upload/image"+ id;
path = System.Text.RegularExpressions.Regex.Replace(path, @"\s", "");
if (FileDownHelper.FileExists(path))
{
FileDownHelper.DownLoadold(path, id.Split('/')[2]);
}
return Success("获取成功");
}
#endregion
}
}