LogController.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Lottomat.Application.Busines.SystemManage;
  4. using Lottomat.Application.Code;
  5. using Lottomat.Util;
  6. using Lottomat.Util.WebControl;
  7. using System.Web.Mvc;
  8. using Lottomat.Application.Entity.SystemManage;
  9. using Lottomat.Util.Extension;
  10. namespace Lottomat.Application.Admin.Areas.SystemManage.Controllers
  11. {
  12. /// <summary>
  13. /// 版 本 1.0
  14. /// Copyright (c) 2016-2017
  15. /// 创建人:赵轶
  16. /// 日 期:2015.11.18 9:56
  17. /// 描 述:系统日志
  18. /// </summary>
  19. public class LogController : MvcControllerBase
  20. {
  21. #region 视图功能
  22. /// <summary>
  23. /// 日志管理
  24. /// </summary>
  25. /// <returns></returns>
  26. [HttpGet]
  27. [HandlerAuthorize(PermissionMode.Enforce)]
  28. public ActionResult Index()
  29. {
  30. return View();
  31. }
  32. /// <summary>
  33. /// 清空日志
  34. /// </summary>
  35. /// <returns></returns>
  36. [HttpGet]
  37. [HandlerAuthorize(PermissionMode.Enforce)]
  38. public ActionResult RemoveLog()
  39. {
  40. return View();
  41. }
  42. #endregion
  43. #region 获取数据
  44. /// <summary>
  45. /// 日志列表
  46. /// </summary>
  47. /// <param name="pagination">分页参数</param>
  48. /// <param name="queryJson">查询参数</param>
  49. /// <returns>返回分页列表Json</returns>
  50. [HttpGet]
  51. public ActionResult GetPageListJson(Pagination pagination, string queryJson)
  52. {
  53. var watch = CommonHelper.TimerStart();
  54. var data = new List<LogEntity>();
  55. string thisUser = OperatorProvider.Provider.Current().Account;
  56. if (thisUser != "System")
  57. {
  58. data = LogBLL.GetPageList(pagination, queryJson).Where(l => l.OperateAccount.Equals(thisUser)).ToList();
  59. }
  60. else
  61. {
  62. data = LogBLL.GetPageList(pagination, queryJson).ToList();
  63. }
  64. var JsonData = new
  65. {
  66. rows = data,
  67. total = pagination.total,
  68. page = pagination.page,
  69. records = pagination.records,
  70. costtime = CommonHelper.TimerEnd(watch)
  71. };
  72. return Content(JsonData.ToJson());
  73. }
  74. #endregion
  75. #region 提交数据
  76. /// <summary>
  77. /// 清空日志
  78. /// </summary>
  79. /// <param name="categoryId">日志分类Id</param>
  80. /// <param name="keepTime">保留时间段内</param>
  81. /// <returns></returns>
  82. [HttpPost]
  83. [ValidateAntiForgeryToken]
  84. [AjaxOnly]
  85. public ActionResult RemoveLog(int categoryId, string keepTime)
  86. {
  87. LogBLL.RemoveLog(categoryId, keepTime);
  88. return Success("清空成功。");
  89. }
  90. #endregion
  91. }
  92. }