增加扩展机制定位文件;将common模块实现扩展模式;发布新版本;

This commit is contained in:
2023-09-25 17:07:38 +08:00
parent 3dcf336bbc
commit 184dae8185
65 changed files with 3093 additions and 2751 deletions

View File

@@ -5,6 +5,7 @@
use app\commno\exception\EventException;
use app\common\service\AuthService;
use think\exception\HttpResponseException;
use think\facade\App;
use think\facade\Cache;
use think\facade\Env;
use think\facade\Event;
@@ -306,3 +307,19 @@ function event_response($name, $params = [])
throw new HttpResponseException($response);
}
/**
* 以扩展的架构定位app下的文件位置
*
* @param string $file_path 文件路径,不要以/开头不需要以app开头会自动定位app或extend/base。
* @return string
*/
function app_file_path($file_path)
{
$app_file_path = App::getRootPath() . 'app' . DIRECTORY_SEPARATOR . $file_path;
if (!is_file($app_file_path)) {
$app_file_path = App::getRootPath() . 'extend' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . $file_path;
}
return $app_file_path;
}