| xqd
@@ -1,86 +0,0 @@
|
|
|
-<?php
|
|
|
-namespace App;
|
|
|
-/**
|
|
|
- * Created by PhpStorm.
|
|
|
- * User: 思维定制
|
|
|
- * Date: 2019/3/20
|
|
|
- * Time: 11:20
|
|
|
- */
|
|
|
-define('HOME_ROOT', dirname(__FILE__));
|
|
|
-
|
|
|
-
|
|
|
-class Furniture
|
|
|
-{
|
|
|
-
|
|
|
- public static $currentItems = [];
|
|
|
-
|
|
|
- public function __construct()
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 解析路由
|
|
|
- *
|
|
|
- * 后台访问 /web/index.php?c=site&a=entry&m=sz_yi&do=xxx&route=module.controller.action
|
|
|
- * 前台 /app/index.php....
|
|
|
- *
|
|
|
- * 多字母的路由用中划线隔开 比如:
|
|
|
- * TestCacheController
|
|
|
- * function testClean()
|
|
|
- * 路由写法为 test-cache.test-clean
|
|
|
- *
|
|
|
- */
|
|
|
- public static function parseRoute($requestRoute)
|
|
|
- {
|
|
|
- $routes = explode('.', $requestRoute);
|
|
|
- dd($routes);
|
|
|
- $path = self::getAppPath();
|
|
|
-
|
|
|
- $namespace = self::getAppNamespace();
|
|
|
- $action = '';
|
|
|
- $controllerName = '';
|
|
|
- $currentRoutes = [];
|
|
|
- $modules = [];
|
|
|
- if ($routes) {
|
|
|
- $length = count($routes);
|
|
|
- $routeFirst = array_first($routes);
|
|
|
- $countRoute = count($routes);
|
|
|
- if ($routeFirst === 'plugin' || self::isPlugin()) {
|
|
|
- if (self::isPlugin()) {
|
|
|
- $currentRoutes[] = 'plugin';
|
|
|
- $countRoute += 1;
|
|
|
- } else {
|
|
|
- $currentRoutes[] = $routeFirst;
|
|
|
- array_shift($routes);
|
|
|
- }
|
|
|
- $namespace = 'Yunshop';
|
|
|
- $pluginName = array_shift($routes);
|
|
|
- if ($pluginName || plugin($pluginName)) {
|
|
|
- $currentRoutes[] = $pluginName;
|
|
|
- $namespace .= '\\' . ucfirst(Str::camel($pluginName));
|
|
|
- $path = base_path() . '/plugins/' . $pluginName . '/src';
|
|
|
- $length = $countRoute;
|
|
|
-
|
|
|
- self::findRouteFile($controllerName, $action, $routes, $namespace, $path, $length, $currentRoutes, $requestRoute, true);
|
|
|
-
|
|
|
- if(!app('plugins')->isEnabled($pluginName)){
|
|
|
- throw new NotFoundException("{$pluginName}插件已禁用");
|
|
|
-
|
|
|
- }
|
|
|
- } else {
|
|
|
- throw new NotFoundException('无此插件');
|
|
|
-
|
|
|
- }
|
|
|
- } else {
|
|
|
-
|
|
|
- self::findRouteFile($controllerName, $action, $routes, $namespace, $path, $length, $currentRoutes, $requestRoute, false);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- //执行run
|
|
|
-
|
|
|
- static::run($namespace, $modules, $controllerName, $action, $currentRoutes);
|
|
|
-
|
|
|
- }
|
|
|
-}
|