chore: 首次提交 - 关联 GitHub fnvtk/MBTI_wang
Made-with: Cursor
This commit is contained in:
105
api/config/app.php
Normal file
105
api/config/app.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2023 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
// +----------------------------------------------------------------------
|
||||
// | 应用设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
// +----------------------------------------------------------------------
|
||||
// | 应用基础配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 应用名称
|
||||
'app_name' => env('app.name', ''),
|
||||
// 应用地址
|
||||
'app_host' => env('app.host', ''),
|
||||
// 应用的命名空间
|
||||
'app_namespace' => '',
|
||||
// 是否启用路由
|
||||
'with_route' => true,
|
||||
// 默认应用
|
||||
'default_app' => 'index',
|
||||
// 默认时区
|
||||
'default_timezone' => 'Asia/Shanghai',
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 应用调试配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 应用调试模式(从环境变量读取,开发环境建议开启)
|
||||
'app_debug' => env('app.debug', false),
|
||||
// 应用Trace(从环境变量读取,开发环境建议开启)
|
||||
'app_trace' => env('app.trace', false),
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 输出配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 默认输出类型
|
||||
'default_return_type' => 'json',
|
||||
// 默认AJAX 数据返回格式,可选json xml ...
|
||||
'default_ajax_return' => 'json',
|
||||
// 默认JSONP格式返回的处理方法
|
||||
'default_jsonp_handler' => 'jsonpReturn',
|
||||
// 默认JSONP处理方法
|
||||
'var_jsonp_handler' => 'callback',
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 语言配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 是否开启多语言
|
||||
'lang_switch_on' => false,
|
||||
// 默认语言
|
||||
'default_lang' => 'zh-cn',
|
||||
// 默认全局过滤方法 用逗号分隔多个
|
||||
'default_filter' => '',
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 类库配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 应用类库后缀
|
||||
'class_suffix' => false,
|
||||
// 控制器类后缀
|
||||
'controller_suffix' => false,
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | URL配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 应用映射(可选)
|
||||
'app_map' => [],
|
||||
// 域名绑定(可选)
|
||||
'domain_bind' => [],
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 异常处理配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 异常页面的模板文件
|
||||
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||
// 错误显示信息,非调试模式有效
|
||||
'error_message' => '页面错误!请稍后再试~',
|
||||
// 显示错误信息
|
||||
'show_error_msg' => true,
|
||||
// 异常处理handle类 留空使用 \think\exception\Handle
|
||||
'exception_handle' => '',
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 其他配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 应用模式状态
|
||||
'app_status' => '',
|
||||
];
|
||||
|
||||
|
||||
42
api/config/cache.php
Normal file
42
api/config/cache.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
// 缓存配置文件
|
||||
return [
|
||||
// 默认缓存驱动
|
||||
'default' => env('cache.driver', 'file'),
|
||||
|
||||
// 缓存连接方式配置
|
||||
'stores' => [
|
||||
// 文件缓存
|
||||
'file' => [
|
||||
// 驱动方式
|
||||
'type' => 'File',
|
||||
// 缓存保存目录
|
||||
'path' => '',
|
||||
// 缓存前缀
|
||||
'prefix' => '',
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'expire' => 0,
|
||||
// 缓存标签前缀
|
||||
'tag_prefix' => 'tag:',
|
||||
// 序列化机制 例如 ['serialize', 'unserialize']
|
||||
'serialize' => [],
|
||||
],
|
||||
|
||||
// Redis缓存
|
||||
'redis' => [
|
||||
// 驱动方式
|
||||
'type' => 'redis',
|
||||
// 服务器地址
|
||||
'host' => env('redis.hostname', '127.0.0.1'),
|
||||
// 端口
|
||||
'port' => env('redis.port', 6379),
|
||||
// 密码
|
||||
'password' => env('redis.password', ''),
|
||||
// 缓存前缀
|
||||
'prefix' => '',
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'expire' => 0,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
18
api/config/cors.php
Normal file
18
api/config/cors.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
// 跨域配置
|
||||
return [
|
||||
// 允许的跨域来源(生产环境写死具体域名)
|
||||
'allow_origin' => '*',
|
||||
|
||||
// 允许的HTTP方法
|
||||
'allow_methods' => env('cors.allow_methods', 'GET,POST,PUT,DELETE,OPTIONS'),
|
||||
|
||||
// 允许的请求头
|
||||
'allow_headers' => env('cors.allow_headers', 'Content-Type,Authorization,X-Requested-With,Accept'),
|
||||
|
||||
// 是否允许携带凭证(如果以后要带 cookie 再改成 true)
|
||||
'allow_credentials' => env('cors.allow_credentials', false),
|
||||
|
||||
// 预检请求缓存时间(秒)
|
||||
'max_age' => env('cors.max_age', 86400),
|
||||
];
|
||||
59
api/config/database.php
Normal file
59
api/config/database.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
// 默认使用的数据库连接配置
|
||||
'default' => env('database.driver', 'mysql'),
|
||||
|
||||
// 自定义时间查询规则
|
||||
'time_query_rule' => [],
|
||||
|
||||
// 自动写入时间戳字段
|
||||
// true为自动识别类型 false关闭
|
||||
// 字符串则明确指定时间字段类型 支持 int timestamp datetime date
|
||||
'auto_timestamp' => true,
|
||||
|
||||
// 时间字段取出后的默认时间格式
|
||||
'datetime_format' => 'Y-m-d H:i:s',
|
||||
|
||||
// 数据库连接配置信息
|
||||
'connections' => [
|
||||
'mysql' => [
|
||||
// 数据库类型
|
||||
'type' => env('database.type', 'mysql'),
|
||||
// 服务器地址
|
||||
'hostname' => env('database.hostname', '127.0.0.1'),
|
||||
// 数据库名
|
||||
'database' => env('database.database', 'news_db'),
|
||||
// 用户名
|
||||
'username' => env('database.username', 'root'),
|
||||
// 密码
|
||||
'password' => env('database.password', ''),
|
||||
// 端口
|
||||
'hostport' => env('database.hostport', '3306'),
|
||||
// 数据库连接参数
|
||||
'params' => [],
|
||||
// 数据库编码默认采用utf8mb4
|
||||
'charset' => env('database.charset', 'utf8mb4'),
|
||||
// 数据库表前缀
|
||||
'prefix' => env('database.prefix', 'wong_'),
|
||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||
'deploy' => 0,
|
||||
// 数据库读写是否分离 主从式有效
|
||||
'rw_separate' => false,
|
||||
// 读写分离后 主服务器数量
|
||||
'master_num' => 1,
|
||||
// 指定从服务器序号
|
||||
'slave_no' => '',
|
||||
// 是否严格检查字段是否存在
|
||||
'fields_strict' => true,
|
||||
// 是否需要断线重连
|
||||
'break_reconnect' => true,
|
||||
// 监听SQL
|
||||
'trigger_sql' => env('app_debug', true),
|
||||
// 开启字段缓存
|
||||
'fields_cache' => false,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
13
api/config/jwt.php
Normal file
13
api/config/jwt.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
// JWT配置
|
||||
return [
|
||||
// JWT密钥(请在生产环境修改)
|
||||
'secret' => env('jwt.secret', 'mbti_jwt_secret_key_2024_change_in_production'),
|
||||
|
||||
// Token过期时间(秒),默认7天
|
||||
'expire' => env('jwt.expire', 86400 * 7),
|
||||
|
||||
// Token刷新时间(秒),默认6天
|
||||
'refresh_expire' => env('jwt.refresh_expire', 86400 * 6),
|
||||
];
|
||||
|
||||
34
api/config/log.php
Normal file
34
api/config/log.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
// 日志配置文件
|
||||
return [
|
||||
// 默认日志记录通道
|
||||
'default' => env('log.channel', 'file'),
|
||||
// 日志记录级别
|
||||
'level' => [],
|
||||
// 日志通道配置
|
||||
'channels' => [
|
||||
'file' => [
|
||||
// 日志记录方式
|
||||
'type' => 'File',
|
||||
// 日志保存目录
|
||||
'path' => '',
|
||||
// 单文件日志写入
|
||||
'single' => false,
|
||||
// 独立日志级别
|
||||
'apart_level' => [],
|
||||
// 最大日志文件数量
|
||||
'max_files' => 0,
|
||||
// 使用JSON格式记录
|
||||
'json' => false,
|
||||
// 日志处理
|
||||
'processor' => null,
|
||||
// 关闭通道日志写入
|
||||
'close' => false,
|
||||
// 日志输出格式化
|
||||
'format' => '[%s][%s] %s',
|
||||
// 是否实时写入
|
||||
'realtime_write' => true,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
14
api/config/middleware.php
Normal file
14
api/config/middleware.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
// 中间件配置
|
||||
return [
|
||||
// 默认中间件命名空间
|
||||
'default_namespace' => 'app\\middleware',
|
||||
// 全局中间件
|
||||
'alias' => [
|
||||
'cors' => \app\middleware\Cors::class,
|
||||
'auth' => \app\middleware\Auth::class,
|
||||
'superadmin' => \app\middleware\SuperAdmin::class,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
30
api/config/route.php
Normal file
30
api/config/route.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// 路由配置文件
|
||||
return [
|
||||
// 路由使用完整匹配
|
||||
'route_complete_match' => false,
|
||||
// 是否强制使用路由
|
||||
'url_route_must' => false,
|
||||
// 合并路由规则
|
||||
'route_rule_merge' => false,
|
||||
// 路由是否完全匹配
|
||||
'route_complete_match' => false,
|
||||
// 是否去除URL中的.html后缀
|
||||
'url_html_suffix' => '',
|
||||
// 访问控制器层名称
|
||||
'controller_layer' => 'controller',
|
||||
// 空控制器名
|
||||
'empty_controller' => 'Error',
|
||||
// 操作方法后缀
|
||||
'action_suffix' => '',
|
||||
// 默认的路由变量规则
|
||||
'default_route_pattern' => '[\w\.]+',
|
||||
// URL普通方式参数 '?变量1=值1&变量2=值2...'
|
||||
'url_common_param' => true,
|
||||
// 是否开启路由延迟解析
|
||||
'url_lazy_route' => false,
|
||||
// 是否强制HTTPS
|
||||
'url_https' => false,
|
||||
];
|
||||
|
||||
|
||||
34
api/config/upload.php
Normal file
34
api/config/upload.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
// 上传配置(参考 database.php 的 env 读取方式)
|
||||
return [
|
||||
// 存储驱动:local 或 oss(默认使用 OSS)
|
||||
'driver' => env('upload.driver', 'oss'),
|
||||
|
||||
// 本地存储配置
|
||||
'local' => [
|
||||
// 本地物理路径
|
||||
'root' => app()->getRootPath() . 'public/uploads',
|
||||
// 访问 URL 前缀(可配置独立静态域名),末尾不要带斜杠
|
||||
// 例如:http://localhost:8000 或 https://static.example.com 或 https://api.737270.com
|
||||
// 注意:不要在这里再加 /uploads,避免出现 /uploads/uploads/xxx 的情况
|
||||
// 优先级:app.asset_url > app.host > api.737270.com(默认)
|
||||
'url' => rtrim(env('app.asset_url', env('app.host', env('API_DOMAIN', 'https://api.737270.com'))), '/'),
|
||||
],
|
||||
|
||||
// 阿里云 OSS 配置(参考 database.php,使用点号分隔的键名)
|
||||
'oss' => [
|
||||
// AccessKey ID(对应 .env 中的 OSS_ACCESS_KEY_ID)
|
||||
'access_key_id' => env('oss.access_key_id', ''),
|
||||
// AccessKey Secret(对应 .env 中的 OSS_ACCESS_KEY_SECRET)
|
||||
'access_key_secret' => env('oss.access_key_secret', ''),
|
||||
// OSS Endpoint(对应 .env 中的 OSS_ENDPOINT),如:oss-cn-hangzhou.aliyuncs.com
|
||||
'endpoint' => env('oss.endpoint', ''),
|
||||
// OSS Bucket 名称(对应 .env 中的 OSS_BUCKET)
|
||||
'bucket' => env('oss.bucket', ''),
|
||||
// 对象存储前缀(对应 .env 中的 OSS_PREFIX),默认:mbti
|
||||
'prefix' => env('oss.prefix', 'mbti'),
|
||||
// OSS 访问域名(对应 .env 中的 OSS_URL)
|
||||
// 如果未配置,将自动使用 OSS 自带域名:https://{bucket}.{endpoint}
|
||||
'url' => rtrim(env('oss.url', ''), '/'),
|
||||
],
|
||||
];
|
||||
7
api/config/wechat.php
Normal file
7
api/config/wechat.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
// 微信小程序配置
|
||||
// 这里直接读取 .env 中的 WECHAT_APP_ID / WECHAT_APP_SECRET,和现有配置保持一致
|
||||
return [
|
||||
'app_id' => env('WECHAT_APP_ID', ''),
|
||||
'app_secret' => env('WECHAT_APP_SECRET', ''),
|
||||
];
|
||||
Reference in New Issue
Block a user