Files
fast_response/front/application/api/controller/BaseCommonController.php
2025-03-17 11:27:07 +08:00

72 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/*
* description
* authorwh
* 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
*
* authorwh
*/
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'=>'服务运行中'];
}
}