vr-shopxo-source/application/admin/controller/Config.php

136 lines
3.1 KiB
PHP
Raw Normal View History

2018-12-28 10:58:37 +00:00
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
2021-03-16 02:34:52 +00:00
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
2018-12-28 10:58:37 +00:00
// +----------------------------------------------------------------------
2021-03-16 02:34:52 +00:00
// | Licensed ( https://opensource.org/licenses/mit-license.php )
2018-12-28 10:58:37 +00:00
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\service\ConfigService;
2018-12-28 10:58:37 +00:00
/**
* 配置设置
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class Config extends Common
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public function __construct()
{
// 调用父类前置方法
parent::__construct();
// 登录校验
2019-02-12 03:46:46 +00:00
$this->IsLogin();
2018-12-28 10:58:37 +00:00
// 权限校验
2019-02-12 03:46:46 +00:00
$this->IsPower();
2018-12-28 10:58:37 +00:00
}
/**
2019-04-09 10:28:48 +00:00
* 后台配置
2018-12-28 10:58:37 +00:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
*/
public function Index()
{
2020-07-01 14:46:52 +00:00
// 静态数据
2018-12-28 10:58:37 +00:00
$this->assign('common_excel_charset_list', lang('common_excel_charset_list'));
2020-07-01 14:46:52 +00:00
$this->assign('common_is_enable_list', lang('common_is_enable_list'));
$this->assign('common_login_type_list', lang('common_login_type_list'));
$this->assign('common_close_open_list', lang('common_close_open_list'));
2018-12-28 10:58:37 +00:00
// 配置信息
$this->assign('data', ConfigService::ConfigList());
2021-03-16 02:34:52 +00:00
$this->assign('view_type', 'index');
2018-12-28 10:58:37 +00:00
return $this->fetch();
}
/**
2019-04-09 10:28:48 +00:00
* 商店信息
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
*/
public function Store()
{
// 配置信息
$this->assign('data', ConfigService::ConfigList());
2021-03-16 02:34:52 +00:00
$this->assign('view_type', 'store');
2019-04-09 10:28:48 +00:00
return $this->fetch();
}
/**
* 配置数据保存
2018-12-28 10:58:37 +00:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-02T23:08:19+0800
*/
public function Save()
{
// 参数
$params = $_POST;
// 字段不存在赋值
2021-03-16 02:34:52 +00:00
$empty_value_field_list = [];
// 页面类型
$view_type = empty($this->data_request['view_type']) ? 'index' : $this->data_request['view_type'];
switch($view_type)
{
case 'store' :
$empty_value_field_list['common_customer_store_qrcode'] = '';
break;
}
// 空字段处理
if(!empty($empty_value_field_list))
{
foreach($empty_value_field_list as $fk=>$fv)
{
if(!isset($params[$fk]))
{
$params[$fk] = $fv;
}
}
}
// 默认值字段处理
$default_value_field_list = [
'admin_login_type'=>'username',
];
if(!empty($default_value_field_list))
2019-04-09 10:28:48 +00:00
{
foreach($default_value_field_list as $fk=>$fv)
{
if(empty($params[$fk]))
{
$params[$fk] = $fv;
}
}
2019-04-09 10:28:48 +00:00
}
// 保存
return ConfigService::ConfigSave($params);
2018-12-28 10:58:37 +00:00
}
}
?>