SystemConfigController.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Lottomat.Application.Code;
  7. using Lottomat.Util;
  8. namespace Lottomat.Application.Admin.Areas.SystemManage.Controllers
  9. {
  10. public class SystemConfigController : MvcControllerBase
  11. {
  12. //
  13. // GET: /SystemManage/SystemConfig/
  14. #region 视图功能
  15. /// <summary>
  16. /// 系统配置管理
  17. /// </summary>
  18. /// <returns></returns>
  19. [HttpGet]
  20. [HandlerAuthorize(PermissionMode.Enforce)]
  21. public ActionResult Index()
  22. {
  23. return View();
  24. }
  25. /// <summary>
  26. /// 抓取彩票开奖号地址配置管理
  27. /// </summary>
  28. /// <returns></returns>
  29. [HttpGet]
  30. [HandlerAuthorize(PermissionMode.Enforce)]
  31. public ActionResult LotteryIndex()
  32. {
  33. return View();
  34. }
  35. /// <summary>
  36. /// 接口缓存管理
  37. /// </summary>
  38. /// <returns></returns>
  39. [HttpGet]
  40. [HandlerAuthorize(PermissionMode.Enforce)]
  41. public ActionResult ApiCacheIndex()
  42. {
  43. return View();
  44. }
  45. #endregion
  46. #region
  47. /// <summary>
  48. /// 保存配置
  49. /// </summary>
  50. /// <param name="key"></param>
  51. /// <param name="value"></param>
  52. /// <returns></returns>
  53. [AjaxOnly(true)]
  54. [HttpPost]
  55. public ActionResult SaveConfig(string key, string value)
  56. {
  57. if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
  58. {
  59. ConfigHelper.SetValue(key, value);
  60. }
  61. else
  62. {
  63. return Error("值不能为空");
  64. }
  65. return Success("保存成功");
  66. }
  67. /// <summary>
  68. /// 获取配置
  69. /// </summary>
  70. /// <param name="key"></param>
  71. /// <returns></returns>
  72. [AjaxOnly(true)]
  73. [HttpPost]
  74. public ActionResult GetConfigByKey(string key)
  75. {
  76. string res = String.Empty;
  77. if (!string.IsNullOrEmpty(key))
  78. {
  79. res = ConfigHelper.GetValue("__" + key + "__URL__") + "^"+ ConfigHelper.GetValue("__" + key + "__XPATH__");
  80. }
  81. else
  82. {
  83. return Error("Key值不能为空");
  84. }
  85. return Success("提取成功", res);
  86. }
  87. #endregion
  88. }
  89. }