新增web端PC访问关闭开关

This commit is contained in:
gongfuxiang 2022-01-26 01:01:32 +08:00
parent e362a035cd
commit cd6c7927e4
4 changed files with 25 additions and 39 deletions

View File

@ -84,10 +84,18 @@
</select>
</div>
<div class="am-form-group">
<label>{{$data.home_site_web_state.name}}<span class="am-form-group-label-tips">{{$data.home_site_web_state.describe}}</span></label>
<select name="{{$data.home_site_web_state.only_tag}}" class="am-radius chosen-select" data-validation-message="{{$data.home_site_web_state.error_tips}}" required>
<label>{{$data.home_site_web_home_state.name}}<span class="am-form-group-label-tips">{{$data.home_site_web_home_state.describe}}</span></label>
<select name="{{$data.home_site_web_home_state.only_tag}}" class="am-radius chosen-select" data-validation-message="{{$data.home_site_web_home_state.error_tips}}" required>
{{foreach $common_close_open_list as $v}}
<option value="{{$v.value}}" {{if isset($data['home_site_web_state']['value']) and $data['home_site_web_state']['value'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
<option value="{{$v.value}}" {{if isset($data['home_site_web_home_state']['value']) and $data['home_site_web_home_state']['value'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</div>
<div class="am-form-group">
<label>{{$data.home_site_web_pc_state.name}}<span class="am-form-group-label-tips">{{$data.home_site_web_pc_state.describe}}</span></label>
<select name="{{$data.home_site_web_pc_state.only_tag}}" class="am-radius chosen-select" data-validation-message="{{$data.home_site_web_pc_state.error_tips}}" required>
{{foreach $common_close_open_list as $v}}
<option value="{{$v.value}}" {{if isset($data['home_site_web_pc_state']['value']) and $data['home_site_web_pc_state']['value'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</div>

View File

@ -96,6 +96,12 @@ class Common extends BaseController
// 站点状态校验
$this->SiteStstusCheck();
// web端pc访问状态
if(!IsMobile())
{
$this->SiteStstusCheck('_web_pc');
}
// 公共数据初始化
$this->CommonInit();
@ -395,43 +401,13 @@ class Common extends BaseController
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-12-08
* @date 2022-01-26
* @desc description
* @param [string] $type [web端首页 _web_home , web端PC访问 _web_pc]
*/
private function SiteStstusCheck()
protected function SiteStstusCheck($type = '')
{
if(MyC('home_site_state') != 1)
{
// 提示信息
$reason = MyC('home_site_close_reason', '升级中...', true);
// 是否ajax请求
if(IS_AJAX)
{
exit(json_encode(DataReturn($reason, -10000)));
} else {
// 默认提示信息增加样式,则使用用户自定义信息展示
if($reason == '升级中...')
{
exit('<!DOCTYPE html><html><head><meta charset="utf-8" /><title>'.MyC('home_site_name').'</title><body><div style="text-align: center;margin-top: 15%;font-size: 18px;color: #f00;">'.$reason.'</div></body></html>');
} else {
exit($reason);
}
}
}
}
/**
* 站点状态校验 - web端
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-12-08
* @desc description
*/
public function SiteWebStstusCheck()
{
if(MyC('home_site_web_state') != 1)
if(MyC('home_site'.$type.'_state') != 1)
{
// 提示信息
$reason = MyC('home_site_close_reason', '升级中...', true);

View File

@ -44,7 +44,7 @@ class Index extends Common
parent::__construct();
// web端首页状态
$this->SiteWebStstusCheck();
$this->SiteStstusCheck('_web_home');
}
/**

View File

@ -97,7 +97,9 @@ class SystemBaseService
'home_site_logo' => ResourcesService::AttachmentPathViewHandle(MyC('home_site_logo')),
'home_site_logo_wap' => ResourcesService::AttachmentPathViewHandle(MyC('home_site_logo_wap')),
'home_site_logo_square' => ResourcesService::AttachmentPathViewHandle(MyC('home_site_logo_square')),
'home_site_state' => (int) MyC('home_site_state', 0, true),
'home_site_state' => (int) MyC('home_site_state', 1),
'home_site_web_home_state' => (int) MyC('home_site_web_home_state', 1),
'home_site_web_pc_state' => (int) MyC('home_site_web_pc_state', 1),
'home_site_close_reason' => MyC('home_site_close_reason', null, true),
// 备案信息