初始化本地仓库
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'enabled' => (bool) env('API_ENCRYPT_ENABLED', false),
|
||||
'scope' => (string) env('API_ENCRYPT_SCOPE', 'off'),
|
||||
'algorithm' => (string) env('API_ENCRYPT_ALGORITHM', 'rsa-aes'),
|
||||
'key_version' => (string) env('API_ENCRYPT_KEY_VERSION', 'v1'),
|
||||
'aes_mode' => (string) env('API_ENCRYPT_AES_MODE', 'AES-256-CBC'),
|
||||
'public_key_path' => (string) env('API_ENCRYPT_RSA_PUBLIC_KEY_PATH', runtime_path() . '/keys/api_encrypt_public.pem'),
|
||||
'private_key_path' => (string) env('API_ENCRYPT_RSA_PRIVATE_KEY_PATH', runtime_path() . '/keys/api_encrypt_private.pem'),
|
||||
'timestamp_tolerance' => (int) env('API_ENCRYPT_TIMESTAMP_TOLERANCE', 300),
|
||||
'exclude_paths' => [
|
||||
'/api/openapi',
|
||||
'/api/openapi.json',
|
||||
'/adminapi/openapi',
|
||||
'/adminapi/openapi.json',
|
||||
'/api/system/security/api-encrypt/public-key',
|
||||
'/adminapi/system/security/api-encrypt/public-key',
|
||||
'/upload',
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use support\Request;
|
||||
|
||||
return [
|
||||
|
||||
'name' => env('APP_NAME', 'MD-Admin'),
|
||||
'debug' => env('APP_DEBUG', false),
|
||||
"lang" => \app\enum\common\LangEnum::ZhCN->value,//默认语言
|
||||
'error_reporting' => E_ALL,
|
||||
'default_timezone' => 'Asia/Shanghai',
|
||||
'request_class' => Request::class,
|
||||
'public_path' => base_path() . DIRECTORY_SEPARATOR . 'public',
|
||||
'runtime_path' => base_path(false) . DIRECTORY_SEPARATOR . 'runtime',
|
||||
'controller_suffix' => 'Controller',
|
||||
'controller_reuse' => false,
|
||||
'store_in_recycle_bin' => env('RECYCLE_BIN_ENABLED', false),//是否开启回站模式
|
||||
];
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'files' => [
|
||||
base_path() . '/app/functions.php',
|
||||
base_path() . '/support/Request.php',
|
||||
base_path() . '/support/Response.php',
|
||||
base_path() . '/core/functions.php',
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
support\bootstrap\Session::class,
|
||||
\app\bootstrap\MorphMapBootstrap::class,
|
||||
\app\bootstrap\CoreConfigBootstrap::class,
|
||||
];
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => 'redis',
|
||||
'stores' => [
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => runtime_path('cache'),
|
||||
],
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
],
|
||||
//对应自定义扩展
|
||||
'custom' => [
|
||||
'default' => [
|
||||
'host' => env('CACHE_CUSTOM_REDIS_HOST', '127.0.0.1'),
|
||||
'password' => env('CACHE_CUSTOM_REDIS_PASSWORD', null),
|
||||
'port' => env('CACHE_CUSTOM_REDIS_PORT', 6379),
|
||||
'database' => env('CACHE_CUSTOM_REDIS_DB', 0),
|
||||
],
|
||||
'namespace' => '',
|
||||
'prefix' => 'md_',
|
||||
'type' => 'redis',//redis||file
|
||||
'stores' => [
|
||||
'redis' => [
|
||||
'host' => env('CACHE_CUSTOM_REDIS_HOST', '127.0.0.1'),
|
||||
'password' => env('CACHE_CUSTOM_REDIS_PASSWORD', null),
|
||||
'port' => env('CACHE_CUSTOM_REDIS_PORT', 6379),
|
||||
'database' => env('CACHE_CUSTOM_REDIS_DB', 0),
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
//return new Webman\Container;
|
||||
|
||||
$builder = new \DI\ContainerBuilder();
|
||||
// $builder->addDefinitions(require_once __DIR__ . '/dependence.php');
|
||||
$builder->addDefinitions(config('dependence', []));
|
||||
$builder->useAutowiring(true);
|
||||
$builder->useAttributes(true);
|
||||
return $builder->build();
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
|
||||
return [
|
||||
// 默认数据库
|
||||
'default' => 'mysql',
|
||||
'connections' => [
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'host' => env('DB_HOST', ''),
|
||||
'port' => env('DB_PORT', 3306),
|
||||
'database' => env('DB_DATABASE',''),
|
||||
'username' => env('DB_USERNAME',''),
|
||||
'password' => env('DB_PASSWORD',''),
|
||||
'unix_socket' => '',
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => env('DB_PREFIX', 'ma_'),
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'pool' => [
|
||||
// 连接池配置,仅支持swoole/swow驱动
|
||||
'max_connections' => 5, // 最大连接数
|
||||
'min_connections' => 1, // 最小连接数
|
||||
'wait_timeout' => 3, // 从连接池获取连接等待的最大时间,超时后会抛出异常
|
||||
'idle_timeout' => 60, // 连接池中连接最大空闲时间,超时后会关闭回收,直到连接数为min_connections
|
||||
'heartbeat_interval' => 50, // 连接池心跳检测时间,单位秒,建议小于60秒
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use core\jwt\interfaces\TokenStorageInterface;
|
||||
use core\jwt\interfaces\BlacklistStorageInterface;
|
||||
use core\jwt\storage\RedisTokenStorage;
|
||||
use core\jwt\storage\RedisBlacklistStorage;
|
||||
use core\jwt\JwtToken;
|
||||
|
||||
|
||||
|
||||
return [
|
||||
|
||||
];
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'adminapi.login.log' => [
|
||||
[\app\adminapi\listener\LoginLogListener::class, 'handle'],
|
||||
],
|
||||
'adminapi.operation.log' => [
|
||||
[\app\adminapi\listener\OperationLogListener::class, 'handle'],
|
||||
],
|
||||
|
||||
'adminapi.menu.formatting' => [
|
||||
[\app\adminapi\listener\MenuFormattingListener::class, 'handle'],
|
||||
],
|
||||
// 积分变动事件
|
||||
'adminapi.points.changed' => [
|
||||
[\app\adminapi\listener\PointsChangedListener::class, 'handle'],
|
||||
],
|
||||
// 会员等级更新事件
|
||||
'adminapi.member.level.updated' => [
|
||||
[\app\adminapi\listener\MemberLevelUpdatedListener::class, 'handle'],
|
||||
],
|
||||
// 审核事件
|
||||
'adminapi.review.approved' => [
|
||||
[\app\adminapi\listener\ReviewApprovedListener::class, 'handle'],
|
||||
],
|
||||
'adminapi.review.rejected' => [
|
||||
[\app\adminapi\listener\ReviewRejectedListener::class, 'handle'],
|
||||
],
|
||||
'adminapi.review.created' => [
|
||||
[\app\adminapi\listener\ReviewCreatedListener::class, 'handle'],
|
||||
],
|
||||
|
||||
// 会员信息拉取事件(注入标签权限码)
|
||||
'member.info.fetched' => [
|
||||
[\app\api\listener\MemberTagPermissionListener::class, 'handle'],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'' => \core\exception\Handler::class,
|
||||
];
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/webman.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::DEBUG,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'market_host' => 'https://madong.tech',
|
||||
'auth_code' => env('madong.code', '669e3705b3d7d'),//授权码
|
||||
'auth_secret' => env('madong.secret', '8439b36501df4f6185f521781d6b732'),//授权秘钥
|
||||
'response_type' => 'array',
|
||||
];
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use app\middleware\RateLimiterMiddleware;
|
||||
|
||||
return [
|
||||
//应用中间件
|
||||
'adminapi' => [
|
||||
RateLimiterMiddleware::class,//限流中间件
|
||||
],
|
||||
// 超全局中间件-覆盖插件
|
||||
'@' => [
|
||||
\app\middleware\AllowCrossOriginMiddleware::class,//跨域中间件
|
||||
\app\middleware\Lang::class,//多语言切换中间件
|
||||
\app\middleware\ApiEncryptMiddleware::class,//接口加密中间件
|
||||
// \app\middleware\DemoEnvRouteRestrictionMiddleware::class,// 演示过滤中间件
|
||||
],
|
||||
// 全局中间件-主项目有效
|
||||
'' => [
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/**
|
||||
* 多态关联映射配置
|
||||
*
|
||||
* 表中存储的模型别名(key) -> 实际模型类路径(value)
|
||||
*
|
||||
* 作用:
|
||||
* 1. 数据库表中不直接存储完整的类路径,只存储简短易读的别名
|
||||
* 2. 修改类路径时,只需更新配置,无需修改数据库
|
||||
* 3. 支持插件系统的多态关联
|
||||
*
|
||||
* 使用示例:
|
||||
* // Model 中定义多态关联
|
||||
* public function reviewable(): \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
* {
|
||||
* return $this->morphTo();
|
||||
* }
|
||||
*
|
||||
* // 数据库中存储
|
||||
* reviewable_type: 'question' // 而不是 'plugin\official\app\model\question\Question'
|
||||
* reviewable_id: 123
|
||||
*
|
||||
* // 查询时 Laravel ORM 会自动将 'question' 映射到对应模型类
|
||||
*/
|
||||
'map' => [
|
||||
// 审核模块
|
||||
'review' => \app\model\review\Review::class,
|
||||
|
||||
// 会员模块
|
||||
'member' => \app\model\member\Member::class,
|
||||
'member_withdraw' => \app\model\member\MemberWithdraw::class,
|
||||
|
||||
// 系统管理
|
||||
'admin' => \app\model\system\Admin::class,
|
||||
'menu' => \app\model\system\Menu::class,
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'enable' => true,
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'enable' => true,
|
||||
];
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
|
||||
|
||||
return [
|
||||
'enable' => true,
|
||||
/**
|
||||
* 扩展自定义验证规则
|
||||
*/
|
||||
'extends' => function (ValidationFactory $validator): void {
|
||||
// 注册手机号验证规则
|
||||
$validator->extend('mobile', function ($attribute, $value, $parameters) {
|
||||
return preg_match('/^1[3-9]\d{9}$/', $value);
|
||||
}, '无效的手机号码');
|
||||
|
||||
// 注册手机号验证规则(别名)
|
||||
$validator->extend('phone', function ($attribute, $value, $parameters) {
|
||||
return preg_match('/^1[3-9]\d{9}$/', $value);
|
||||
}, '无效的手机号码');
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use OpenApi\Annotations as OAA;
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
return [
|
||||
/**
|
||||
* 全局开关
|
||||
*/
|
||||
'enable' => true,
|
||||
|
||||
/**
|
||||
* 全局扫描的配置
|
||||
*
|
||||
* @see \WebmanTech\Swagger\Swagger::registerGlobalRoute()
|
||||
* @see \WebmanTech\Swagger\DTO\ConfigRegisterRouteDTO
|
||||
*/
|
||||
'global_route' => [
|
||||
'register_route' => false,
|
||||
'enable' => false,
|
||||
'openapi_doc' => [
|
||||
'scan_path' => [
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
/**
|
||||
* 全局的 host forbidden 配置
|
||||
*
|
||||
* @see \WebmanTech\Swagger\DTO\ConfigHostForbiddenDTO
|
||||
*/
|
||||
'host_forbidden' => [
|
||||
'enable' => true,
|
||||
'host_white_list' => [],
|
||||
],
|
||||
|
||||
/**
|
||||
* 全局的 swagger ui 配置
|
||||
*
|
||||
* @see \WebmanTech\Swagger\DTO\ConfigSwaggerUiDTO
|
||||
*/
|
||||
'swagger_ui' => [
|
||||
|
||||
],
|
||||
|
||||
/**
|
||||
* 全局的 openapi doc 配置
|
||||
*
|
||||
* @see \WebmanTech\Swagger\DTO\ConfigOpenapiDocDTO
|
||||
*/
|
||||
'openapi_doc' => [
|
||||
'scan_path' => function () {
|
||||
},
|
||||
'scan_exclude' => [
|
||||
],
|
||||
'modify' => function (OAA\OpenApi $openapi) {
|
||||
},
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
\WebmanTech\Swagger\Swagger::create()->registerGlobalRoute();
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
];
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Lock\Store\FlockStore;
|
||||
use Symfony\Component\Lock\Store\RedisStore;
|
||||
|
||||
return [
|
||||
'storage' => 'file', // file/redis, 建议使用 redis,file 不支持 ttl
|
||||
'storage_configs' => [
|
||||
'file' => [
|
||||
'class' => FlockStore::class,
|
||||
'construct' => [
|
||||
'lockPath' => runtime_path() . '/lock',
|
||||
],
|
||||
],
|
||||
'redis' => [
|
||||
'class' => RedisStore::class,
|
||||
'construct' => function() {
|
||||
return [
|
||||
'redis' => \support\Redis::connection('default')->client(),
|
||||
];
|
||||
},
|
||||
],
|
||||
],
|
||||
'default_config' => [
|
||||
'ttl' => 300, // 默认锁超时时间
|
||||
'auto_release' => true, // 是否自动释放,建议设置为 true
|
||||
'prefix' => 'lock_', // 锁前缀
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
|
||||
'build_dir' => BASE_PATH . DIRECTORY_SEPARATOR . 'build',
|
||||
|
||||
'phar_filename' => 'webman.phar',
|
||||
|
||||
'bin_filename' => 'webman.bin',
|
||||
|
||||
'signature_algorithm'=> Phar::SHA256, //set the signature algorithm for a phar and apply it. The signature algorithm must be one of Phar::MD5, Phar::SHA1, Phar::SHA256, Phar::SHA512, or Phar::OPENSSL.
|
||||
|
||||
'private_key_file' => '', // The file path for certificate or OpenSSL private key file.
|
||||
|
||||
'exclude_pattern' => '#^(?!.*(composer.json|/.github/|/.idea/|/.git/|/.setting/|/runtime/|/vendor-bin/|/build/|/vendor/webman/admin/))(.*)$#',
|
||||
|
||||
'exclude_files' => [
|
||||
'.env', 'LICENSE', 'composer.json', 'composer.lock', 'start.php', 'webman.phar', 'webman.bin'
|
||||
],
|
||||
|
||||
'custom_ini' => '
|
||||
memory_limit = 256M
|
||||
',
|
||||
];
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
];
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
Webman\Event\BootStrap::class,
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Webman\Event\EventListCommand;
|
||||
|
||||
return [
|
||||
EventListCommand::class
|
||||
];
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
'exception' => [
|
||||
// 是否记录异常到日志
|
||||
'enable' => true,
|
||||
// 不会记录到日志的异常类
|
||||
'dontReport' => [
|
||||
support\exception\BusinessException::class
|
||||
]
|
||||
],
|
||||
'dontReport' => [
|
||||
'app' => [],
|
||||
'controller' => [],
|
||||
'action' => [],
|
||||
'path' => []
|
||||
],
|
||||
'channel' => 'default' // 日志通道(在config/log.php里配置,默认是default)
|
||||
];
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use Webman\Log\Middleware;
|
||||
|
||||
return [
|
||||
'@' => [
|
||||
Middleware::class
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
'websocket' => 'websocket://0.0.0.0:3001',
|
||||
'api' => 'http://127.0.0.1:3002',
|
||||
'app_key' => '60756ede2a9737a05384aad849e220f8',
|
||||
'app_secret' => '5042267ccd10745be938a5e54eba9375',
|
||||
'channel_hook' => 'http://127.0.0.1:8001/plugin/webman/push/hook',
|
||||
'auth' => '/plugin/webman/push/auth'
|
||||
];
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Webman\Push\Server;
|
||||
|
||||
return [
|
||||
'server' => [
|
||||
'handler' => Server::class,
|
||||
'listen' => config('plugin.webman.push.app.websocket'),
|
||||
'count' => 1, // 必须是1
|
||||
'reloadable' => false, // 执行reload不重启
|
||||
'constructor' => [
|
||||
'api_listen' => config('plugin.webman.push.app.api'),
|
||||
'app_info' => [
|
||||
config('plugin.webman.push.app.app_key') => [
|
||||
'channel_hook' => config('plugin.webman.push.app.channel_hook'),
|
||||
'app_secret' => config('plugin.webman.push.app.app_secret'),
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use support\Request;
|
||||
use Webman\Route;
|
||||
use Webman\Push\Api;
|
||||
|
||||
/**
|
||||
* 推送js客户端文件
|
||||
*/
|
||||
Route::get('/plugin/webman/push/push.js', function (Request $request) {
|
||||
return response()->file(base_path().'/vendor/webman/push/src/push.js');
|
||||
});
|
||||
|
||||
/**
|
||||
* 私有频道鉴权,这里应该使用session辨别当前用户身份,然后确定该用户是否有权限监听channel_name
|
||||
*/
|
||||
Route::post(config('plugin.webman.push.app.auth'), function (Request $request) {
|
||||
$pusher = new Api(str_replace('0.0.0.0', '127.0.0.1', config('plugin.webman.push.app.api')), config('plugin.webman.push.app.app_key'), config('plugin.webman.push.app.app_secret'));
|
||||
$channel_name = $request->post('channel_name');
|
||||
$session = $request->session();
|
||||
// 这里应该通过session和channel_name判断当前用户是否有权限监听channel_name
|
||||
$has_authority = true;
|
||||
if ($has_authority) {
|
||||
return response($pusher->socketAuth($channel_name, $request->post('socket_id')));
|
||||
} else {
|
||||
return response('Forbidden', 403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 当频道上线以及下线时触发的回调
|
||||
* 频道上线:是指某个频道从没有连接在线到有连接在线的事件
|
||||
* 频道下线:是指某个频道的所有连接都断开触发的事件
|
||||
*/
|
||||
Route::post(parse_url(config('plugin.webman.push.app.channel_hook'), PHP_URL_PATH), function (Request $request) {
|
||||
|
||||
// 没有x-pusher-signature头视为伪造请求
|
||||
if (!$webhook_signature = $request->header('x-pusher-signature')) {
|
||||
return response('401 Not authenticated', 401);
|
||||
}
|
||||
|
||||
$body = $request->rawBody();
|
||||
|
||||
// 计算签名,$app_secret 是双方使用的密钥,是保密的,外部无从得知
|
||||
$expected_signature = hash_hmac('sha256', $body, config('plugin.webman.push.app.app_secret'), false);
|
||||
|
||||
// 安全校验,如果签名不一致可能是伪造的请求,返回401状态码
|
||||
if ($webhook_signature !== $expected_signature) {
|
||||
return response('401 Not authenticated', 401);
|
||||
}
|
||||
|
||||
// 这里存储这上线 下线的channel数据
|
||||
$payload = json_decode($body, true);
|
||||
|
||||
$channels_online = $channels_offline = [];
|
||||
|
||||
foreach ($payload['events'] as $event) {
|
||||
if ($event['name'] === 'channel_added') {
|
||||
$channels_online[] = $event['channel'];
|
||||
} else if ($event['name'] === 'channel_removed') {
|
||||
$channels_offline[] = $event['channel'];
|
||||
}
|
||||
}
|
||||
|
||||
// 业务根据需要处理上下线的channel,例如将在线状态写入数据库,通知其它channel等
|
||||
// 上线的所有channel
|
||||
echo 'online channels: ' . implode(',', $channels_online) . "\n";
|
||||
// 下线的所有channel
|
||||
echo 'offline channels: ' . implode(',', $channels_offline) . "\n";
|
||||
|
||||
return 'OK';
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
'driver' => 'auto', // auto, apcu, memory, redis
|
||||
'stores' => [
|
||||
'redis' => [
|
||||
'connection' => 'default',
|
||||
]
|
||||
],
|
||||
// 这些ip的请求不做频率限制
|
||||
'ip_whitelist' => [
|
||||
'127.0.0.1',
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
Webman\RateLimiter\Bootstrap::class
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
use Webman\RateLimiter\Limiter;
|
||||
|
||||
return [
|
||||
'@' => [
|
||||
Limiter::class
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Webman\RedisQueue\Command\MakeConsumerCommand;
|
||||
|
||||
return [
|
||||
MakeConsumerCommand::class
|
||||
];
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/redis-queue/queue.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::DEBUG,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
return [
|
||||
'consumer' => [
|
||||
'handler' => Webman\RedisQueue\Process\Consumer::class,
|
||||
'count' => 8, // 可以设置多进程同时消费
|
||||
'constructor' => [
|
||||
// 消费者类目录
|
||||
'consumer_dir' => app_path() . '/queue/redis',
|
||||
],
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
return [
|
||||
'default' => [
|
||||
'host' => env('QUEUE_REDIS_HOST', '127.0.0.1').':'.env('QUEUE_REDIS_PORT','6379'),
|
||||
'options' => [
|
||||
'auth' => env('QUEUE_REDIS_PASSWORD', null), // 密码,字符串类型,可选参数
|
||||
'db' => env('QUEUE_REDIS_DB', 0), // 数据库
|
||||
'prefix' => env('QUEUE_REDIS_PREFIX', ''), // key 前缀,
|
||||
'max_attempts' => 5, // 消费失败后,重试次数
|
||||
'retry_seconds' => 5, // 重试间隔,单位秒
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use app\process\Http;
|
||||
use support\Log;
|
||||
use support\Request;
|
||||
|
||||
global $argv;
|
||||
|
||||
return [
|
||||
'webman' => [
|
||||
'handler' => Http::class,
|
||||
'listen' => 'http://0.0.0.0:8001',
|
||||
'count' => cpu_count() * 4,
|
||||
'user' => '',
|
||||
'group' => '',
|
||||
'reusePort' => false,
|
||||
'eventLoop' => '',
|
||||
'context' => [],
|
||||
'constructor' => [
|
||||
'requestClass' => Request::class,
|
||||
'logger' => Log::channel('default'),
|
||||
'appPath' => app_path(),
|
||||
'publicPath' => public_path(),
|
||||
],
|
||||
],
|
||||
'monitor' => [
|
||||
'handler' => \app\process\Monitor::class,
|
||||
'reloadable' => false,
|
||||
// File update detection and automatic reload
|
||||
'constructor' => [
|
||||
// Monitor these directories
|
||||
'monitorDir' => array_merge([
|
||||
app_path(),
|
||||
config_path(),
|
||||
base_path() . '/process',
|
||||
base_path() . '/support',
|
||||
base_path() . '/resource',
|
||||
// base_path() . '/.env',//这里注释避免安装过程中失联
|
||||
base_path() . '/core',
|
||||
base_path() . '/plugin',
|
||||
], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api'), glob(base_path() . '/core/*/config')),
|
||||
// Files with these suffixes will be monitored
|
||||
'monitorExtensions' => [
|
||||
'php', 'html', 'htm', 'env',
|
||||
],
|
||||
'options' => [
|
||||
'enable_file_monitor' => !in_array('-d', $argv),
|
||||
'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
|
||||
],
|
||||
],
|
||||
],
|
||||
'madong-scheduler' => [
|
||||
'handler' => \core\scheduler\SchedulerServer::class,
|
||||
'count' => 1,
|
||||
'listen' => 'text://' . config('madong.scheduler.app.listen', '0.0.0.0:2001'),
|
||||
],
|
||||
'push_notification' => [
|
||||
'handler' => \app\process\PushNotification::class,
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: http://www.madong.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* 数据回收站-只能通过模型删除并且添加表配置的的才有效【直接使用DB操作需手动处理回收数据】
|
||||
*/
|
||||
return [
|
||||
// 全局默认配置
|
||||
'default' => [
|
||||
'enabled' => true, // 是否启用回收站
|
||||
'strategy' => 'logical', // logical|physical 默认软删
|
||||
'storage_days' => 30, // 保留天数-需自行扩展任务清理数据
|
||||
]
|
||||
];
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => [
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'password' => env('REDIS_PASSWORD', null),
|
||||
'port' => env('REDIS_PORT', 6379),
|
||||
'database' => env('REDIS_DB', 0),
|
||||
'pool' => [ // 连接池配置
|
||||
'max_connections' => 10, // 连接池最大连接数
|
||||
'min_connections' => 1, // 连接池最小连接数
|
||||
'wait_timeout' => 3, // 从连接池获取连接最大等待时间
|
||||
'idle_timeout' => 50, // 连接池中连接空闲超时时间,超过该时间会被关闭,直到连接数为min_connections
|
||||
'heartbeat_interval' => 50, // 心跳检测间隔,不要大于60秒
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* 审核模块配置文件
|
||||
* 配置说明:
|
||||
* 1. 插件可以独立配置自己的审核类型和字段映射
|
||||
* 2. 系统会自动扫描并合并所有插件的配置
|
||||
* 3. 插件配置路径:plugin/[name]/config/review.php
|
||||
*/
|
||||
|
||||
return [
|
||||
// 审批流模块配置
|
||||
'flow' => [
|
||||
// 是否启用审批流模式
|
||||
'enabled' => env('REVIEW_FLOW_ENABLED', false),
|
||||
|
||||
// 审批流服务类(第三方审批流模块提供)
|
||||
'service' => env('REVIEW_FLOW_SERVICE', null),
|
||||
|
||||
// 审批流模型类(第三方审批流模块提供)
|
||||
'model' => env('REVIEW_FLOW_MODEL', null),
|
||||
],
|
||||
|
||||
// 自动审核配置
|
||||
'auto_review' => [
|
||||
// 自动审核人ID(默认0表示系统)
|
||||
'reviewer_id' => env('REVIEW_AUTO_REVIEWER_ID', 0),
|
||||
],
|
||||
|
||||
// 审核类型配置(根据业务需求扩展)
|
||||
// 注意:插件的审核类型配置在插件目录的 config/review.php 中
|
||||
// 系统会自动扫描并合并所有插件的配置
|
||||
'types' => [
|
||||
'comment' => [
|
||||
'name' => '评论审核',
|
||||
'model' => 'app\\model\\comment\\Comment',
|
||||
'auto_submit' => true, // 创建时自动提交审核
|
||||
],
|
||||
// 'question' 类型由官方插件提供,在 plugin/official/config/review.php 中配置
|
||||
// 可以继续添加其他审核类型
|
||||
],
|
||||
|
||||
// 审核状态配置(使用枚举值)
|
||||
'status' => [
|
||||
'pending' => 0, // 待审核
|
||||
'approved' => 1, // 已通过
|
||||
'rejected' => 2, // 已拒绝
|
||||
'canceled' => 3, // 已取消
|
||||
],
|
||||
|
||||
// ==================== 新增:字段映射配置 ====================
|
||||
|
||||
// 默认字段映射(优先级最低,用于通用映射)
|
||||
'default_field_mappings' => [
|
||||
'title' => [
|
||||
'type' => 'attribute', // attribute/relation/callback
|
||||
'source' => 'title', // 字段名或关联名
|
||||
'fallback' => '未命名', // 默认值
|
||||
],
|
||||
'content' => [
|
||||
'type' => 'attribute',
|
||||
'source' => 'content',
|
||||
'fallback' => '无内容',
|
||||
],
|
||||
'applicant' => [
|
||||
'type' => 'attribute',
|
||||
'source' => 'author', // 例如:author、creator、user
|
||||
'fallback' => '未知',
|
||||
],
|
||||
],
|
||||
|
||||
// 类型特定字段映射(优先级最高)
|
||||
'field_mappings' => [
|
||||
// 系统内置类型的映射示例
|
||||
'comment' => [
|
||||
'model' => 'app\\model\\comment\\Comment',
|
||||
'title' => [
|
||||
'type' => 'callback',
|
||||
'callback' => function ($model) {
|
||||
// 回调函数可以任意处理
|
||||
return '评论:' . \Illuminate\Support\Str::limit($model->content, 30);
|
||||
},
|
||||
'fallback' => '无标题评论',
|
||||
],
|
||||
'content' => [
|
||||
'type' => 'attribute',
|
||||
'source' => 'content',
|
||||
'fallback' => '无内容',
|
||||
],
|
||||
'applicant' => [
|
||||
'type' => 'relation',
|
||||
'source' => 'author',
|
||||
'attribute' => 'username',
|
||||
'fallback' => '匿名用户',
|
||||
],
|
||||
],
|
||||
// 'question' 类型的字段映射由官方插件提供,在 plugin/official/config/review.php 中配置
|
||||
],
|
||||
|
||||
// ==================== 配置扫描 ====================
|
||||
|
||||
// 是否自动扫描插件配置(默认开启)
|
||||
'scan_plugins' => env('REVIEW_SCAN_PLUGINS', true),
|
||||
|
||||
// 插件配置文件名
|
||||
'plugin_config_file' => 'review.php',
|
||||
|
||||
// 忽略的插件(数组)
|
||||
'ignored_plugins' => [
|
||||
'example', // 示例插件
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use support\Request;
|
||||
use Webman\Route;
|
||||
use app\middleware\CheckInstallMiddleware;
|
||||
use app\middleware\FileAccessMiddleware;
|
||||
|
||||
/**
|
||||
* 后台模块路由
|
||||
*/
|
||||
require_once app_path('adminapi/config/route.php');
|
||||
|
||||
/**
|
||||
* 前台模块路由
|
||||
*/
|
||||
require_once app_path('api/config/route.php');
|
||||
|
||||
|
||||
// 安装页面
|
||||
Route::get('/install', function () {
|
||||
$file = public_path() . '/install/index.html';
|
||||
if (!file_exists($file)) {
|
||||
return response('File not found', 404);
|
||||
}
|
||||
return response(file_get_contents($file), 200, [
|
||||
'Content-Type' => 'text/html',
|
||||
]);
|
||||
});
|
||||
|
||||
// 站点首页
|
||||
Route::get('/', function () {
|
||||
return redirect('/web');
|
||||
})->middleware(CheckInstallMiddleware::class);
|
||||
|
||||
// 后台管理
|
||||
Route::get('/admin', function () {
|
||||
$file = public_path() . '/admin/index.html';
|
||||
if (!file_exists($file)) {
|
||||
return response('File not found', 404);
|
||||
}
|
||||
return response(file_get_contents($file), 200, [
|
||||
'Content-Type' => 'text/html',
|
||||
]);
|
||||
})->middleware(CheckInstallMiddleware::class);
|
||||
|
||||
/**
|
||||
* 后台静态资源路由
|
||||
* 访问路径: /admin/*
|
||||
* 资源目录: public/admin/
|
||||
* 无需权限验证
|
||||
*/
|
||||
Route::any('/admin/[{path:.+}]', function (Request $request, $path = '') {
|
||||
$admin_path = public_path() . '/admin';
|
||||
// 安全检查,避免url里 /../../../password 这样的非法访问
|
||||
if (str_contains($path, '..')) {
|
||||
return response('<h1>400 Bad Request</h1>', 400);
|
||||
}
|
||||
// 文件
|
||||
$file = "$admin_path/$path";
|
||||
if (!is_file($file)) {
|
||||
return response('<h1>404 Not Found</h1>', 404);
|
||||
}
|
||||
return response('')->withFile($file);
|
||||
});
|
||||
|
||||
Route::any('/install/[{path:.+}]', function (Request $request, $path = '') {
|
||||
$install_path = public_path() . '/install';
|
||||
// 安全检查,避免url里 /../../../password 这样的非法访问
|
||||
if (str_contains($path, '..')) {
|
||||
return response('<h1>400 Bad Request</h1>', 400);
|
||||
}
|
||||
// 文件
|
||||
$file = "$install_path/$path";
|
||||
if (!is_file($file)) {
|
||||
return response('<h1>404 Not Found</h1>', 404);
|
||||
}
|
||||
return response('')->withFile($file);
|
||||
});
|
||||
|
||||
Route::any('/web/[{path:.+}]', function (Request $request, $path = '') {
|
||||
$web_path = public_path() . '/web';
|
||||
// 安全检查,避免url里 /../../../password 这样的非法访问
|
||||
if (str_contains($path, '..')) {
|
||||
return response('<h1>400 Bad Request</h1>', 400);
|
||||
}
|
||||
// 文件
|
||||
$file = "$web_path/$path";
|
||||
if (!is_file($file)) {
|
||||
// 对于SPA应用,如果文件不存在,返回index.html让前端路由处理
|
||||
$index_file = "$web_path/index.html";
|
||||
if (is_file($index_file)) {
|
||||
return response(file_get_contents($index_file), 200, [
|
||||
'Content-Type' => 'text/html',
|
||||
]);
|
||||
}
|
||||
return response('<h1>404 Not Found</h1>', 404);
|
||||
}
|
||||
return response('')->withFile($file);
|
||||
});
|
||||
|
||||
// 移动端
|
||||
Route::get('/mobile', function () {
|
||||
$file = public_path() . '/mobile/index.html';
|
||||
if (!file_exists($file)) {
|
||||
return response('File not found', 404);
|
||||
}
|
||||
return response(file_get_contents($file), 200, [
|
||||
'Content-Type' => 'text/html',
|
||||
]);
|
||||
})->middleware(CheckInstallMiddleware::class);
|
||||
|
||||
// PC端
|
||||
Route::get('/web', function () {
|
||||
$file = public_path() . '/web/index.html';
|
||||
if (!file_exists($file)) {
|
||||
return response('File not found', 404);
|
||||
}
|
||||
return response(file_get_contents($file), 200, [
|
||||
'Content-Type' => 'text/html',
|
||||
]);
|
||||
})->middleware(CheckInstallMiddleware::class);
|
||||
|
||||
/**
|
||||
* 静态资源路由
|
||||
* 访问路径: /static/*
|
||||
* 无需权限验证
|
||||
*/
|
||||
Route::any('/static/[{path:.+}]', function (Request $request, $path = '') {
|
||||
$static_base_path = base_path() . '/static';
|
||||
// 安全检查,避免url里 /../../../password 这样的非法访问
|
||||
if (str_contains($path, '..')) {
|
||||
return response('<h1>400 Bad Request</h1>', 400);
|
||||
}
|
||||
// 文件
|
||||
$file = "$static_base_path/$path";
|
||||
if (!is_file($file)) {
|
||||
return response('<h1>404 Not Found</h1>', 404);
|
||||
}
|
||||
return response('')->withFile($file);
|
||||
});
|
||||
|
||||
/**
|
||||
* 文件上传读取路由
|
||||
* 访问路径: /uploads/*
|
||||
* 需要权限验证
|
||||
*/
|
||||
Route::any('/upload/[{path:.+}]', function (Request $request, $path = '') {
|
||||
$upload_path = public_path() . '/upload';
|
||||
// 安全检查,避免url里 /../../../password 这样的非法访问
|
||||
if (str_contains($path, '..')) {
|
||||
return response('<h1>400 Bad Request</h1>', 400);
|
||||
}
|
||||
// 文件
|
||||
$file = "$upload_path/$path";
|
||||
if (!is_file($file)) {
|
||||
return response('<h1>404 Not Found</h1>', 404);
|
||||
}
|
||||
return response('')->withFile($file);
|
||||
})->middleware(FileAccessMiddleware::class);
|
||||
|
||||
|
||||
/**
|
||||
* 根目录资源文件(如 /logo.png, /favicon.ico)
|
||||
* 显式列出已知文件,避免万能匹配导致路由冲突
|
||||
*/
|
||||
Route::get('/logo.png', function () {
|
||||
$file = public_path() . '/logo.png';
|
||||
if (!is_file($file)) {
|
||||
return response('', 404);
|
||||
}
|
||||
return response('')->withFile($file);
|
||||
});
|
||||
Route::get('/favicon.ico', function () {
|
||||
$file = public_path() . '/favicon.ico';
|
||||
if (!is_file($file)) {
|
||||
return response('', 404);
|
||||
}
|
||||
return response('')->withFile($file);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 关闭默认路由
|
||||
*/
|
||||
Route::disableDefaultRoute();
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
use Webman\Route;
|
||||
|
||||
//Route::group('/api/auth', function () {
|
||||
// Route::get('/qq/callback', [app\api\controller\auth\ThirdPartyAuthController::class, 'qqCallback']);
|
||||
// Route::get('/wechat/callback', [app\api\controller\auth\ThirdPartyAuthController::class, 'wechatCallback']);
|
||||
// Route::get('/weibo/callback', [app\api\controller\auth\ThirdPartyAuthController::class, 'weiboCallback']);
|
||||
// Route::get('/douyin/callback', [app\api\controller\auth\ThirdPartyAuthController::class, 'douyinCallback']);
|
||||
//});
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
return [
|
||||
'event_loop' => '',
|
||||
'stop_timeout' => 2,
|
||||
'pid_file' => runtime_path() . '/webman.pid',
|
||||
'status_file' => runtime_path() . '/webman.status',
|
||||
'stdout_file' => runtime_path() . '/logs/stdout.log',
|
||||
'log_file' => runtime_path() . '/logs/workerman.log',
|
||||
'max_package_size' => 10 * 1024 * 1024
|
||||
];
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use Webman\Session\FileSessionHandler;
|
||||
use Webman\Session\RedisSessionHandler;
|
||||
use Webman\Session\RedisClusterSessionHandler;
|
||||
|
||||
return [
|
||||
|
||||
'type' => 'file', // or redis or redis_cluster
|
||||
|
||||
'handler' => FileSessionHandler::class,
|
||||
|
||||
'config' => [
|
||||
'file' => [
|
||||
'save_path' => runtime_path() . '/sessions',
|
||||
],
|
||||
'redis' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'auth' => '',
|
||||
'timeout' => 2,
|
||||
'database' => '',
|
||||
'prefix' => 'redis_session_',
|
||||
],
|
||||
'redis_cluster' => [
|
||||
'host' => ['127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7001'],
|
||||
'timeout' => 2,
|
||||
'auth' => '',
|
||||
'prefix' => 'redis_session_',
|
||||
]
|
||||
],
|
||||
|
||||
'session_name' => 'PHPSID',
|
||||
|
||||
'auto_update_timestamp' => false,
|
||||
|
||||
'lifetime' => 7*24*60*60,
|
||||
|
||||
'cookie_lifetime' => 365*24*60*60,
|
||||
|
||||
'cookie_path' => '/',
|
||||
|
||||
'domain' => '',
|
||||
|
||||
'http_only' => true,
|
||||
|
||||
'secure' => false,
|
||||
|
||||
'same_site' => '',
|
||||
|
||||
'gc_probability' => [1, 1000],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Static file settings
|
||||
*/
|
||||
return [
|
||||
'enable' => false,
|
||||
'middleware' => [ // Static file Middleware
|
||||
app\middleware\StaticFile::class,
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'templates' => [
|
||||
// 本地存储配置
|
||||
[
|
||||
'group_code' => 'storage',
|
||||
'code' => 'local',
|
||||
'name' => '本地存储配置',
|
||||
'content' => [
|
||||
'root' => 'public',
|
||||
'dirname' => 'upload',
|
||||
'domain' => 'http://127.0.0.1:8001'
|
||||
],
|
||||
'is_sys' => 1
|
||||
],
|
||||
// OSS存储配置
|
||||
[
|
||||
'group_code' => 'storage',
|
||||
'code' => 'oss',
|
||||
'name' => 'OSS存储配置',
|
||||
'content' => [
|
||||
'accessKeyId' => '',
|
||||
'accessKeySecret' => '',
|
||||
'bucket' => '',
|
||||
'domain' => '',
|
||||
'endpoint' => '',
|
||||
'dirname' => ''
|
||||
],
|
||||
'is_sys' => 1
|
||||
],
|
||||
// COS存储配置
|
||||
[
|
||||
'group_code' => 'storage',
|
||||
'code' => 'cos',
|
||||
'name' => 'COS存储配置',
|
||||
'content' => [
|
||||
'secretId' => '',
|
||||
'secretKey' => '',
|
||||
'bucket' => '',
|
||||
'domain' => '',
|
||||
'region' => '',
|
||||
'dirname' => ''
|
||||
],
|
||||
'is_sys' => 1
|
||||
],
|
||||
// 七牛云存储配置
|
||||
[
|
||||
'group_code' => 'storage',
|
||||
'code' => 'qiniu',
|
||||
'name' => '七牛云存储配置',
|
||||
'content' => [
|
||||
'accessKey' => '',
|
||||
'secretKey' => '',
|
||||
'bucket' => '',
|
||||
'domain' => '',
|
||||
'region' => '',
|
||||
'dirname' => ''
|
||||
],
|
||||
'is_sys' => 1
|
||||
],
|
||||
// S3存储配置
|
||||
[
|
||||
'group_code' => 'storage',
|
||||
'code' => 's3',
|
||||
'name' => 'S3存储配置',
|
||||
'content' => [
|
||||
'key' => '',
|
||||
'secret' => '',
|
||||
'bucket' => '',
|
||||
'dirname' => '',
|
||||
'domain' => '',
|
||||
'region' => '',
|
||||
'version' => '',
|
||||
'endpoint' => '',
|
||||
'acl' => ''
|
||||
],
|
||||
'is_sys' => 1
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,412 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'enabled' => true,
|
||||
'npm_package_manager' => 'pnpm',
|
||||
'package_managers' => [
|
||||
'npm' => [
|
||||
'name' => 'NPM',
|
||||
'install' => 'npm install',
|
||||
'build' => 'npm run build',
|
||||
'check' => 'npm --version',
|
||||
],
|
||||
'cnpm' => [
|
||||
'name' => 'CNPM',
|
||||
'install' => 'cnpm install',
|
||||
'build' => 'cnpm run build',
|
||||
'check' => 'cnpm --version',
|
||||
],
|
||||
'pnpm' => [
|
||||
'name' => 'PNPM',
|
||||
'install' => 'pnpm install',
|
||||
'build' => 'pnpm run build',
|
||||
'check' => 'pnpm --version',
|
||||
],
|
||||
'yarn' => [
|
||||
'name' => 'YARN',
|
||||
'install' => 'yarn install',
|
||||
'build' => 'yarn build',
|
||||
'check' => 'yarn --version',
|
||||
],
|
||||
],
|
||||
'commands' => [
|
||||
'test' => [
|
||||
'default' => [
|
||||
'cwd' => '{project_root}/frontend/admin',
|
||||
'command' => 'pnpm run test',
|
||||
'description' => '运行测试命令',
|
||||
],
|
||||
],
|
||||
'install' => [
|
||||
'admin' => [
|
||||
'cwd' => '{project_root}/frontend/admin',
|
||||
'command' => '{package_manager} install',
|
||||
'description' => '安装Admin前端依赖',
|
||||
'variables' => [
|
||||
'{package_manager}' => 'npm_package_manager',
|
||||
],
|
||||
],
|
||||
'web' => [
|
||||
'cwd' => '{project_root}/frontend/web',
|
||||
'command' => '{package_manager} install',
|
||||
'description' => '安装Web前端依赖',
|
||||
'variables' => [
|
||||
'{package_manager}' => 'npm_package_manager',
|
||||
],
|
||||
],
|
||||
'h5' => [
|
||||
'cwd' => '{project_root}/frontend/uni-app',
|
||||
'command' => '{package_manager} install',
|
||||
'description' => '安装H5前端依赖',
|
||||
'variables' => [
|
||||
'{package_manager}' => 'npm_package_manager',
|
||||
],
|
||||
],
|
||||
'app' => [
|
||||
'cwd' => '{project_root}/frontend/uni-app',
|
||||
'command' => '{package_manager} install',
|
||||
'description' => '安装App前端依赖',
|
||||
'variables' => [
|
||||
'{package_manager}' => 'npm_package_manager',
|
||||
],
|
||||
],
|
||||
'server' => [
|
||||
'cwd' => '{backend_root}',
|
||||
'command' => 'composer install',
|
||||
'description' => '安装Server后端依赖',
|
||||
],
|
||||
],
|
||||
'build' => [
|
||||
'admin' => [
|
||||
'cwd' => '{project_root}/frontend/admin',
|
||||
'command' => '{package_manager} run build',
|
||||
'description' => '构建Admin前端',
|
||||
'variables' => [
|
||||
'{package_manager}' => 'npm_package_manager',
|
||||
],
|
||||
'before' => [
|
||||
],
|
||||
'after' => [
|
||||
],
|
||||
],
|
||||
'web' => [
|
||||
'cwd' => '{project_root}/frontend/web',
|
||||
'command' => '{package_manager} run build',
|
||||
'description' => '构建Web前端',
|
||||
'variables' => [
|
||||
'{package_manager}' => 'npm_package_manager',
|
||||
],
|
||||
'before' => [
|
||||
],
|
||||
'after' => [
|
||||
],
|
||||
],
|
||||
'h5' => [
|
||||
'cwd' => '{project_root}/frontend/uni-app',
|
||||
'command' => '{package_manager} run build:h5',
|
||||
'description' => '构建H5前端',
|
||||
'variables' => [
|
||||
'{package_manager}' => 'npm_package_manager',
|
||||
],
|
||||
'before' => [
|
||||
],
|
||||
'after' => [
|
||||
],
|
||||
],
|
||||
'app' => [
|
||||
'cwd' => '{project_root}/frontend/uni-app',
|
||||
'command' => '{package_manager} run build:app',
|
||||
'description' => '构建App前端',
|
||||
'variables' => [
|
||||
'{package_manager}' => 'npm_package_manager',
|
||||
],
|
||||
],
|
||||
],
|
||||
'debug' => [
|
||||
'default' => [
|
||||
'cwd' => '{backend_root}',
|
||||
'command' => 'echo "Debug command executed"',
|
||||
'description' => '调试命令',
|
||||
'before' => [
|
||||
'class' => 'app\service\core\terminal\intercept\CommonIntercept',
|
||||
'method' => 'before',
|
||||
],
|
||||
'after' => [
|
||||
'class' => 'app\service\core\terminal\intercept\CommonIntercept',
|
||||
'method' => 'after',
|
||||
],
|
||||
],
|
||||
],
|
||||
'custom' => [
|
||||
'test' => [
|
||||
'cwd' => '{backend_root}',
|
||||
'command' => 'echo "Hello, World!"',
|
||||
'description' => '测试自定义命令',
|
||||
'before' => [
|
||||
'class' => 'app\service\core\terminal\intercept\CustomIntercept',
|
||||
'method' => 'before',
|
||||
],
|
||||
'after' => [
|
||||
'class' => 'app\service\core\terminal\intercept\CustomIntercept',
|
||||
'method' => 'after',
|
||||
],
|
||||
],
|
||||
'list-files' => [
|
||||
'cwd' => '{backend_root}',
|
||||
'command' => 'dir',
|
||||
'description' => '列出当前目录文件',
|
||||
'before' => [
|
||||
'class' => 'app\service\core\terminal\intercept\CustomIntercept',
|
||||
'method' => 'before',
|
||||
],
|
||||
'after' => [
|
||||
'class' => 'app\service\core\terminal\intercept\CustomIntercept',
|
||||
'method' => 'after',
|
||||
],
|
||||
],
|
||||
],
|
||||
'check' => [
|
||||
'node' => [
|
||||
'cwd' => '{backend_root}',
|
||||
'command' => 'node --version',
|
||||
'description' => '检查Node.js版本',
|
||||
],
|
||||
'npm' => [
|
||||
'cwd' => '{backend_root}',
|
||||
'command' => 'npm --version',
|
||||
'description' => '检查NPM版本',
|
||||
],
|
||||
'pnpm' => [
|
||||
'cwd' => '{backend_root}',
|
||||
'command' => 'pnpm --version',
|
||||
'description' => '检查PNPM版本',
|
||||
],
|
||||
'composer' => [
|
||||
'cwd' => '{backend_root}',
|
||||
'command' => 'composer --version',
|
||||
'description' => '检查Composer版本',
|
||||
],
|
||||
],
|
||||
],
|
||||
'execution' => [
|
||||
'output_dir' => '{backend_root}/runtime/install/terminal',
|
||||
'output_file' => 'exec.log',
|
||||
'timeout' => 300,
|
||||
'poll_interval' => 500000,
|
||||
],
|
||||
'frontend_programs' => [
|
||||
'admin' => [
|
||||
'enabled' => true,
|
||||
'source_dir' => '{project_root}/frontend/admin/dist',
|
||||
'target_dir' => '{backend_root}/public/admin',
|
||||
'copy_mappings' => [
|
||||
'*' => '.',
|
||||
],
|
||||
'clean_target' => true,
|
||||
'preserve_files' => [
|
||||
0 => '.gitkeep',
|
||||
],
|
||||
'copy_options' => [
|
||||
'recursive' => true,
|
||||
'overwrite' => true,
|
||||
'preserve_permissions' => true,
|
||||
],
|
||||
],
|
||||
'web' => [
|
||||
'enabled' => true,
|
||||
'source_dir' => '{project_root}/frontend/web/.output/public',
|
||||
'target_dir' => '{backend_root}/public/web',
|
||||
'copy_mappings' => [
|
||||
'*' => '.',
|
||||
],
|
||||
'clean_target' => true,
|
||||
'preserve_files' => [
|
||||
0 => '.gitkeep',
|
||||
],
|
||||
'copy_options' => [
|
||||
'recursive' => true,
|
||||
'overwrite' => true,
|
||||
'preserve_permissions' => true,
|
||||
],
|
||||
],
|
||||
'h5' => [
|
||||
'enabled' => true,
|
||||
'source_dir' => '{project_root}/frontend/uni-app/dist/build/h5',
|
||||
'target_dir' => '{backend_root}/public/h5',
|
||||
'copy_mappings' => [
|
||||
'*' => '.',
|
||||
],
|
||||
'clean_target' => true,
|
||||
'preserve_files' => [
|
||||
0 => '.gitkeep',
|
||||
],
|
||||
'copy_options' => [
|
||||
'recursive' => true,
|
||||
'overwrite' => true,
|
||||
'preserve_permissions' => true,
|
||||
],
|
||||
],
|
||||
'app' => [
|
||||
'enabled' => true,
|
||||
'source_dir' => '{project_root}/frontend/uni-app/dist/build/app',
|
||||
'target_dir' => '{backend_root}/public/app',
|
||||
'copy_mappings' => [
|
||||
'*' => '.',
|
||||
],
|
||||
'clean_target' => true,
|
||||
'preserve_files' => [
|
||||
0 => '.gitkeep',
|
||||
],
|
||||
'copy_options' => [
|
||||
'recursive' => true,
|
||||
'overwrite' => true,
|
||||
'preserve_permissions' => true,
|
||||
],
|
||||
],
|
||||
'uni-app' => [
|
||||
'enabled' => true,
|
||||
'platforms' => [
|
||||
'h5' => [
|
||||
'source_dir' => '{project_root}/frontend/uni-app/dist/build/h5',
|
||||
'target_dir' => '{backend_root}/public/uni-app/h5',
|
||||
'copy_mappings' => [
|
||||
'*' => '.',
|
||||
],
|
||||
],
|
||||
'mp-weixin' => [
|
||||
'source_dir' => '{project_root}/frontend/uni-app/dist/build/mp-weixin',
|
||||
'target_dir' => '{backend_root}/public/uni-app/mp-weixin',
|
||||
'copy_mappings' => [
|
||||
'*' => '.',
|
||||
],
|
||||
],
|
||||
'app-plus' => [
|
||||
'source_dir' => '{project_root}/frontend/uni-app/dist/build/app-plus',
|
||||
'target_dir' => '{backend_root}/public/uni-app/app-plus',
|
||||
'copy_mappings' => [
|
||||
'*' => '.',
|
||||
],
|
||||
],
|
||||
],
|
||||
'default_platform' => 'h5',
|
||||
'clean_target' => true,
|
||||
'preserve_files' => [
|
||||
0 => '.gitkeep',
|
||||
],
|
||||
'copy_options' => [
|
||||
'recursive' => true,
|
||||
'overwrite' => true,
|
||||
'preserve_permissions' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
'registries' => [
|
||||
'npm' => [
|
||||
'npm' => 'https://registry.npmjs.org/',
|
||||
'taobao' => 'https://registry.npmmirror.com/',
|
||||
'tencent' => 'https://mirrors.cloud.tencent.com/npm/',
|
||||
'huawei' => 'https://repo.huaweicloud.com/repository/npm/',
|
||||
'aliyun' => 'https://registry.npmmirror.com/',
|
||||
'current' => 'npm',
|
||||
],
|
||||
'composer' => [
|
||||
'composer' => 'https://packagist.org/',
|
||||
'huawei' => 'https://repo.huaweicloud.com/repository/packagist/',
|
||||
'aliyun' => 'https://mirrors.aliyun.com/composer/',
|
||||
'tencent' => 'https://mirrors.cloud.tencent.com/composer/',
|
||||
'current' => 'composer',
|
||||
],
|
||||
],
|
||||
'web' => [
|
||||
'command_groups' => [
|
||||
0 => [
|
||||
'id' => 'test',
|
||||
'name' => '测试',
|
||||
'icon' => 'ant-design:code-outlined',
|
||||
'commands' => [
|
||||
0 => [
|
||||
'key' => 'check.node',
|
||||
'name' => '检查Node.js版本',
|
||||
],
|
||||
1 => [
|
||||
'key' => 'check.npm',
|
||||
'name' => '检查NPM版本',
|
||||
],
|
||||
2 => [
|
||||
'key' => 'check.pnpm',
|
||||
'name' => '检查PNPM版本',
|
||||
],
|
||||
3 => [
|
||||
'key' => 'check.composer',
|
||||
'name' => '检查Composer版本',
|
||||
],
|
||||
],
|
||||
],
|
||||
1 => [
|
||||
'id' => 'install',
|
||||
'name' => '安装依赖',
|
||||
'icon' => 'ant-design:download-outlined',
|
||||
'commands' => [
|
||||
0 => [
|
||||
'key' => 'install.admin',
|
||||
'name' => '安装Admin前端依赖',
|
||||
],
|
||||
1 => [
|
||||
'key' => 'install.web',
|
||||
'name' => '安装Web前端依赖',
|
||||
],
|
||||
2 => [
|
||||
'key' => 'install.h5',
|
||||
'name' => '安装H5前端依赖',
|
||||
],
|
||||
3 => [
|
||||
'key' => 'install.app',
|
||||
'name' => '安装App前端依赖',
|
||||
],
|
||||
4 => [
|
||||
'key' => 'install.server',
|
||||
'name' => '安装Server后端依赖',
|
||||
],
|
||||
],
|
||||
],
|
||||
2 => [
|
||||
'id' => 'build',
|
||||
'name' => '重新发布',
|
||||
'icon' => 'ant-design:tag-outlined',
|
||||
'commands' => [
|
||||
0 => [
|
||||
'key' => 'build.admin',
|
||||
'name' => '构建Admin前端',
|
||||
],
|
||||
1 => [
|
||||
'key' => 'build.web',
|
||||
'name' => '构建Web前端',
|
||||
],
|
||||
2 => [
|
||||
'key' => 'build.h5',
|
||||
'name' => '构建H5前端',
|
||||
],
|
||||
3 => [
|
||||
'key' => 'build.app',
|
||||
'name' => '构建App前端',
|
||||
],
|
||||
],
|
||||
],
|
||||
3 => [
|
||||
'id' => 'custom',
|
||||
'name' => '自定义命令',
|
||||
'icon' => 'ant-design:code-square-outlined',
|
||||
'commands' => [
|
||||
0 => [
|
||||
'key' => 'custom.test',
|
||||
'name' => '测试命令',
|
||||
],
|
||||
1 => [
|
||||
'key' => 'custom.list-files',
|
||||
'name' => '列出文件',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
return [
|
||||
'qq' => [
|
||||
'app_id' => '',
|
||||
'app_secret' => '',
|
||||
'redirect_uri' => '',
|
||||
],
|
||||
'wechat' => [
|
||||
'app_id' => 'wx0fb78d01436d7797',
|
||||
'app_secret' => '4bc10bee570c2c359f64ad948ee66bbe',
|
||||
'redirect_uri' => 'http://127.0.0.1:8001/api/auth/weibo-callback',
|
||||
],
|
||||
'weibo' => [
|
||||
'app_id' => '',
|
||||
'app_secret' => '',
|
||||
'redirect_uri' => '',
|
||||
],
|
||||
'douyin' => [
|
||||
'app_id' => '',
|
||||
'app_secret' => '',
|
||||
'redirect_uri' => '',
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Multilingual configuration
|
||||
*/
|
||||
|
||||
use app\enum\common\LangEnum;
|
||||
|
||||
return [
|
||||
// Default language
|
||||
'locale' => config('app.lang'),
|
||||
// Fallback language
|
||||
'fallback_locale' => ['zh_CN', 'en'],
|
||||
// Folder where language files are stored
|
||||
'path' => base_path() . '/resource/translations',
|
||||
];
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use support\view\Raw;
|
||||
use support\view\Twig;
|
||||
use support\view\Blade;
|
||||
use support\view\ThinkPHP;
|
||||
|
||||
return [
|
||||
'handler' => Raw::class
|
||||
];
|
||||
Reference in New Issue
Block a user