init admin

This commit is contained in:
2025-11-07 09:56:20 +08:00
commit d9d7ddc05d
2718 changed files with 665424 additions and 0 deletions
@@ -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/',
],
],
];
+102
View 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],
//参数同上 headersmain=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' =>[]
]
];
+3
View File
@@ -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
',
];
+4
View File
@@ -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
];
+22
View File
@@ -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, // 重试间隔,单位秒
]
]
];