fixed
This commit is contained in:
72
front/application/api/controller/BaseCommonController.php
Normal file
72
front/application/api/controller/BaseCommonController.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*
|
||||
* description:
|
||||
* author:wh
|
||||
* email:
|
||||
* createTime:{2023/1/21} {16:22}
|
||||
*/
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\common\model\TabConf;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\Request;
|
||||
use wanghua\general_utility_tools_php\framework\BaseController;
|
||||
use wanghua\general_utility_tools_php\tool\Tools;
|
||||
|
||||
class BaseCommonController extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* desc:检查路径维护状态
|
||||
*
|
||||
* “===”完全匹配,不能使用like
|
||||
*
|
||||
* author:wh
|
||||
*/
|
||||
protected function checkMaintain(){
|
||||
|
||||
$configs = Db::table(TabConf::$fa_sys_maintain_config)
|
||||
->where('status','1')
|
||||
->cache()
|
||||
->select();
|
||||
|
||||
//模块
|
||||
$strmodule = request()->module();
|
||||
foreach ($configs as $config){
|
||||
if($strmodule == $config['url']){
|
||||
//模块维护中
|
||||
return ['is_maintain'=>true,'msg'=>$config['msg'],'openid'=>$config['openid']];
|
||||
}
|
||||
}
|
||||
|
||||
//模块/控制器
|
||||
$strcontroller = strtolower(request()->module().'/'.request()->controller());
|
||||
foreach ($configs as $config){
|
||||
if($strcontroller == $config['url']){
|
||||
//模块维护中
|
||||
return ['is_maintain'=>true,'msg'=>$config['msg'],'openid'=>$config['openid']];
|
||||
}
|
||||
}
|
||||
|
||||
//模块/控制器/方法
|
||||
$straction = strtolower(request()->module().'/'.request()->controller().'/'.request()->action());
|
||||
foreach ($configs as $config){
|
||||
if($straction == $config['url']){
|
||||
//模块维护中
|
||||
return ['is_maintain'=>true,'msg'=>$config['msg'],'openid'=>$config['openid']];
|
||||
}
|
||||
}
|
||||
|
||||
//未维护
|
||||
return ['is_maintain'=>false,'msg'=>'服务运行中'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user