480 lines
15 KiB
PHP
Executable File
480 lines
15 KiB
PHP
Executable File
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Licensed ( https://opensource.org/licenses/mit-license.php )
|
||
// +----------------------------------------------------------------------
|
||
// | Author: Devil
|
||
// +----------------------------------------------------------------------
|
||
namespace app\service;
|
||
|
||
use think\facade\Db;
|
||
use app\service\ResourcesService;
|
||
|
||
/**
|
||
* 配置服务层
|
||
* @author Devil
|
||
* @blog http://gong.gg/
|
||
* @version 0.0.1
|
||
* @datetime 2016-12-01T21:51:08+0800
|
||
*/
|
||
class ConfigService
|
||
{
|
||
// 富文本,不实例化的字段
|
||
public static $rich_text_list = [
|
||
'home_footer_info',
|
||
'common_email_currency_template',
|
||
'home_email_user_reg',
|
||
'home_email_user_forget_pwd',
|
||
'home_email_user_email_binding',
|
||
'home_site_close_reason',
|
||
'common_agreement_userregister',
|
||
'common_agreement_userprivacy',
|
||
'common_self_extraction_address',
|
||
'home_index_floor_top_right_keywords',
|
||
'home_index_floor_manual_mode_goods',
|
||
'home_index_floor_left_top_category',
|
||
'admin_email_login_template',
|
||
'home_email_login_template',
|
||
'home_site_security_record_url',
|
||
'layout_index_home_data',
|
||
];
|
||
|
||
// 附件字段列表
|
||
public static $attachment_field_list = [
|
||
'home_site_logo',
|
||
'home_site_logo_wap',
|
||
'home_site_desktop_icon',
|
||
'common_customer_store_qrcode',
|
||
'home_site_user_register_bg_images',
|
||
'home_site_user_login_ad1_images',
|
||
'home_site_user_login_ad2_images',
|
||
'home_site_user_login_ad3_images',
|
||
'home_site_user_forgetpwd_ad1_images',
|
||
'home_site_user_forgetpwd_ad2_images',
|
||
'home_site_user_forgetpwd_ad3_images',
|
||
];
|
||
|
||
// 字符串转数组字段列表, 默认使用英文逗号处理 [ , ]
|
||
public static $string_to_array_field_list = [
|
||
'common_images_verify_rules',
|
||
'home_user_login_type',
|
||
'home_user_reg_type',
|
||
'admin_login_type',
|
||
'home_search_params_type',
|
||
];
|
||
|
||
// 需要文件缓存的key
|
||
public static $file_cache_keys = [
|
||
// 伪静态后缀
|
||
'home_seo_url_html_suffix',
|
||
|
||
// 前端默认主题
|
||
'common_default_theme',
|
||
|
||
// 时区
|
||
'common_timezone',
|
||
|
||
// 是否开启redis缓存
|
||
'common_data_is_use_cache',
|
||
'common_cache_data_redis_host',
|
||
'common_cache_data_redis_port',
|
||
'common_cache_data_redis_password',
|
||
'common_cache_data_redis_expire',
|
||
'common_cache_data_redis_prefix',
|
||
|
||
// session是否开启redis缓存
|
||
'common_session_is_use_cache',
|
||
'common_cache_session_redis_prefix',
|
||
|
||
// cdn地址
|
||
'common_cdn_attachment_host',
|
||
'common_cdn_public_host',
|
||
|
||
// 编辑器配置信息
|
||
'home_max_limit_image',
|
||
'home_max_limit_video',
|
||
'home_max_limit_file',
|
||
];
|
||
|
||
/**
|
||
* 配置列表,唯一标记作为key
|
||
* @author Devil
|
||
* @blog http://gong.gg/
|
||
* @version 1.0.0
|
||
* @date 2018-12-07
|
||
* @desc description
|
||
* @param [array] $params [输入参数]
|
||
*/
|
||
public static function ConfigList($params = [])
|
||
{
|
||
$field = isset($params['field']) ? $params['field'] : 'only_tag,name,describe,value,error_tips';
|
||
$data = Db::name('Config')->column($field, 'only_tag');
|
||
if(!empty($data))
|
||
{
|
||
foreach($data as $k=>&$v)
|
||
{
|
||
// 字符串转数组
|
||
foreach(self::$string_to_array_field_list as $fv)
|
||
{
|
||
if($k == $fv)
|
||
{
|
||
$v['value'] = (!isset($v['value']) || $v['value'] == '' || is_array($v['value'])) ? [] : explode(',', $v['value']);
|