协议管理优化
parent
cfcd94cf96
commit
1fcaa327df
|
|
@ -11,7 +11,7 @@
|
|||
namespace app\api\controller;
|
||||
|
||||
use app\service\ApiService;
|
||||
use app\service\SystemBaseService;
|
||||
use app\service\AgreementService;
|
||||
|
||||
/**
|
||||
* 协议
|
||||
|
|
@ -45,7 +45,7 @@ class Agreement extends Common
|
|||
*/
|
||||
public function Index()
|
||||
{
|
||||
return ApiService::ApiDataReturn(SystemBaseService::AgreementData($this->data_request));
|
||||
return ApiService::ApiDataReturn(AgreementService::AgreementData($this->data_request));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -10,8 +10,8 @@
|
|||
// +----------------------------------------------------------------------
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\service\ConfigService;
|
||||
use app\service\SeoService;
|
||||
use app\service\AgreementService;
|
||||
|
||||
/**
|
||||
* 协议
|
||||
|
|
@ -52,15 +52,18 @@ class Agreement extends Common
|
|||
$data = [];
|
||||
if(!empty($params['document']))
|
||||
{
|
||||
$key = 'common_agreement_'.$params['document'];
|
||||
$ret = ConfigService::ConfigContentRow($key);
|
||||
// 获取协议内容
|
||||
$ret = AgreementService::AgreementData($params);
|
||||
|
||||
// 浏览器标题
|
||||
if(!empty($ret['data']['name']))
|
||||
if(!empty($ret['data']))
|
||||
{
|
||||
MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle($ret['data']['name']));
|
||||
if(!empty($ret['data']['name']))
|
||||
{
|
||||
MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle($ret['data']['name']));
|
||||
}
|
||||
$data = $ret['data'];
|
||||
}
|
||||
$data = $ret['data'];
|
||||
}
|
||||
|
||||
// 是否仅展示内容
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
<?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 app\service\ConfigService;
|
||||
|
||||
/**
|
||||
* 协议服务层
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-07-25
|
||||
* @desc description
|
||||
*/
|
||||
class AgreementService
|
||||
{
|
||||
/**
|
||||
* 协议数据
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-04-25
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function AgreementData($params = [])
|
||||
{
|
||||
// 请求参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'document',
|
||||
'error_msg' => '协议文档类型有误',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 获取内容
|
||||
return ConfigService::ConfigContentRow('common_agreement_'.$params['document']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -22,25 +22,30 @@ use app\service\ResourcesService;
|
|||
*/
|
||||
class ConfigService
|
||||
{
|
||||
// 不参与缓存的配置
|
||||
public static $not_cache_field_list = [
|
||||
'common_agreement_userregister',
|
||||
'common_agreement_userprivacy',
|
||||
];
|
||||
|
||||
// 富文本,不实例化的字段
|
||||
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',
|
||||
];
|
||||
'common_agreement_userregister',
|
||||
'common_agreement_userprivacy',
|
||||
'common_email_currency_template',
|
||||
'home_footer_info',
|
||||
'home_email_user_reg',
|
||||
'home_email_user_forget_pwd',
|
||||
'home_email_user_email_binding',
|
||||
'home_site_close_reason',
|
||||
'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',
|
||||
];
|
||||
|
||||
// 附件字段列表
|
||||
public static $attachment_field_list = [
|
||||
|
|
@ -186,6 +191,7 @@ class ConfigService
|
|||
|
||||
// 单条配置缓存删除
|
||||
MyCache($k, null);
|
||||
MyCache($k.'_row_data', null);
|
||||
}
|
||||
}
|
||||
if($success > 0)
|
||||
|
|
@ -265,6 +271,12 @@ class ConfigService
|
|||
// 数据处理
|
||||
foreach($data as $k=>&$v)
|
||||
{
|
||||
// 不参与缓存的配置
|
||||
if(in_array($k, self::$not_cache_field_list))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 富文本字段处理
|
||||
if(in_array($k, self::$rich_text_list))
|
||||
{
|
||||
|
|
@ -361,7 +373,8 @@ class ConfigService
|
|||
*/
|
||||
public static function ConfigContentRow($key)
|
||||
{
|
||||
$data = MyCache($key);
|
||||
$cache_key = $key.'_row_data';
|
||||
$data = MyCache($cache_key);
|
||||
if($data === null)
|
||||
{
|
||||
$data = Db::name('Config')->where(['only_tag'=>$key])->field('name,value,type,upd_time')->find();
|
||||
|
|
@ -376,7 +389,7 @@ class ConfigService
|
|||
} else {
|
||||
$data = [];
|
||||
}
|
||||
MyCache($key, $data);
|
||||
MyCache($cache_key, $data);
|
||||
}
|
||||
|
||||
return DataReturn('操作成功', 0, $data);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ use think\facade\Db;
|
|||
use app\service\ResourcesService;
|
||||
use app\service\QuickNavService;
|
||||
use app\service\PluginsService;
|
||||
use app\service\ConfigService;
|
||||
|
||||
/**
|
||||
* 系统基础公共信息服务层
|
||||
|
|
@ -445,35 +444,6 @@ class SystemBaseService
|
|||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 协议数据
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-04-25
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function AgreementData($params = [])
|
||||
{
|
||||
// 请求参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'document',
|
||||
'error_msg' => '协议文档类型有误',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 获取内容
|
||||
return ConfigService::ConfigContentRow('common_agreement_'.$params['document']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件地址
|
||||
* @author Devil
|
||||
|
|
|
|||
Loading…
Reference in New Issue