init admin
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?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 [
|
||||
'debug' => \support\Env::get('app.debug',false),
|
||||
'error_reporting' => E_ALL & ~E_WARNING,
|
||||
'default_timezone' => 'Asia/Shanghai',
|
||||
'request_class' => Request::class,
|
||||
'public_path' => run_path(). DIRECTORY_SEPARATOR . 'public',
|
||||
'runtime_path' => run_path() . DIRECTORY_SEPARATOR . 'runtime',
|
||||
'controller_suffix' => 'Controller',
|
||||
'controller_reuse' => 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',
|
||||
]
|
||||
];
|
||||
@@ -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,
|
||||
Webman\ThinkOrm\ThinkOrm::class,
|
||||
app\bootstrap\SqlDebug::class
|
||||
];
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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;
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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 [];
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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 [];
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'user.register_successed' => [
|
||||
[app\event\User::class, 'register_successed'],
|
||||
],
|
||||
'user.login_successed' => [
|
||||
[app\event\User::class, 'login_successed'],
|
||||
],
|
||||
'user.profile' => [
|
||||
[app\event\User::class, 'profile'],
|
||||
],
|
||||
'user.changepwd_successed' => [
|
||||
[app\event\User::class, 'changepwd_successed'],
|
||||
],
|
||||
'user.change_trade_pwd_successed' => [
|
||||
[app\event\User::class, 'change_trade_pwd_successed'],
|
||||
],
|
||||
'user.logout_successed' => [
|
||||
[app\event\User::class, 'logout_successed'],
|
||||
],
|
||||
'user.delete_successed' => [
|
||||
[app\event\User::class, 'delete_successed'],
|
||||
],
|
||||
'user.roleup' => [
|
||||
[app\event\User::class, 'roleup'],
|
||||
],
|
||||
'product.buy' => [
|
||||
[app\event\Product::class, 'buy']
|
||||
],
|
||||
'role.buy' => [
|
||||
],
|
||||
'recharge.success' => [
|
||||
[app\event\Recharge::class, 'success']
|
||||
],
|
||||
'withdrawl.success' => [
|
||||
[app\event\Withdrawl::class, 'created']
|
||||
],
|
||||
'withdrawl.created' => [
|
||||
[app\event\Withdrawl::class, 'created']
|
||||
],
|
||||
'withdrawl.reject' => [
|
||||
[app\event\Withdrawl::class, 'reject']
|
||||
],
|
||||
'withdrawl.transfering' => [
|
||||
[app\event\Withdrawl::class, 'transfering']
|
||||
],
|
||||
'card.create' => [
|
||||
[app\event\Card::class, 'create']
|
||||
]
|
||||
];
|
||||
@@ -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 [
|
||||
'api' => app\api\exception\Handler::class,
|
||||
//'' => plugin\admin\app\exception\Handler::class,
|
||||
'' => support\exception\Handler::class,
|
||||
];
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'enable' => true,
|
||||
'jwt' => [
|
||||
/** 算法类型 HS256、HS384、HS512、RS256、RS384、RS512、ES256、ES384、Ed25519 */
|
||||
'algorithms' => 'HS256',
|
||||
|
||||
/** access令牌秘钥 */
|
||||
'access_secret_key' => '2022d3d3LmJq',
|
||||
|
||||
/** access令牌过期时间,单位:秒。默认 2 小时 */
|
||||
'access_exp' => 604800,
|
||||
|
||||
/** refresh令牌秘钥 */
|
||||
'refresh_secret_key' => '2022KTxigxc9o50c',
|
||||
|
||||
/** refresh令牌过期时间,单位:秒。默认 7 天 */
|
||||
'refresh_exp' => 604800,
|
||||
|
||||
/** refresh 令牌是否禁用,默认不禁用 false */
|
||||
'refresh_disable' => false,
|
||||
|
||||
/** 令牌签发者 */
|
||||
'iss' => 'webman.tinywan.cn',
|
||||
|
||||
/** 某个时间点后才能访问,单位秒。(如:30 表示当前时间30秒后才能使用) */
|
||||
'nbf' => 0,
|
||||
|
||||
/** 时钟偏差冗余时间,单位秒。建议这个余地应该不大于几分钟 */
|
||||
'leeway' => 60,
|
||||
|
||||
/** 是否允许单设备登录,默认不允许 false */
|
||||
'is_single_device' => false,
|
||||
|
||||
/** 缓存令牌时间,单位:秒。默认 7 天 */
|
||||
'cache_token_ttl' => 604800,
|
||||
|
||||
/** 缓存令牌前缀,默认 JWT:TOKEN: */
|
||||
'cache_token_pre' => 'JWT:TOKEN:',
|
||||
|
||||
/** 缓存刷新令牌前缀,默认 JWT:REFRESH_TOKEN: */
|
||||
'cache_refresh_token_pre' => 'JWT:REFRESH_TOKEN:',
|
||||
|
||||
/** 用户信息模型 */
|
||||
'user_model' => function ($uid) {
|
||||
// 返回一个数组
|
||||
//field('id,username,created_at')->
|
||||
return \app\model\User::where('id',$uid)
|
||||
->find();
|
||||
},
|
||||
|
||||
/** 是否支持 get 请求获取令牌 */
|
||||
'is_support_get_token' => false,
|
||||
/** GET 请求获取令牌请求key */
|
||||
'is_support_get_token_key' => 'authorization',
|
||||
|
||||
/** access令牌私钥 */
|
||||
'access_private_key' => <<<EOD
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
...
|
||||
-----END RSA PRIVATE KEY-----
|
||||
EOD,
|
||||
|
||||
/** access令牌公钥 */
|
||||
'access_public_key' => <<<EOD
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
...
|
||||
-----END PUBLIC KEY-----
|
||||
EOD,
|
||||
|
||||
/** refresh令牌私钥 */
|
||||
'refresh_private_key' => <<<EOD
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
...
|
||||
-----END RSA PRIVATE KEY-----
|
||||
EOD,
|
||||
|
||||
/** refresh令牌公钥 */
|
||||
'refresh_public_key' => <<<EOD
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
...
|
||||
-----END PUBLIC KEY-----
|
||||
EOD,
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,160 @@
|
||||
<?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'.ceil(date('H')/6).'.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::INFO,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'server' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/server.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::ALERT,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'studio' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/studio.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::ALERT,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'power' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/power.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::ALERT,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'cansnow' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/cansnow.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::ALERT,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'role_buy' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/role_buy.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::DEBUG,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'product_buy' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/product_buy.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::DEBUG,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'mail' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/mail.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::DEBUG,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'mcp' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/mcp.log',
|
||||
7,
|
||||
Monolog\Logger::DEBUG,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* MCP 服务配置文件
|
||||
* 优化连接稳定性,解决断线问题
|
||||
*/
|
||||
|
||||
return [
|
||||
// 传输协议配置
|
||||
'transport' => \support\Env::get('mcp.TRANSPORT', 'sse'), // stdio, http, sse
|
||||
|
||||
// 服务器监听配置
|
||||
'host' => \support\Env::get('mcp.HOST', '127.0.0.1'),
|
||||
'port' => \support\Env::get('mcp.PORT', 8080), // 修改默认端口避免冲突
|
||||
'path' => \support\Env::get('mcp.PATH', ''),
|
||||
|
||||
// 连接超时配置(毫秒)- 优化超时设置
|
||||
'timeout' => \support\Env::get('mcp.TIMEOUT', 300000), // 5分钟总超时
|
||||
'connect_timeout' => \support\Env::get('mcp.CONNECT_TIMEOUT', 30000), // 30秒连接超时
|
||||
'read_timeout' => \support\Env::get('mcp.READ_TIMEOUT', 60000), // 60秒读取超时
|
||||
'write_timeout' => \support\Env::get('mcp.WRITE_TIMEOUT', 30000), // 30秒写入超时
|
||||
|
||||
// 重试配置 - 增加重试机制
|
||||
'retry_attempts' => \support\Env::get('mcp.RETRY_ATTEMPTS', 5), // 增加重试次数
|
||||
'retry_delay' => \support\Env::get('mcp.RETRY_DELAY', 2000), // 增加重试延迟
|
||||
'retry_backoff' => \support\Env::get('mcp.RETRY_BACKOFF', 1.5), // 重试退避倍数
|
||||
|
||||
// 心跳配置 - 新增心跳机制
|
||||
'heartbeat_enabled' => \support\Env::get('mcp.HEARTBEAT_ENABLED', true),
|
||||
'heartbeat_interval' => \support\Env::get('mcp.HEARTBEAT_INTERVAL', 30), // 30秒心跳间隔
|
||||
'heartbeat_timeout' => \support\Env::get('mcp.HEARTBEAT_TIMEOUT', 90), // 90秒心跳超时
|
||||
|
||||
// 连接池配置
|
||||
'pool_enabled' => \support\Env::get('mcp.POOL_ENABLED', true),
|
||||
'pool_size' => \support\Env::get('mcp.POOL_SIZE', 20), // 增加连接池大小
|
||||
'pool_timeout' => \support\Env::get('mcp.POOL_TIMEOUT', 5000), // 连接池超时
|
||||
|
||||
// 调试模式
|
||||
'debug' => \support\Env::get('mcp.DEBUG', false),
|
||||
|
||||
// 日志级别
|
||||
'log_level' => \support\Env::get('mcp.LOG_LEVEL', 'info'),
|
||||
'log_connection_events' => \support\Env::get('mcp.LOG_CONNECTION_EVENTS', true), // 记录连接事件
|
||||
|
||||
// 内存和执行时间限制 - 优化资源限制
|
||||
'memory_limit' => \support\Env::get('mcp.MEMORY_LIMIT', '512M'), // 增加内存限制
|
||||
'max_execution_time' => \support\Env::get('mcp.MAX_EXECUTION_TIME', 0), // 无限制执行时间
|
||||
|
||||
// 缓冲区配置
|
||||
'buffer_size' => \support\Env::get('mcp.BUFFER_SIZE', 16384), // 增加缓冲区大小
|
||||
'output_buffering' => \support\Env::get('OUTPUT_BUFFERING', true),
|
||||
|
||||
// 错误处理配置
|
||||
'error_handling' => [
|
||||
'log_errors' => true,
|
||||
'display_errors' => false,
|
||||
'error_reporting' => E_ALL,
|
||||
'catch_fatal_errors' => true,
|
||||
'log_connection_errors' => true,
|
||||
],
|
||||
|
||||
// 性能优化配置
|
||||
'performance' => [
|
||||
'enable_gzip' => true,
|
||||
'enable_cache' => true,
|
||||
'cache_ttl' => 3600,
|
||||
'enable_keep_alive' => true,
|
||||
'keep_alive_timeout' => 300, // 5分钟keep-alive
|
||||
'max_requests_per_connection' => 1000,
|
||||
],
|
||||
|
||||
// 安全配置
|
||||
'security' => [
|
||||
'enable_cors' => true,
|
||||
'allowed_origins' => ['*'],
|
||||
'rate_limit_enabled' => false,
|
||||
'rate_limit_requests' => 1000,
|
||||
'rate_limit_window' => 3600,
|
||||
],
|
||||
|
||||
// 监控配置
|
||||
'monitoring' => [
|
||||
'enable_metrics' => true,
|
||||
'metrics_interval' => 60, // 60秒收集一次指标
|
||||
'enable_health_check' => true,
|
||||
'health_check_interval' => 30, // 30秒健康检查
|
||||
],
|
||||
];
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
return [
|
||||
'api' => [
|
||||
\app\api\middleware\Auth::class
|
||||
],
|
||||
'' => [
|
||||
\app\middleware\ActionHook::class
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
// 如果ThinkORM需要使用缓存,请取消注释,或者在其他合适的地方引入
|
||||
//\think\facade\Db::setCache(new \Bilulanlv\ThinkCache\CacheManager());
|
||||
\support\think\Db::setCache(new \Bilulanlv\ThinkCache\CacheManager());
|
||||
return [
|
||||
// 开启插件
|
||||
'enable' => true,
|
||||
// 默认缓存驱动
|
||||
'default' => 'redis',
|
||||
// 缓存连接方式配置
|
||||
'stores' => [
|
||||
// redis缓存
|
||||
'redis' => [
|
||||
// 驱动方式
|
||||
'type' => 'redis',
|
||||
// 服务器地址
|
||||
'host' => \support\Env::get('redis.host'),
|
||||
'password' => \support\Env::get('redis.password',null),
|
||||
'port' => \support\Env::get('redis.port',6379),
|
||||
// 缓存前缀
|
||||
'prefix' => \support\Env::get('redis.prefix','cache:'),
|
||||
'select' => \support\Env::get('redis.database','0'),
|
||||
// 默认缓存有效期 0表示永久缓存
|
||||
'expire' => 0,
|
||||
// Thinkphp官方没有这个参数,由于生成的tag键默认不过期,如果tag键数量很大,避免长时间占用内存,可以设置一个超过其他缓存的过期时间,0为不设置
|
||||
'tag_expire' => 86400 * 7,
|
||||
// 缓存标签前缀
|
||||
'tag_prefix' => 'tag:',
|
||||
],
|
||||
// 文件缓存
|
||||
'file' => [
|
||||
// 驱动方式
|
||||
'type' => 'file',
|
||||
// 设置不同的缓存保存目录
|
||||
'path' => runtime_path() . '/file/',
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
'apidoc' => [
|
||||
// (选配)文档标题,显示在左上角与首页
|
||||
'title' => 'Apidoc',
|
||||
// (选配)文档描述,显示在首页
|
||||
'desc' => '',
|
||||
// (必须)设置文档的应用/版本
|
||||
'apps' => [
|
||||
[
|
||||
// (必须)标题
|
||||
'title'=>'Api接口',
|
||||
// (必须)控制器目录地址
|
||||
'path'=>'app\api\controller',
|
||||
// (必须)唯一的key
|
||||
'key'=>'api',
|
||||
]
|
||||
],
|
||||
// (必须)指定通用注释定义的文件地址
|
||||
'definitions' => "app\common\controller\Definitions",
|
||||
// (必须)自动生成url规则,当接口不添加@Apidoc\Url ("xxx")注解时,使用以下规则自动生成
|
||||
'auto_url' => [
|
||||
// 字母规则,lcfirst=首字母小写;ucfirst=首字母大写;
|
||||
'letter_rule' => "lcfirst",
|
||||
// url前缀
|
||||
'prefix'=>"",
|
||||
// 处理url中每个key
|
||||
'handle_key'=>function($key){
|
||||
return str_ireplace('Controller', "", $key);
|
||||
}
|
||||
],
|
||||
// (选配)是否自动注册路由
|
||||
'auto_register_routes'=>false,
|
||||
// (必须)缓存配置
|
||||
'cache' => [
|
||||
// 是否开启缓存
|
||||
'enable' => false,
|
||||
],
|
||||
// (必须)权限认证配置
|
||||
'auth' => [
|
||||
// 是否启用密码验证
|
||||
'enable' => false,
|
||||
// 全局访问密码
|
||||
'password' => "123456",
|
||||
// 密码加密盐
|
||||
'secret_key' => "apidoc#hg_code",
|
||||
// 授权访问后的有效期
|
||||
'expire' => 24*60*60
|
||||
],
|
||||
// 全局参数
|
||||
'params'=>[
|
||||
// (选配)全局的请求Header
|
||||
'header'=>[
|
||||
// name=字段名,type=字段类型,require=是否必须,default=默认值,desc=字段描述
|
||||
['name'=>'token','type'=>'string','require'=>true,'desc'=>'身份令牌Token'],
|
||||
['name'=>'client','type'=>'string','require'=>true,'desc'=>'客户端标识',"default"=>"web"],
|
||||
],
|
||||
// (选配)全局的请求Query
|
||||
'query'=>[
|
||||
// 同上 header
|
||||
],
|
||||
// (选配)全局的请求Body
|
||||
'body'=>[
|
||||
// 同上 header
|
||||
],
|
||||
],
|
||||
// 全局响应体
|
||||
'responses'=>[
|
||||
// 成功响应体
|
||||
'success'=>[
|
||||
['name'=>'code','desc'=>'状态','type'=>'int','require'=>1,"default"=>0],
|
||||
['name'=>'msg','desc'=>'提示信息','type'=>'string','require'=>1],
|
||||
//参数同上 headers;main=true来指定接口Returned参数挂载节点
|
||||
['name'=>'data','desc'=>'数据','main'=>true,'type'=>'object','require'=>1],
|
||||
],
|
||||
// 异常响应体
|
||||
'error'=>[
|
||||
['name'=>'code','desc'=>'状态','type'=>'int','require'=>1,'md'=>'/docs/HttpError.md'],
|
||||
['name'=>'msg','desc'=>'提示信息','type'=>'string','require'=>1],
|
||||
]
|
||||
],
|
||||
//(选配)默认作者
|
||||
'default_author'=>'',
|
||||
//(选配)默认请求类型
|
||||
'default_method'=>'GET',
|
||||
//(选配)Apidoc允许跨域访问
|
||||
'allowCrossDomain'=>false,
|
||||
/**
|
||||
* (选配)解析时忽略带@注解的关键词,当注解中存在带@字符并且非Apidoc注解,如 @key test,此时Apidoc页面报类似以下错误时:
|
||||
* [Semantical Error] The annotation "@key" in method xxx() was never imported. Did you maybe forget to add a "use" statement for this annotation?
|
||||
*/
|
||||
'ignored_annitation'=>[],
|
||||
|
||||
// (选配)数据库配置
|
||||
'database'=>[],
|
||||
// (选配)Markdown文档
|
||||
'docs' => [],
|
||||
// (选配)接口生成器配置 注意:是一个二维数组
|
||||
'generator' =>[]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
// 注册Apidoc路由
|
||||
hg\apidoc\providers\WebmanService::register();
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'enable' => true,
|
||||
|
||||
// 默认连接名称
|
||||
'default' => 'main', // 支持bilibili的BV模式
|
||||
|
||||
// Hashids modes
|
||||
'modes' => [
|
||||
'main' => [
|
||||
'salt' => '',
|
||||
'length' => 0,
|
||||
],
|
||||
'other' => [
|
||||
'salt' => 'salt',
|
||||
'length' => 0,
|
||||
'alphabet' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
|
||||
],
|
||||
'bilibili' => [
|
||||
// 此模式无需添加其他的配置
|
||||
// 前缀超过2位英文字母忽略
|
||||
'prefix' => '', // B站BV模式前缀类似: BV1fx411v7eo = 12345678
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
*-------------------------------------------------------------------------p*
|
||||
* 配置文件
|
||||
*-------------------------------------------------------------------------h*
|
||||
* @copyright Copyright (c) 2015-2022 Shopwwi Inc. (http://www.shopwwi.com)
|
||||
*-------------------------------------------------------------------------c*
|
||||
* @license http://www.shopwwi.com s h o p w w i . c o m
|
||||
*-------------------------------------------------------------------------e*
|
||||
* @link http://www.shopwwi.com by 象讯科技 phcent.com
|
||||
*-------------------------------------------------------------------------n*
|
||||
* @since shopwwi象讯·PHP商城系统Pro
|
||||
*-------------------------------------------------------------------------t*
|
||||
*/
|
||||
|
||||
return [
|
||||
'enable' => true,
|
||||
'default' => 'oss',
|
||||
'max_size' => 1024 * 1024 * 10, //单个文件大小10M
|
||||
'ext_yes' => [], //允许上传文件类型 为空则为允许所有
|
||||
'ext_no' => [], // 不允许上传文件类型 为空则不限制
|
||||
'storage' => [
|
||||
'public' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\LocalAdapterFactory::class,
|
||||
'root' => public_path(),
|
||||
'url' => '//wjba.oss-accelerate.aliyuncs.com' // 静态文件访问域名
|
||||
],
|
||||
'local' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\LocalAdapterFactory::class,
|
||||
'root' => runtime_path(),
|
||||
'url' => \support\Env::get('server.domain','http://127.0.0.1') // 静态文件访问域名
|
||||
],
|
||||
'ftp' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\FtpAdapterFactory::class,
|
||||
'host' => 'ftp.example.com',
|
||||
'username' => 'username',
|
||||
'password' => 'password',
|
||||
'url' => '' // 静态文件访问域名
|
||||
// 'port' => 21,
|
||||
// 'root' => '/path/to/root',
|
||||
// 'passive' => true,
|
||||
// 'ssl' => true,
|
||||
// 'timeout' => 30,
|
||||
// 'ignorePassiveAddress' => false,
|
||||
// 'timestampsOnUnixListingsEnabled' => true,
|
||||
],
|
||||
'memory' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\MemoryAdapterFactory::class,
|
||||
],
|
||||
's3' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\S3AdapterFactory::class,
|
||||
'credentials' => [
|
||||
'key' => 'S3_KEY',
|
||||
'secret' => 'S3_SECRET',
|
||||
],
|
||||
'region' => 'S3_REGION',
|
||||
'version' => 'latest',
|
||||
'bucket_endpoint' => false,
|
||||
'use_path_style_endpoint' => false,
|
||||
'endpoint' => 'S3_ENDPOINT',
|
||||
'bucket_name' => 'S3_BUCKET',
|
||||
'url' => '' // 静态文件访问域名
|
||||
],
|
||||
'minio' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\S3AdapterFactory::class,
|
||||
'credentials' => [
|
||||
'key' => 'S3_KEY',
|
||||
'secret' => 'S3_SECRET',
|
||||
],
|
||||
'region' => 'S3_REGION',
|
||||
'version' => 'latest',
|
||||
'bucket_endpoint' => false,
|
||||
'use_path_style_endpoint' => true,
|
||||
'endpoint' => 'S3_ENDPOINT',
|
||||
'bucket_name' => 'S3_BUCKET',
|
||||
'url' => '' // 静态文件访问域名
|
||||
],
|
||||
'oss' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\AliyunOssAdapterFactory::class,
|
||||
'accessId' => 'LTAI5tLsFoJAda5juPabytuU',
|
||||
'accessSecret' => 'ZyiKpt6lqLBfHPZcvHd7SWM7eENRJW',
|
||||
'bucket' => 'wjba',
|
||||
'endpoint' => 'oss-cn-hongkong.aliyuncs.com',
|
||||
'url' => '//wjba.oss-accelerate.aliyuncs.com' // 静态文件访问域名
|
||||
// 'timeout' => 3600,
|
||||
// 'connectTimeout' => 10,
|
||||
// 'isCName' => false,
|
||||
// 'token' => null,
|
||||
// 'proxy' => null,
|
||||
],
|
||||
'qiniu' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\QiniuAdapterFactory::class,
|
||||
'accessKey' => 'QINIU_ACCESS_KEY',
|
||||
'secretKey' => 'QINIU_SECRET_KEY',
|
||||
'bucket' => 'QINIU_BUCKET',
|
||||
'domain' => 'QINBIU_DOMAIN',
|
||||
'url' => '' // 静态文件访问域名
|
||||
],
|
||||
'cos' => [
|
||||
'driver' => \Shopwwi\WebmanFilesystem\Adapter\CosAdapterFactory::class,
|
||||
'region' => 'COS_REGION',
|
||||
'app_id' => 'COS_APPID',
|
||||
'secret_id' => 'COS_SECRET_ID',
|
||||
'secret_key' => 'COS_SECRET_KEY',
|
||||
// 可选,如果 bucket 为私有访问请打开此项
|
||||
// 'signed_url' => false,
|
||||
'bucket' => 'COS_BUCKET',
|
||||
'read_from_cdn' => false,
|
||||
'url' => '' // 静态文件访问域名
|
||||
// 'timeout' => 60,
|
||||
// 'connect_timeout' => 60,
|
||||
// 'cdn' => '',
|
||||
// 'scheme' => 'https',
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -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,22 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
'exception' => [
|
||||
// 是否记录异常到日志
|
||||
'enable' => true,
|
||||
// 不会记录到日志的异常类
|
||||
'dontReport' => [
|
||||
support\exception\BusinessException::class
|
||||
]
|
||||
],
|
||||
'dontReport' => [
|
||||
'app' => [
|
||||
],
|
||||
'controller' => [
|
||||
],
|
||||
'action' => [
|
||||
],
|
||||
'path' => [
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -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,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,19 @@
|
||||
<?php
|
||||
return [
|
||||
'consumer' => [
|
||||
'handler' => Webman\RedisQueue\Process\Consumer::class,
|
||||
'count' => \support\Env::get('app.debug',false) ? 2 : cpu_count() * 4,
|
||||
'constructor' => [
|
||||
// 消费者类目录
|
||||
'consumer_dir' => app_path() . '/queue/redis'
|
||||
]
|
||||
],
|
||||
'redis_consumer_slow' => [ // key是自定义的,没有格式限制,这里取名redis_consumer_slow
|
||||
'handler' => Webman\RedisQueue\Process\Consumer::class,
|
||||
'count' => 1,
|
||||
'constructor' => [
|
||||
// 消费者类目录
|
||||
'consumer_dir' => app_path() . '/queue/single'
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
return [
|
||||
'default' => [
|
||||
'host' => 'redis://'.\support\Env::get('redis.host','127.0.0.1').':'.\support\Env::get('redis.port',6379),
|
||||
'options' => [
|
||||
'auth' => \support\Env::get('redis.password',null), // 密码,字符串类型,可选参数
|
||||
'db' => \support\Env::get('redis.database',0), // 数据库
|
||||
'prefix' => \support\Env::get('redis.prefix'), // key 前缀
|
||||
'max_attempts' => 5, // 消费失败后,重试次数
|
||||
'retry_seconds' => 10, // 重试间隔,单位秒
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
global $argv;
|
||||
return [
|
||||
// File update detection and automatic reload
|
||||
'monitor' => [
|
||||
'handler' => process\Monitor::class,
|
||||
'reloadable' => true,
|
||||
'constructor' => [
|
||||
// 监控这些目录
|
||||
'monitor_dir' => [
|
||||
app_path(),
|
||||
config_path(),
|
||||
base_path() . '/process',
|
||||
base_path() . '/plugin/admin/app/controller',
|
||||
base_path() . '/plugin/admin/app/view',
|
||||
base_path() . '/plugin/app',
|
||||
base_path() . '/support',
|
||||
base_path() . '/resource',
|
||||
base_path() . '/.env',
|
||||
],
|
||||
// 文件后缀
|
||||
'monitor_extensions' => [
|
||||
'php', 'html', 'htm', 'env'
|
||||
]
|
||||
]
|
||||
],
|
||||
// MCP server process
|
||||
// 'mcp_server' => [
|
||||
// 'handler' => \app\mcp\process::class,
|
||||
// 'count' => 1,
|
||||
// 'reloadable' => true,
|
||||
// ],
|
||||
];
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => [
|
||||
'host' => \support\Env::get('redis.host'),
|
||||
'password' => \support\Env::get('redis.password',null),
|
||||
'port' => \support\Env::get('redis.port'),
|
||||
'database' => \support\Env::get('redis.database'),
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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\Route;
|
||||
|
||||
Route::fallback(function(){
|
||||
$fn = base_path().'/public/index.html';
|
||||
if(file_exists($fn)){
|
||||
return view($fn);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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 [
|
||||
'listen' => 'http://0.0.0.0:'.\support\Env::get('server.port',8585),
|
||||
'transport' => 'tcp',
|
||||
'context' => [],
|
||||
'name' => 'webman',
|
||||
'count' => \support\Env::get('app.debug',false) ? 2 : cpu_count() * 4,
|
||||
//'count' => 4,
|
||||
'user' => '',
|
||||
'group' => '',
|
||||
'reusePort' => false,
|
||||
'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' => 30 * 1024 * 1024 //30M
|
||||
];
|
||||
@@ -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' => 'redis', // or redis or redis_cluster
|
||||
|
||||
'handler' => FileSessionHandler::class,
|
||||
|
||||
'config' => [
|
||||
'file' => [
|
||||
'save_path' => runtime_path() . '/sessions',
|
||||
],
|
||||
'redis' => [
|
||||
'host' => \support\Env::get('redis.host','127.0.0.1'),
|
||||
'port' => \support\Env::get('redis.port',6379),
|
||||
'auth' => '',
|
||||
'timeout' => 2,
|
||||
'database' => \support\Env::get('redis.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' => true,
|
||||
'middleware' => [ // Static file Middleware
|
||||
//app\middleware\StaticFile::class,
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'default' => 'mysql',
|
||||
'connections' => [
|
||||
'mysql' => [
|
||||
// 数据库类型
|
||||
'type' => 'mysql',
|
||||
'hostname' => \support\Env::get('mysql.host','127.0.0.1'),
|
||||
'hostport' => \support\Env::get('mysql.port','3306'),
|
||||
'database' => \support\Env::get('mysql.database',''),
|
||||
'username' => \support\Env::get('mysql.username',''),
|
||||
'password' => \support\Env::get('mysql.password',''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
'prefix' => \support\Env::get('mysql.prefix','wa_'),
|
||||
// 数据库连接参数
|
||||
'params' => [
|
||||
\PDO::ATTR_TIMEOUT => 3,// 连接超时3秒
|
||||
\PDO::ATTR_PERSISTENT => true //设置是否使用持久化连接。
|
||||
],
|
||||
// 开启字段缓存
|
||||
'fields_cache' => true,
|
||||
// 断线重连
|
||||
'break_reconnect' => true,
|
||||
// 关闭SQL监听日志
|
||||
'trigger_sql' => true,
|
||||
// 自定义分页类
|
||||
'bootstrap' => ''
|
||||
],
|
||||
'immysql' => [
|
||||
// 数据库类型
|
||||
'type' => 'mysql',
|
||||
'hostname' => '172.17.0.2',
|
||||
'hostport' => \support\Env::get('mysql.port','3306'),
|
||||
'database' => 'im',
|
||||
'username' => 'root',
|
||||
'password' => 'n1e5a6s6m7',
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
'prefix' => \support\Env::get('mysql.prefix','wa_'),
|
||||
// 数据库连接参数
|
||||
'params' => [
|
||||
\PDO::ATTR_TIMEOUT => 3,// 连接超时3秒
|
||||
\PDO::ATTR_PERSISTENT => true //设置是否使用持久化连接。
|
||||
],
|
||||
// 开启字段缓存
|
||||
'fields_cache' => true,
|
||||
// 断线重连
|
||||
'break_reconnect' => true,
|
||||
// 关闭SQL监听日志
|
||||
'trigger_sql' => true,
|
||||
// 自定义分页类
|
||||
'bootstrap' => ''
|
||||
],
|
||||
'mongodb' => [
|
||||
'type' => 'mongo',
|
||||
'hostname' => \support\Env::get('mongodb.host','127.0.0.1'),
|
||||
'hostport' => \support\Env::get('mongodb.port','27017'),
|
||||
'database' => \support\Env::get('mongodb.database',''),
|
||||
'username' => \support\Env::get('mongodb.username',null),
|
||||
'password' => \support\Env::get('mongodb.password',null),
|
||||
'prefix' => 'wa_',
|
||||
'pk_convert_id' => true,
|
||||
// 开启字段缓存
|
||||
'fields_cache' => true,
|
||||
// 监听SQL
|
||||
'trigger_sql' => true,
|
||||
'params' => [
|
||||
'persist' => 'mongodb_persist', // 持久化连接标识
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
return [
|
||||
// 驱动方式
|
||||
'type' => 'Redis',
|
||||
// 缓存前缀
|
||||
'key' => 'yLaFnUOEgsw8NCvGj1DH4pYurQBWRM9m',
|
||||
// 加密方式
|
||||
'hashalgo' => 'ripemd160',
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'expire' => 0,
|
||||
'host' => \support\Env::get('redis.host'),
|
||||
'password' => \support\Env::get('redis.password',null),
|
||||
'port' => \support\Env::get('redis.port',6379),
|
||||
// 缓存前缀
|
||||
'prefix' => \support\Env::get('redis.prefix','cache:'),
|
||||
'select' => \support\Env::get('redis.database','0'),
|
||||
'timeout' => 0,
|
||||
'persistent' => false,
|
||||
'userprefix' => 'up:',
|
||||
'tokenprefix' => 'tp:',
|
||||
];
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Multilingual configuration
|
||||
*/
|
||||
return [
|
||||
// Default language
|
||||
'locale' => 'zh-Hans',
|
||||
// Fallback language
|
||||
'fallback_locale' => ['zh-Hans', 'zh-Hant', 'en'],
|
||||
// Folder where language files are stored
|
||||
'path' => run_path() . '/resource/translations',
|
||||
];
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
use support\view\Raw;
|
||||
use support\view\Twig;
|
||||
use support\view\Blade;
|
||||
use support\view\ThinkPHP;
|
||||
|
||||
return [
|
||||
'handler' => ThinkPHP::class,
|
||||
'options' => [
|
||||
'taglib_pre_load' => 'support\\TagLib\\Html',
|
||||
'tpl_replace_string' => [
|
||||
'__CDN__'=>Config('site.cdnurl')
|
||||
]
|
||||
]
|
||||
];
|
||||
Reference in New Issue
Block a user