You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

198 lines
5.6 KiB

  1. using Learun.Application.Extention.PortalSiteManage;
  2. using Learun.Util;
  3. using System.Web.Mvc;
  4. namespace Learun.Application.Website.Controllers
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
  8. /// Copyright (c) 2013-2018 上海力软信息技术有限公司
  9. /// 创建人:力软-框架开发组
  10. /// 日 期:2018.12.25
  11. /// 描 述:主页控制器
  12. /// </summary>
  13. public class HomeController : MvcControllerBase
  14. {
  15. private HomeConfigIBLL homeConfigIBLL = new HomeConfigBLL();
  16. private ArticleIBLL articleIBLL = new ArticleBLL();
  17. private PageIBLL pageIBLL = new PageBLL();
  18. #region 视图功能
  19. /// <summary>
  20. /// 首页面
  21. /// </summary>
  22. /// <returns></returns>
  23. [HttpGet]
  24. public ActionResult Index()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 子页面
  30. /// </summary>
  31. /// <returns></returns>
  32. [HttpGet]
  33. public ActionResult ChildIndex()
  34. {
  35. return View();
  36. }
  37. /// <summary>
  38. /// 列表页面
  39. /// </summary>
  40. /// <returns></returns>
  41. [HttpGet]
  42. public ActionResult ListIndex()
  43. {
  44. return View();
  45. }
  46. /// <summary>
  47. /// 图表页面
  48. /// </summary>
  49. /// <returns></returns>
  50. [HttpGet]
  51. public ActionResult ImgListIndex()
  52. {
  53. return View();
  54. }
  55. /// <summary>
  56. /// 详情页面
  57. /// </summary>
  58. /// <returns></returns>
  59. [HttpGet]
  60. public ActionResult DetailIndex()
  61. {
  62. return View();
  63. }
  64. #endregion
  65. #region 获取数据
  66. /// <summary>
  67. /// 获取全部数据
  68. /// <summary>
  69. /// <returns></returns>
  70. [HttpGet]
  71. public ActionResult GetAllList()
  72. {
  73. var data = homeConfigIBLL.GetALLList();
  74. return Success(data);
  75. }
  76. /// <summary>
  77. /// 获取数据
  78. /// <summary>
  79. /// <returns></returns>
  80. [HttpGet]
  81. public ActionResult GetList(string type)
  82. {
  83. var data = homeConfigIBLL.GetList(type);
  84. return Success(data);
  85. }
  86. /// <summary>
  87. /// 获取表单数据
  88. /// <param name="keyValue">主键</param>
  89. /// <summary>
  90. /// <returns></returns>
  91. [HttpGet]
  92. public ActionResult GetPageData(string keyValue)
  93. {
  94. var data = pageIBLL.GetEntity(keyValue);
  95. return Success(data);
  96. }
  97. #endregion
  98. #region 扩展功能
  99. /// <summary>
  100. /// 获取设置图片
  101. /// </summary>
  102. /// <param name="type">类型</param>
  103. /// <returns></returns>
  104. [HttpGet]
  105. public ActionResult GetImg(string type)
  106. {
  107. homeConfigIBLL.GetImg(type);
  108. return Success("获取成功。");
  109. }
  110. /// <summary>
  111. /// 获取设置图片
  112. /// </summary>
  113. /// <param name="keyValue">主键</param>
  114. /// <returns></returns>
  115. [HttpGet]
  116. public ActionResult GetImg2(string keyValue)
  117. {
  118. homeConfigIBLL.GetImg2(keyValue);
  119. return Success("获取成功。");
  120. }
  121. /// <summary>
  122. /// 获取设置图片
  123. /// </summary>
  124. /// <param name="keyValue">主键</param>
  125. /// <returns></returns>
  126. [HttpGet]
  127. public ActionResult GetArticleImg(string keyValue)
  128. {
  129. articleIBLL.GetImg(keyValue);
  130. return Success("获取成功。");
  131. }
  132. /// <summary>
  133. /// 获取表单数据
  134. /// <param name="keyValue">主键</param>
  135. /// <summary>
  136. /// <returns></returns>
  137. [HttpGet]
  138. public ActionResult GetArticle(string keyValue)
  139. {
  140. var data = articleIBLL.GetEntity(keyValue);
  141. return Success(data);
  142. }
  143. /// <summary>
  144. /// 获取列表分页数据
  145. /// <param name="pagination">分页参数</param>
  146. /// <summary>
  147. /// <returns></returns>
  148. [HttpGet]
  149. public ActionResult GetArticlePageList(string pagination, string queryJson)
  150. {
  151. Pagination paginationobj = pagination.ToObject<Pagination>();
  152. var data = articleIBLL.GetPageList(paginationobj, queryJson);
  153. var jsonData = new
  154. {
  155. rows = data,
  156. total = paginationobj.total,
  157. page = paginationobj.page,
  158. records = paginationobj.records
  159. };
  160. return Success(jsonData);
  161. }
  162. /// <summary>
  163. /// 获取设置图片
  164. /// </summary>
  165. /// <param name="keyValue">主键</param>
  166. /// <returns></returns>
  167. [HttpGet]
  168. public ActionResult GetPageImg(string keyValue)
  169. {
  170. pageIBLL.GetImg2(keyValue);
  171. return Success("获取成功。");
  172. }
  173. /// <summary>
  174. /// 获取设置图片
  175. /// </summary>
  176. /// <param name="keyValue">主键</param>
  177. /// <returns></returns>
  178. [HttpGet]
  179. public ActionResult GetUeditorImg(string id)
  180. {
  181. string path = Config.GetValue("imgPath")+ "/ueditor/upload/image"+ id;
  182. path = System.Text.RegularExpressions.Regex.Replace(path, @"\s", "");
  183. if (FileDownHelper.FileExists(path))
  184. {
  185. FileDownHelper.DownLoadold(path, id.Split('/')[2]);
  186. }
  187. return Success("获取成功");
  188. }
  189. #endregion
  190. }
  191. }