using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Lottomat.Application.Code;
using Lottomat.Util;
namespace Lottomat.Application.Admin.Areas.SystemManage.Controllers
{
public class SystemConfigController : MvcControllerBase
{
//
// GET: /SystemManage/SystemConfig/
#region 视图功能
///
/// 系统配置管理
///
///
[HttpGet]
[HandlerAuthorize(PermissionMode.Enforce)]
public ActionResult Index()
{
return View();
}
///
/// 抓取彩票开奖号地址配置管理
///
///
[HttpGet]
[HandlerAuthorize(PermissionMode.Enforce)]
public ActionResult LotteryIndex()
{
return View();
}
///
/// 接口缓存管理
///
///
[HttpGet]
[HandlerAuthorize(PermissionMode.Enforce)]
public ActionResult ApiCacheIndex()
{
return View();
}
#endregion
#region
///
/// 保存配置
///
///
///
///
[AjaxOnly(true)]
[HttpPost]
public ActionResult SaveConfig(string key, string value)
{
if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
{
ConfigHelper.SetValue(key, value);
}
else
{
return Error("值不能为空");
}
return Success("保存成功");
}
///
/// 获取配置
///
///
///
[AjaxOnly(true)]
[HttpPost]
public ActionResult GetConfigByKey(string key)
{
string res = String.Empty;
if (!string.IsNullOrEmpty(key))
{
res = ConfigHelper.GetValue("__" + key + "__URL__") + "^"+ ConfigHelper.GetValue("__" + key + "__XPATH__");
}
else
{
return Error("Key值不能为空");
}
return Success("提取成功", res);
}
#endregion
}
}