Skip to content

Commit

Permalink
合并配置页面
Browse files Browse the repository at this point in the history
  • Loading branch information
kitesky committed Jun 28, 2019
1 parent 8de4cec commit cf31a51
Show file tree
Hide file tree
Showing 6 changed files with 857 additions and 156 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KiteCMS开源网站内容管理系统,系统基于框架ThinkPHP5.1.x版本开发,适用个人、企业快速建站及开发需求
KiteCMS系统基于Thinkphp 5.1.37 版本开发,真正的开源免费,可以用于商业目的,无需任何授权。后续会不断的完善优化系统,开发更多实用的模块,插件,模板。

##### 运行环境
> 运行环境 Apache/Nginx + PHP + MySQL
Expand Down Expand Up @@ -48,6 +48,4 @@ KiteCMS开源网站内容管理系统,系统基于框架ThinkPHP5.1.x版本开
* [API接口](https://www.kancloud.cn/kite/book/710882)

如果您对CMS系统不熟悉,可以查看帮助文档。如果您需要模板制作,可以参考模板标签调用方法。
更多文档资料: [开发使用文档](https://www.kancloud.cn/kite/book/1136594)


更多文档资料: [文档资料](https://www.kancloud.cn/kite/book/1136594)
143 changes: 16 additions & 127 deletions application/admin/controller/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class Site extends Admin
{
public function email()
public function config()
{
// 处理AJAX提交数据
if (Request::isAjax()) {
Expand All @@ -31,136 +31,25 @@ public function email()
}
}

$config = Config::get('site.email');
$data = SiteConfig::getAll($this->site_id, $config);

return $this->fetch('email', $data);
}

public function sms()
{
// 处理AJAX提交数据
if (Request::isAjax()) {
$request = Request::param();

foreach ($request as $k => $v) {
$res = SiteConfig::saveCofig($this->site_id, $k, $v);
}

if (is_numeric($res)) {
return $this->response(200, Lang::get('Success'));
} else {
return $this->response(201, Lang::get('Fail'));
}
}

$config = Config::get('site.sms');
$data = SiteConfig::getAll($this->site_id, $config);

return $this->fetch('sms', $data);
}

public function captcha()
{
// 处理AJAX提交数据
if (Request::isAjax()) {
$request = Request::param();

foreach ($request as $k => $v) {
$res = SiteConfig::saveCofig($this->site_id, $k, $v);
}

if (is_numeric($res)) {
return $this->response(200, Lang::get('Success'));
} else {
return $this->response(201, Lang::get('Fail'));
}
}

$config = Config::get('site.captcha');
$data = SiteConfig::getAll($this->site_id, $config);

return $this->fetch('captcha', $data);
}

public function imageWater()
{
// 处理AJAX提交数据
if (Request::isAjax()) {
$request = Request::param();

foreach ($request as $k => $v) {
$res = SiteConfig::saveCofig($this->site_id, $k, $v);
}

if (is_numeric($res)) {
return $this->response(200, Lang::get('Success'));
} else {
return $this->response(201, Lang::get('Fail'));
}
}

$config = Config::get('site.imageWater');
$data = SiteConfig::getAll($this->site_id, $config);

return $this->fetch('image_water', $data);
}

public function uploadFile()
{
// 处理AJAX提交数据
if (Request::isAjax()) {
$request = Request::param();

foreach ($request as $k => $v) {
$res = SiteConfig::saveCofig($this->site_id, $k, $v);
}

if (is_numeric($res)) {
return $this->response(200, Lang::get('Success'));
} else {
return $this->response(201, Lang::get('Fail'));
}
}

$config = Config::get('site.uploadFile');
$data = SiteConfig::getAll($this->site_id, $config);

return $this->fetch('upload_file', $data);
}

public function info()
{
// 处理AJAX提交数据
if (Request::isAjax()) {
$request = Request::param();

// 验证数据
$validate = new SiteValidate();
$validateResult = $validate->scene('edit')->check($request);
if (!$validateResult) {
return $this->response(201, $validate->getError());
}

$siteObj = new SiteModel;
$siteObj->isUpdate(true)->allowField(true)->save($request);

if (is_numeric($siteObj->id)) {
return $this->response(200, Lang::get('Success'));
} else {
return $this->response(201, Lang::get('Fail'));
}
}
$config_menu = [
'email' => Lang::get('Email'),
'sms' => Lang::get('Sms'),
'captcha' => Lang::get('Captcha'),
'imageWater' => Lang::get('Watermarking'),
'uploadFile' => Lang::get('Upload'),
'memberScore'=> Lang::get('Score'),
];
$config_name = Request::param('config_name', 'email');
$config = Config::get('site.' . $config_name);
$config_option = SiteConfig::getAll($this->site_id, $config);

$info = SiteModel::get($this->site_id);
$data = [
'info' => $info,
'timezone' => isset($info['timezone']) ? $info['timezone'] : date_default_timezone_get(),
'timezone_list' => timezone_identifiers_list(),
'theme' => $this->getThemeList(),
'config_name' => $config_name,
'config_menu' => $config_menu,
'config_option' => $config_option,
];

return $this->fetch('info', $data);
return $this->fetch('config', $data);
}

public function edit()
Expand Down
Loading

0 comments on commit cf31a51

Please sign in to comment.