diff --git a/application/store/init.php b/application/store/init.php new file mode 100644 index 000000000..373a5d03b --- /dev/null +++ b/application/store/init.php @@ -0,0 +1,24 @@ +-', function (Request $request, $controller, $action) { + $params = explode('-', $request->pathinfo()); + [array_shift($params), array_shift($params), array_shift($params)]; + return App::action("store/wechat.{$controller}/{$action}", $params); +}); \ No newline at end of file diff --git a/route/demo.php b/route/demo.php new file mode 100644 index 000000000..75b4df739 --- /dev/null +++ b/route/demo.php @@ -0,0 +1,59 @@ + 0, 'msg' => '测试环境禁修改用户密码!']); +}); +Route::post('admin/index/pass', function () { + return json(['code' => 0, 'msg' => '测试环境禁修改用户密码!']); +}); +Route::post('admin/config/index', function () { + return json(['code' => 0, 'msg' => '测试环境禁修改系统配置操作!']); +}); +Route::post('admin/config/file', function () { + return json(['code' => 0, 'msg' => '测试环境禁修改文件配置操作!']); +}); +Route::post('admin/menu/index', function () { + return json(['code' => 0, 'msg' => '测试环境禁排序菜单操作!']); +}); +Route::post('admin/menu/add', function () { + return json(['code' => 0, 'msg' => '测试环境禁添加菜单操作!']); +}); +Route::post('admin/menu/edit', function () { + return json(['code' => 0, 'msg' => '测试环境禁编辑菜单操作!']); +}); +Route::post('admin/menu/forbid', function () { + return json(['code' => 0, 'msg' => '测试环境禁止禁用菜单操作!']); +}); +Route::post('admin/menu/del', function () { + return json(['code' => 0, 'msg' => '测试环境禁止删除菜单操作!']); +}); +Route::post('wechat/config/index', function () { + return json(['code' => 0, 'msg' => '测试环境禁止修改微信配置操作!']); +}); +Route::post('admin/node/save', function () { + return json(['code' => 0, 'msg' => '测试环境禁止修改节点数据操作!']); +}); +Route::post('wechat/menu/edit', function () { + return json(['code' => 0, 'msg' => '测试环境禁止修改微信菜单操作!']); +}); +Route::get('wechat/menu/cancel', function () { + return json(['code' => 0, 'msg' => '测试环境禁止删除微信菜单操作!']); +}); diff --git a/route/route.php b/route/route.php index 369677604..1abdd7ac2 100644 --- a/route/route.php +++ b/route/route.php @@ -12,56 +12,16 @@ // | github开源项目:https://github.com/zoujingli/ThinkAdmin // +---------------------------------------------------------------------- -use think\facade\App; -use think\facade\Route; -use think\Request; - -/* 注册微信端路由支持 */ -Route::rule('wx--', function (Request $request, $controller, $action) { - $params = explode('-', $request->pathinfo()); - [array_shift($params), array_shift($params), array_shift($params)]; - return App::action("store/wechat.{$controller}/{$action}", $params); -}); +/** + * 模块路由及配置检测并加载 + * @include module/init.php + * @author Anyon + */ +foreach (scandir(env('app_path')) as $dir) { + if ($dir[0] !== '.') { + $filename = realpath(env('app_path') . "{$dir}/init.php"); + $filename && file_exists($filename) && include($filename); + } +} return []; - -/* 测试环境禁止操作路由绑定 */ -Route::post('admin/user/pass', function () { - return json(['code' => 0, 'msg' => '测试环境禁修改用户密码!']); -}); -Route::post('admin/index/pass', function () { - return json(['code' => 0, 'msg' => '测试环境禁修改用户密码!']); -}); -Route::post('admin/config/index', function () { - return json(['code' => 0, 'msg' => '测试环境禁修改系统配置操作!']); -}); -Route::post('admin/config/file', function () { - return json(['code' => 0, 'msg' => '测试环境禁修改文件配置操作!']); -}); -Route::post('admin/menu/index', function () { - return json(['code' => 0, 'msg' => '测试环境禁排序菜单操作!']); -}); -Route::post('admin/menu/add', function () { - return json(['code' => 0, 'msg' => '测试环境禁添加菜单操作!']); -}); -Route::post('admin/menu/edit', function () { - return json(['code' => 0, 'msg' => '测试环境禁编辑菜单操作!']); -}); -Route::post('admin/menu/forbid', function () { - return json(['code' => 0, 'msg' => '测试环境禁止禁用菜单操作!']); -}); -Route::post('admin/menu/del', function () { - return json(['code' => 0, 'msg' => '测试环境禁止删除菜单操作!']); -}); -Route::post('wechat/config/index', function () { - return json(['code' => 0, 'msg' => '测试环境禁止修改微信配置操作!']); -}); -Route::post('admin/node/save', function () { - return json(['code' => 0, 'msg' => '测试环境禁止修改节点数据操作!']); -}); -Route::post('wechat/menu/edit', function () { - return json(['code' => 0, 'msg' => '测试环境禁止修改微信菜单操作!']); -}); -Route::get('wechat/menu/cancel', function () { - return json(['code' => 0, 'msg' => '测试环境禁止删除微信菜单操作!']); -}); diff --git a/vendor/autoload.php b/vendor/autoload.php index a3a19ef2b..ce8975bef 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit38d0f6865bffe6f3ec7977ff5e7499f1::getLoader(); +return ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 11ac845d7..282038a30 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -162,6 +162,7 @@ return array( 'app\\store\\controller\\GoodsCate' => $baseDir . '/application/store/controller/GoodsCate.php', 'app\\store\\controller\\GoodsSpec' => $baseDir . '/application/store/controller/GoodsSpec.php', 'app\\store\\controller\\Order' => $baseDir . '/application/store/controller/Order.php', + 'app\\store\\controller\\wechat\\Demo' => $baseDir . '/application/store/controller/wechat/Demo.php', 'app\\store\\controller\\wechat\\Index' => $baseDir . '/application/store/controller/wechat/Index.php', 'app\\store\\service\\GoodsService' => $baseDir . '/application/store/service/GoodsService.php', 'app\\store\\service\\OrderService' => $baseDir . '/application/store/service/OrderService.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 260e115ee..359d7ba98 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit38d0f6865bffe6f3ec7977ff5e7499f1 +class ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit38d0f6865bffe6f3ec7977ff5e7499f1 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit38d0f6865bffe6f3ec7977ff5e7499f1', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit38d0f6865bffe6f3ec7977ff5e7499f1', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit38d0f6865bffe6f3ec7977ff5e7499f1::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit38d0f6865bffe6f3ec7977ff5e7499f1 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit38d0f6865bffe6f3ec7977ff5e7499f1::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire38d0f6865bffe6f3ec7977ff5e7499f1($fileIdentifier, $file); + composerRequiref5974243cd36d6c47ccc2deac6411e2c($fileIdentifier, $file); } return $loader; } } -function composerRequire38d0f6865bffe6f3ec7977ff5e7499f1($fileIdentifier, $file) +function composerRequiref5974243cd36d6c47ccc2deac6411e2c($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index c216fda63..46f8a648e 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit38d0f6865bffe6f3ec7977ff5e7499f1 +class ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c { public static $files = array ( '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', @@ -245,6 +245,7 @@ class ComposerStaticInit38d0f6865bffe6f3ec7977ff5e7499f1 'app\\store\\controller\\GoodsCate' => __DIR__ . '/../..' . '/application/store/controller/GoodsCate.php', 'app\\store\\controller\\GoodsSpec' => __DIR__ . '/../..' . '/application/store/controller/GoodsSpec.php', 'app\\store\\controller\\Order' => __DIR__ . '/../..' . '/application/store/controller/Order.php', + 'app\\store\\controller\\wechat\\Demo' => __DIR__ . '/../..' . '/application/store/controller/wechat/Demo.php', 'app\\store\\controller\\wechat\\Index' => __DIR__ . '/../..' . '/application/store/controller/wechat/Index.php', 'app\\store\\service\\GoodsService' => __DIR__ . '/../..' . '/application/store/service/GoodsService.php', 'app\\store\\service\\OrderService' => __DIR__ . '/../..' . '/application/store/service/OrderService.php', @@ -273,9 +274,9 @@ class ComposerStaticInit38d0f6865bffe6f3ec7977ff5e7499f1 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit38d0f6865bffe6f3ec7977ff5e7499f1::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit38d0f6865bffe6f3ec7977ff5e7499f1::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit38d0f6865bffe6f3ec7977ff5e7499f1::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::$classMap; }, null, ClassLoader::class); }