重构初始化

This commit is contained in:
技术老胡
2026-04-15 11:45:46 +08:00
parent 72d72d735b
commit 7612026773
381 changed files with 28287 additions and 14717 deletions

28
config/auth.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
/**
* 认证配置。
*
* 说明:
* - JWT 负责身份声明。
* - Redis 负责会话态存储。
* - Redis Key 推荐格式:
* - `mpay:auth:admin:{jti}`
* - `mpay:auth:merchant:{jti}`
*/
return [
'issuer' => env('AUTH_JWT_ISSUER', 'mpay'),
'leeway' => (int) env('AUTH_JWT_LEEWAY', 30),
'guards' => [
'admin' => [
'secret' => env('AUTH_ADMIN_JWT_SECRET', env('AUTH_JWT_SECRET', 'change-me-jwt-secret-use-at-least-32-chars')),
'ttl' => (int) env('AUTH_ADMIN_JWT_TTL', 86400),
'redis_prefix' => env('AUTH_ADMIN_JWT_REDIS_PREFIX', 'mpay:auth:admin:'),
],
'merchant' => [
'secret' => env('AUTH_MERCHANT_JWT_SECRET', env('AUTH_JWT_SECRET', 'change-me-jwt-secret-use-at-least-32-chars')),
'ttl' => (int) env('AUTH_MERCHANT_JWT_TTL', 86400),
'redis_prefix' => env('AUTH_MERCHANT_JWT_REDIS_PREFIX', 'mpay:auth:merchant:'),
],
],
];

View File

@@ -14,7 +14,7 @@
return [
'files' => [
base_path() . '/support/helpers.php',
base_path() . '/support/functions.php',
base_path() . '/support/Request.php',
base_path() . '/support/Response.php',
]

View File

@@ -1,83 +0,0 @@
{
"formId": "basic-config",
"title": "基础配置",
"submitText": "保存配置",
"submitUrl": "/adminapi/system/base-config/submit/basic",
"cacheKey": "basic_config_cache",
"refreshAfterSubmit": true,
"rules": [
{
"type": "input",
"field": "site_name",
"title": "站点名称",
"value": "",
"props": {
"placeholder": "请输入站点名称"
},
"validate": [
{
"required": true,
"message": "站点名称不能为空"
}
]
},
{
"type": "textarea",
"field": "site_description",
"title": "站点描述",
"value": "",
"props": {
"placeholder": "请输入站点描述",
"autoSize": {
"minRows": 3,
"maxRows": 6
}
}
},
{
"type": "input",
"field": "site_logo",
"title": "站点 Logo",
"value": "",
"props": {
"placeholder": "请输入 Logo 地址"
}
},
{
"type": "input",
"field": "icp_number",
"title": "备案号",
"value": "",
"props": {
"placeholder": "请输入 ICP 备案号"
}
},
{
"type": "switch",
"field": "site_status",
"title": "站点状态",
"value": true,
"props": {
"checkedText": "开启",
"uncheckedText": "关闭"
}
},
{
"type": "inputNumber",
"field": "page_size",
"title": "每页显示数量",
"value": 10,
"props": {
"min": 1,
"max": 100,
"precision": 0
},
"validate": [
{
"required": true,
"message": "每页显示数量不能为空"
}
]
}
]
}

View File

@@ -1,111 +0,0 @@
{
"formId": "email-config",
"title": "邮件配置",
"submitText": "保存配置",
"submitUrl": "/adminapi/system/base-config/submit/email",
"cacheKey": "email_config_cache",
"refreshAfterSubmit": true,
"rules": [
{
"type": "input",
"field": "smtp_host",
"title": "SMTP 主机",
"value": "",
"props": {
"placeholder": "例如smtp.qq.com"
},
"validate": [
{
"required": true,
"message": "SMTP 主机不能为空"
}
]
},
{
"type": "inputNumber",
"field": "smtp_port",
"title": "SMTP 端口",
"value": 465,
"props": {
"min": 1,
"max": 65535,
"precision": 0
},
"validate": [
{
"required": true,
"message": "SMTP 端口不能为空"
}
]
},
{
"type": "switch",
"field": "smtp_ssl",
"title": "启用 SSL",
"value": true,
"props": {
"checkedText": "是",
"uncheckedText": "否"
}
},
{
"type": "input",
"field": "smtp_username",
"title": "SMTP 用户名",
"value": "",
"props": {
"placeholder": "请输入 SMTP 用户名"
},
"validate": [
{
"required": true,
"message": "SMTP 用户名不能为空"
}
]
},
{
"type": "input",
"field": "smtp_password",
"title": "SMTP 密码",
"value": "",
"props": {
"type": "password",
"placeholder": "请输入 SMTP 密码或授权码"
},
"validate": [
{
"required": true,
"message": "SMTP 密码不能为空"
}
]
},
{
"type": "input",
"field": "from_email",
"title": "发件邮箱",
"value": "",
"props": {
"placeholder": "请输入发件邮箱地址"
},
"validate": [
{
"required": true,
"message": "发件邮箱不能为空"
},
{
"type": "email",
"message": "请输入正确的邮箱地址"
}
]
},
{
"type": "input",
"field": "from_name",
"title": "发件名称",
"value": "",
"props": {
"placeholder": "请输入发件人名称"
}
}
]
}

View File

@@ -1,98 +0,0 @@
{
"formId": "permission-config",
"title": "权限配置",
"submitText": "保存配置",
"submitUrl": "/adminapi/system/base-config/submit/permission",
"cacheKey": "permission_config_cache",
"refreshAfterSubmit": true,
"rules": [
{
"type": "switch",
"field": "enable_permission",
"title": "启用权限控制",
"value": true,
"props": {
"checkedText": "启用",
"uncheckedText": "禁用"
}
},
{
"type": "inputNumber",
"field": "session_timeout",
"title": "会话超时时间(分钟)",
"value": 30,
"props": {
"min": 1,
"max": 1440,
"precision": 0
},
"validate": [
{
"required": true,
"message": "会话超时时间不能为空"
}
]
},
{
"type": "inputNumber",
"field": "password_min_length",
"title": "密码最小长度",
"value": 6,
"props": {
"min": 4,
"max": 32,
"precision": 0
},
"validate": [
{
"required": true,
"message": "密码最小长度不能为空"
}
]
},
{
"type": "switch",
"field": "require_strong_password",
"title": "要求强密码",
"value": false,
"props": {
"checkedText": "是",
"uncheckedText": "否"
}
},
{
"type": "inputNumber",
"field": "max_login_attempts",
"title": "最大登录尝试次数",
"value": 5,
"props": {
"min": 1,
"max": 10,
"precision": 0
},
"validate": [
{
"required": true,
"message": "最大登录尝试次数不能为空"
}
]
},
{
"type": "inputNumber",
"field": "lockout_duration",
"title": "账户锁定时长(分钟)",
"value": 30,
"props": {
"min": 1,
"max": 1440,
"precision": 0
},
"validate": [
{
"required": true,
"message": "账户锁定时长不能为空"
}
]
}
]
}

View File

@@ -1,26 +0,0 @@
[
{
"key": "basic",
"title": "基础配置",
"icon": "settings",
"description": "配置系统基础信息包括站点名称、Logo、备案号和分页默认值。",
"sort": 1,
"disabled": false
},
{
"key": "email",
"title": "邮件配置",
"icon": "email",
"description": "配置 SMTP 主机、端口、账号和发件人信息,用于通知发送与联通检查。",
"sort": 2,
"disabled": false
},
{
"key": "permission",
"title": "权限配置",
"icon": "lock",
"description": "配置后台权限控制、会话超时、密码强度和登录限制等安全参数。",
"sort": 3,
"disabled": false
}
]

View File

@@ -13,5 +13,5 @@
*/
return [
// support\bootstrap\Session::class,
support\bootstrap\Session::class,
];

View File

@@ -22,10 +22,10 @@ return [
],
'redis' => [
'driver' => 'redis',
'connection' => env('CACHE_REDIS_CONNECTION', 'default')
'connection' => 'default'
],
'array' => [
'driver' => 'array'
]
]
];
];

View File

@@ -12,8 +12,8 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$builder = new \DI\ContainerBuilder();
$builder->addDefinitions(config('dependence', []));
$builder->useAutowiring(true);
$builder->useAttributes(true);
return $builder->build();
$builder = new \DI\ContainerBuilder();
$builder->addDefinitions(config('dependence', []));
$builder->useAutowiring(true);
$builder->useAttributes(true);
return $builder->build();

View File

@@ -5,10 +5,10 @@ return [
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', 3306),
'database' => env('DB_DATABASE', ''),
'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'mpay'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', '123456'),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'prefix' => '',
@@ -26,4 +26,4 @@ return [
],
],
],
];
];

201
config/dict.php Normal file
View File

@@ -0,0 +1,201 @@
<?php
return [
'gender' => [
'name' => '性别',
'code' => 'gender',
'description' => '这是一个性别字典',
'list' => [
['name' => '女', 'value' => 0],
['name' => '男', 'value' => 1],
['name' => '其它', 'value' => 2],
],
],
'status' => [
'name' => '通用状态',
'code' => 'status',
'description' => '通用启用禁用状态字典',
'list' => [
['name' => '禁用', 'value' => 0],
['name' => '启用', 'value' => 1],
],
],
'task_status' => [
'name' => '任务状态',
'code' => 'task_status',
'description' => '任务执行状态字典',
'list' => [
['name' => '待通知', 'value' => 0],
['name' => '成功', 'value' => 1],
['name' => '失败', 'value' => 2],
],
],
'merchant_type' => [
'name' => '商户类型',
'code' => 'merchant_type',
'description' => '商户主体类型字典',
'list' => [
['name' => '个人', 'value' => 0],
['name' => '企业', 'value' => 1],
['name' => '其它', 'value' => 2],
],
],
'risk_level' => [
'name' => '风控等级',
'code' => 'risk_level',
'description' => '商户风控等级字典',
'list' => [
['name' => '低', 'value' => 0],
['name' => '中', 'value' => 1],
['name' => '高', 'value' => 2],
],
],
'channel_mode' => [
'name' => '通道模式',
'code' => 'channel_mode',
'description' => '支付通道模式字典',
'list' => [
['name' => '代收', 'value' => 0],
['name' => '自收', 'value' => 1],
],
],
'route_mode' => [
'name' => '路由模式',
'code' => 'route_mode',
'description' => '支付路由模式字典',
'list' => [
['name' => '顺序依次轮询', 'value' => 0],
['name' => '权重随机轮询', 'value' => 1],
['name' => '默认启用通道', 'value' => 2],
],
],
'settlement_cycle_type' => [
'name' => '结算周期',
'code' => 'settlement_cycle_type',
'description' => '结算周期字典',
'list' => [
['name' => 'D0', 'value' => 0],
['name' => 'D1', 'value' => 1],
['name' => 'D7', 'value' => 2],
['name' => 'T1', 'value' => 3],
['name' => 'OTHER', 'value' => 4],
],
],
'pay_order_status' => [
'name' => '支付订单状态',
'code' => 'pay_order_status',
'description' => '支付订单状态字典',
'list' => [
['name' => '待创建', 'value' => 0],
['name' => '支付中', 'value' => 1],
['name' => '成功', 'value' => 2],
['name' => '失败', 'value' => 3],
['name' => '关闭', 'value' => 4],
['name' => '超时', 'value' => 5],
],
],
'refund_order_status' => [
'name' => '退款订单状态',
'code' => 'refund_order_status',
'description' => '退款订单状态字典',
'list' => [
['name' => '待创建', 'value' => 0],
['name' => '处理中', 'value' => 1],
['name' => '成功', 'value' => 2],
['name' => '失败', 'value' => 3],
['name' => '关闭', 'value' => 4],
],
],
'settlement_order_status' => [
'name' => '清算订单状态',
'code' => 'settlement_order_status',
'description' => '清算订单状态字典',
'list' => [
['name' => '无', 'value' => 0],
['name' => '待清算', 'value' => 1],
['name' => '已清算', 'value' => 2],
['name' => '已冲正', 'value' => 3],
],
],
'callback_status' => [
'name' => '回调状态',
'code' => 'callback_status',
'description' => '异步回调处理状态字典',
'list' => [
['name' => '待处理', 'value' => 0],
['name' => '成功', 'value' => 1],
['name' => '失败', 'value' => 2],
],
],
'callback_type' => [
'name' => '回调类型',
'code' => 'callback_type',
'description' => '支付回调类型字典',
'list' => [
['name' => '异步通知', 'value' => 0],
['name' => '同步返回', 'value' => 1],
],
],
'notify_type' => [
'name' => '通知类型',
'code' => 'notify_type',
'description' => '渠道通知类型字典',
'list' => [
['name' => '异步通知', 'value' => 0],
['name' => '查单', 'value' => 1],
],
],
'verify_status' => [
'name' => '验签状态',
'code' => 'verify_status',
'description' => '通知验签状态字典',
'list' => [
['name' => '未知', 'value' => 0],
['name' => '成功', 'value' => 1],
['name' => '失败', 'value' => 2],
],
],
'process_status' => [
'name' => '处理状态',
'code' => 'process_status',
'description' => '通知处理状态字典',
'list' => [
['name' => '待处理', 'value' => 0],
['name' => '成功', 'value' => 1],
['name' => '失败', 'value' => 2],
],
],
'ledger_biz_type' => [
'name' => '流水业务类型',
'code' => 'ledger_biz_type',
'description' => '商户账户流水业务类型字典',
'list' => [
['name' => '支付冻结', 'value' => 0],
['name' => '支付扣费', 'value' => 1],
['name' => '支付释放', 'value' => 2],
['name' => '清算入账', 'value' => 3],
['name' => '退款冲正', 'value' => 4],
['name' => '人工调整', 'value' => 5],
],
],
'ledger_event_type' => [
'name' => '流水事件类型',
'code' => 'ledger_event_type',
'description' => '商户账户流水事件类型字典',
'list' => [
['name' => '创建', 'value' => 0],
['name' => '成功', 'value' => 1],
['name' => '失败', 'value' => 2],
['name' => '冲正', 'value' => 3],
],
],
'ledger_direction' => [
'name' => '流水方向',
'code' => 'ledger_direction',
'description' => '商户账户流水方向字典',
'list' => [
['name' => '入账', 'value' => 0],
['name' => '出账', 'value' => 1],
],
],
];

View File

@@ -1,8 +1,5 @@
<?php
return [
// 系统配置更新后重新加载缓存
'system.config.updated' => [
[app\events\SystemConfig::class, 'reload'],
],
'system.config.changed' => [app\listener\SystemConfigChangedListener::class, 'refreshRuntimeCache'],
];

View File

@@ -1,19 +0,0 @@
<?php
/**
* JWT 配置
*/
return [
// JWT 密钥(请在生产环境修改为强随机字符串)
'secret' => env('JWT_SECRET', 'mpay-admin-secret-key-change-in-production'),
// Token 有效期(秒),默认 2 小时
'ttl' => (int)env('JWT_TTL', 7200),
// 加密算法
'alg' => env('JWT_ALG', 'HS256'),
// Token 缓存前缀(用于 Redis 存储)
'cache_prefix' => env('JWT_CACHE_PREFIX', 'token_'),
];

File diff suppressed because it is too large Load Diff

View File

@@ -12,4 +12,5 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [];
return [
];

View File

@@ -1,4 +0,0 @@
<?php
return [
'enable' => true,
];

View File

@@ -1,7 +0,0 @@
<?php
use Webman\RedisQueue\Command\MakeConsumerCommand;
return [
MakeConsumerCommand::class
];

View File

@@ -1,32 +0,0 @@
<?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],
],
]
],
]
];

View File

@@ -1,11 +0,0 @@
<?php
return [
'consumer' => [
'handler' => Webman\RedisQueue\Process\Consumer::class,
'count' => 8, // 可以设置多进程同时消费
'constructor' => [
// 消费者类目录
'consumer_dir' => app_path() . '/jobs'
]
]
];

View File

@@ -1,21 +0,0 @@
<?php
return [
'default' => [
'host' => 'redis://' . env('REDIS_HOST', '127.0.0.1') . ':' . env('REDIS_PORT', 6379),
'options' => [
'auth' => env('REDIS_PASSWORD', ''),
'db' => env('QUEUE_REDIS_DATABASE', 0),
'prefix' => env('QUEUE_REDIS_PREFIX', 'ma:queue:'),
'max_attempts' => 5,
'retry_seconds' => 5,
],
// Connection pool, supports only Swoole or Swow drivers.
'pool' => [
'max_connections' => 5,
'min_connections' => 1,
'wait_timeout' => 3,
'idle_timeout' => 60,
'heartbeat_interval' => 50,
]
],
];

View File

@@ -1,6 +1,6 @@
<?php
use app\exceptions\ValidationException;
use support\validation\ValidationException;
return [
'enable' => true,

View File

@@ -1,5 +1,4 @@
<?php
/**
* This file is part of webman.
*
@@ -26,19 +25,5 @@ return [
'idle_timeout' => 60,
'heartbeat_interval' => 50,
],
],
'cache' => [
'password' => env('REDIS_PASSWORD', ''),
'host' => env('REDIS_HOST', '127.0.0.1'),
'port' => env('REDIS_PORT', 6379),
'database' => env('CACHE_REDIS_DATABASE', 1),
'prefix' => 'ma:cache:',
'pool' => [
'max_connections' => 5,
'min_connections' => 1,
'wait_timeout' => 3,
'idle_timeout' => 60,
'heartbeat_interval' => 50,
],
],
]
];

View File

@@ -1,5 +1,4 @@
<?php
/**
* This file is part of webman.
*
@@ -14,16 +13,19 @@
*/
use Webman\Route;
use support\Response;
use support\Request;
use support\Response;
// 管理后台路由
require_once base_path() . '/app/routes/admin.php';
require_once app_path('route/admin.php');
// API 路由
require_once base_path() . '/app/routes/api.php';
// 商户后台路由
require_once app_path('route/mer.php');
// 匹配所有options路由CORS 预检请求)
// 用户路由
require_once app_path('route/api.php');
// 预检路由
Route::options('[{path:.+}]', function (Request $request){
$response = response('', 204);
return $response->withHeaders([
@@ -33,7 +35,11 @@ Route::options('[{path:.+}]', function (Request $request){
'Access-Control-Allow-Headers' => $request->header('access-control-request-headers', '*'),
]);
});
/**
* 关闭默认路由
*/
// 关闭默认路由
Route::disableDefaultRoute();

View File

@@ -1,45 +0,0 @@
[
{
"name": "性别",
"code": "gender",
"description": "这是一个性别字典",
"list": [
{ "name": "女", "value": 0 },
{ "name": "男", "value": 1 },
{ "name": "其它", "value": 2 }
]
},
{
"name": "状态",
"code": "status",
"description": "状态字段可以用这个",
"list": [
{ "name": "禁用", "value": 0 },
{ "name": "启用", "value": 1 }
]
},
{
"name": "岗位",
"code": "post",
"description": "岗位字段",
"list": [
{ "name": "总经理", "value": 1 },
{ "name": "总监", "value": 2 },
{ "name": "人事主管", "value": 3 },
{ "name": "开发部主管", "value": 4 },
{ "name": "普通职员", "value": 5 },
{ "name": "其它", "value": 999 }
]
},
{
"name": "任务状态",
"code": "taskStatus",
"description": "任务状态字段可以用它",
"list": [
{ "name": "失败", "value": 0 },
{ "name": "成功", "value": 1 }
]
}
]

File diff suppressed because it is too large Load Diff

View File

@@ -1,137 +0,0 @@
# 系统菜单配置
## 配置说明
系统菜单基于路由配置实现,以下是完整的菜单路由配置项说明,所有配置项均为 JSON 格式,可直接用于前端路由解析。
## 核心配置结构
```json
{
"id": "01",
"parentId": "0",
"path": "/home",
"name": "home",
"component": "home/home",
"meta": {
"title": "home",
"hide": false,
"disable": false,
"keepAlive": false,
"affix": true,
"link": "",
"iframe": false,
"isFull": false,
"roles": ["admin", "common"],
"svgIcon": "home",
"icon": "",
"sort": 1,
"type": 2
},
"children": null
}
```
## 字段详细说明
| 一级字段 | 类型 | 必填 | 说明 |
|----------|--------|------|----------------------------------------------------------------------|
| `id` | string | 是 | 路由唯一标识,建议按「层级+序号」命名(如 01=首页0201=订单管理)|
| `parentId` | string | 是 | 父路由ID顶层路由固定为 `0`,子路由对应父路由的 `id` |
| `path` | string | 是 | 路由访问路径(如 `/home``/order/order-list`|
| `name` | string | 是 | 路由名称,需与组件名/路径名保持一致,用于路由跳转标识 |
| `component` | string | 否 | 组件文件路径(基于 `src/views` 目录),如 `home/home` 对应 `src/views/home/home.vue`;目录级路由可省略 |
| `meta` | object | 是 | 路由元信息,包含菜单展示、权限、样式等核心配置 |
| `children` | array | 否 | 子路由列表,目录级路由(`type:1`)需配置,菜单级路由(`type:2`)默认为 `null` |
### `meta` 子字段说明
| 子字段 | 类型 | 必填 | 默认值 | 说明 |
|-----------|---------|------|--------|----------------------------------------------------------------------|
| `title` | string | 是 | - | 菜单显示标题:<br>1. 填写国际化key`home`),自动匹配多语言;<br>2. 无对应key则直接展示文字 |
| `hide` | boolean | 否 | false | 是否隐藏菜单:<br>✅ true = 不显示在侧边栏,但可正常访问;<br>❌ false = 正常显示 |
| `disable` | boolean | 否 | false | 是否停用路由:<br>✅ true = 不显示+不可访问;<br>❌ false = 正常可用 |
| `keepAlive` | boolean | 否 | false | 是否缓存组件:<br>✅ true = 切换路由不销毁组件;<br>❌ false = 切换后销毁 |
| `affix` | boolean | 否 | false | 是否固定在标签栏:<br>✅ true = 标签栏无关闭按钮;<br>❌ false = 可关闭 |
| `link` | string | 否 | "" | 外链地址,填写后路由跳转至该地址(优先级高于 `component`|
| `iframe` | boolean | 否 | false | 是否内嵌外链:<br>✅ true = 在页面内以iframe展示 `link` 地址;<br>❌ false = 跳转新页面 |
| `isFull` | boolean | 否 | false | 是否全屏显示:<br>✅ true = 菜单页面占满整个视口;<br>❌ false = 保留侧边栏/头部 |
| `roles` | array | 否 | [] | 路由权限角色:<br>`["admin", "common"]`,仅对应角色可访问该菜单 |
| `svgIcon` | string | 否 | "" | SVG菜单图标<br>优先级高于 `icon`,取值为 `src/assets/svgs` 目录下的SVG文件名 |
| `icon` | string | 否 | "" | 普通图标:<br>默认使用 Arco Design 图标库,填写图标名(如 `icon-file`)即可 |
| `sort` | number | 否 | 0 | 菜单排序:数值越小,展示越靠前 |
| `type` | number | 是 | - | 路由类型:<br>1 = 目录(仅作为父级,无组件);<br>2 = 菜单(可访问的页面);<br>3 = 按钮(权限控制用) |
## 配置示例
### 1. 顶层菜单(首页)
```json
{
"id": "01",
"parentId": "0",
"path": "/home",
"name": "home",
"component": "home/home",
"meta": {
"title": "平台首页",
"hide": false,
"disable": false,
"keepAlive": false,
"affix": true,
"link": "",
"iframe": false,
"isFull": false,
"roles": ["admin", "common"],
"svgIcon": "home",
"icon": "",
"sort": 1,
"type": 2
},
"children": null
}
```
### 2. 目录级路由(收款订单)
```json
{
"id": "02",
"parentId": "0",
"path": "/order",
"name": "order",
"redirect": "/order/order-list",
"meta": {
"title": "收款订单",
"hide": false,
"disable": false,
"keepAlive": true,
"affix": false,
"link": "",
"iframe": false,
"isFull": false,
"roles": ["admin", "common"],
"svgIcon": "order",
"icon": "",
"sort": 2,
"type": 1
},
"children": [
{
"id": "0201",
"parentId": "02",
"path": "/order/order-list",
"name": "order-list",
"component": "order/order-list/index",
"meta": {
"title": "订单管理",
"hide": false,
"disable": false,
"keepAlive": true,
"affix": false,
"link": "",
"iframe": false,
"isFull": false,
"roles": ["admin", "common"],
"icon": "icon-file",
"sort": 1,
"type": 2
},
"children": null
}
]
}
```

608
config/system_config.php Normal file
View File

@@ -0,0 +1,608 @@
<?php
use app\common\constant\FileConstant;
return [
'base' => [
'title' => '基础配置',
'icon' => 'icon-settings',
'description' => '站点基础信息、站点 URL、页面默认值与展示文案。',
'sort' => 1,
'disabled' => false,
'rules' => [
[
'type' => 'input',
'field' => 'site_name',
'title' => '站点名称',
'value' => '',
'props' => [
'placeholder' => '请输入站点名称',
],
'validate' => [
['required' => true, 'message' => '站点名称不能为空'],
],
],
[
'type' => 'textarea',
'field' => 'site_description',
'title' => '站点描述',
'value' => '',
'props' => [
'placeholder' => '请输入站点描述',
'autoSize' => [
'minRows' => 3,
'maxRows' => 6,
],
],
],
[
'type' => 'upload',
'field' => 'site_logo',
'title' => '站点 Logo',
'value' => '',
'props' => [
'fileUpload' => [
'scene' => FileConstant::SCENE_IMAGE,
'visibility' => FileConstant::VISIBILITY_PUBLIC,
'accept' => '.jpg,.jpeg,.png,.gif,.webp,.bmp,.svg',
'listType' => 'picture-card',
'showFileList' => true,
'imagePreview' => true,
'limit' => 1,
],
'tip' => '建议上传清晰的图片 Logo推荐使用 PNG 或 SVG 格式。',
],
],
[
'type' => 'input',
'field' => 'site_url',
'title' => '站点 URL',
'value' => '',
'props' => [
'placeholder' => '请输入站点 URL例如 https://pay.example.com',
],
'validate' => [
['required' => true, 'message' => '站点 URL 不能为空'],
],
],
[
'type' => 'input',
'field' => 'site_icp',
'title' => '备案号',
'value' => '',
'props' => [
'placeholder' => '请输入备案号',
],
],
[
'type' => 'select',
'field' => 'default_page_size',
'title' => '默认分页条数',
'value' => '20',
'props' => [
'placeholder' => '请选择默认分页条数',
],
'options' => [
['label' => '10', 'value' => '10'],
['label' => '20', 'value' => '20'],
['label' => '50', 'value' => '50'],
['label' => '100', 'value' => '100'],
],
],
],
],
'storage' => [
'title' => '存储配置',
'icon' => 'icon-storage',
'description' => '文件上传、图片素材、证书和对象存储的统一配置。',
'sort' => 2,
'disabled' => false,
'rules' => [
[
'type' => 'radio',
'field' => 'file_storage_default_engine',
'title' => '默认存储引擎',
'value' => '1',
'options' => [
['label' => '本地存储', 'value' => (string) FileConstant::STORAGE_LOCAL],
['label' => '阿里云 OSS', 'value' => (string) FileConstant::STORAGE_ALIYUN_OSS],
['label' => '腾讯云 COS', 'value' => (string) FileConstant::STORAGE_TENCENT_COS],
],
'control' => [
[
'rule' => [
'file_storage_local_public_base_url',
'file_storage_local_public_dir',
'file_storage_local_private_dir',
],
'value' => (string) FileConstant::STORAGE_LOCAL,
'method' => 'display',
],
[
'rule' => [
'file_storage_aliyun_oss_region',
'file_storage_aliyun_oss_endpoint',
'file_storage_aliyun_oss_bucket',
'file_storage_aliyun_oss_access_key_id',
'file_storage_aliyun_oss_access_key_secret',
'file_storage_aliyun_oss_public_domain',
],
'value' => (string) FileConstant::STORAGE_ALIYUN_OSS,
'method' => 'display',
],
[
'rule' => [
'file_storage_tencent_cos_region',
'file_storage_tencent_cos_bucket',
'file_storage_tencent_cos_secret_id',
'file_storage_tencent_cos_secret_key',
'file_storage_tencent_cos_public_domain',
],
'value' => (string) FileConstant::STORAGE_TENCENT_COS,
'method' => 'display',
],
],
],
[
'type' => 'input',
'field' => 'file_storage_upload_max_size_mb',
'title' => '上传大小限制',
'value' => '20',
'props' => [
'placeholder' => '请输入上传大小限制,单位 MB',
],
],
[
'type' => 'input',
'field' => 'file_storage_remote_download_limit_mb',
'title' => '远程下载限制',
'value' => '10',
'props' => [
'placeholder' => '请输入远程下载限制,单位 MB',
],
],
[
'type' => 'input',
'field' => 'file_storage_allowed_extensions',
'title' => '允许扩展名',
'value' => 'jpg,jpeg,png,gif,webp,bmp,svg,pem,crt,cer,key,p12,pfx,txt,log,csv,json,xml,md,ini,conf,yaml,yml',
'props' => [
'placeholder' => '请输入允许上传的扩展名,英文逗号分隔',
],
],
[
'type' => 'a-divider',
'field' => '__storage_engine_divider__',
'title' => '存储引擎配置',
'value' => '',
'props' => [
'orientation' => 'left',
'margin' => 16,
],
'children' => [
'存储引擎配置',
],
],
[
'type' => 'input',
'field' => 'file_storage_local_public_base_url',
'title' => '本地公开 Base URL',
'value' => '',
'props' => [
'placeholder' => '请输入本地公开访问前缀,留空时自动使用站点 URL',
],
],
[
'type' => 'input',
'field' => 'file_storage_local_public_dir',
'title' => '本地公开目录',
'value' => 'storage/uploads',
'props' => [
'placeholder' => '请输入本地公开目录,例如 storage/uploads',
],
],
[
'type' => 'input',
'field' => 'file_storage_local_private_dir',
'title' => '本地私有目录',
'value' => 'storage/private',
'props' => [
'placeholder' => '请输入本地私有目录,例如 storage/private',
],
],
[
'type' => 'input',
'field' => 'file_storage_aliyun_oss_region',
'title' => '阿里云 OSS Region',
'value' => '',
'props' => [
'placeholder' => '请输入阿里云 OSS Region例如 oss-cn-hangzhou',
],
],
[
'type' => 'input',
'field' => 'file_storage_aliyun_oss_endpoint',
'title' => '阿里云 OSS Endpoint',
'value' => '',
'props' => [
'placeholder' => '请输入阿里云 OSS Endpoint',
],
],
[
'type' => 'input',
'field' => 'file_storage_aliyun_oss_bucket',
'title' => '阿里云 OSS Bucket',
'value' => '',
'props' => [
'placeholder' => '请输入阿里云 OSS Bucket',
],
],
[
'type' => 'input',
'field' => 'file_storage_aliyun_oss_access_key_id',
'title' => '阿里云 OSS Access Key ID',
'value' => '',
'props' => [
'placeholder' => '请输入阿里云 OSS Access Key ID',
],
],
[
'type' => 'input',
'field' => 'file_storage_aliyun_oss_access_key_secret',
'title' => '阿里云 OSS Access Key Secret',
'value' => '',
'props' => [
'placeholder' => '请输入阿里云 OSS Access Key Secret',
],
],
[
'type' => 'input',
'field' => 'file_storage_aliyun_oss_public_domain',
'title' => '阿里云 OSS 公开域名',
'value' => '',
'props' => [
'placeholder' => '请输入阿里云 OSS 公开域名,可选',
],
],
[
'type' => 'input',
'field' => 'file_storage_tencent_cos_region',
'title' => '腾讯云 COS Region',
'value' => '',
'props' => [
'placeholder' => '请输入腾讯云 COS Region例如 ap-shanghai',
],
],
[
'type' => 'input',
'field' => 'file_storage_tencent_cos_bucket',
'title' => '腾讯云 COS Bucket',
'value' => '',
'props' => [
'placeholder' => '请输入腾讯云 COS Bucket',
],
],
[
'type' => 'input',
'field' => 'file_storage_tencent_cos_secret_id',
'title' => '腾讯云 COS SecretId',
'value' => '',
'props' => [
'placeholder' => '请输入腾讯云 COS SecretId',
],
],
[
'type' => 'input',
'field' => 'file_storage_tencent_cos_secret_key',
'title' => '腾讯云 COS SecretKey',
'value' => '',
'props' => [
'placeholder' => '请输入腾讯云 COS SecretKey',
],
],
[
'type' => 'input',
'field' => 'file_storage_tencent_cos_public_domain',
'title' => '腾讯云 COS 公开域名',
'value' => '',
'props' => [
'placeholder' => '请输入腾讯云 COS 公开域名,可选',
],
],
],
],
'merchant' => [
'title' => '商户配置',
'icon' => 'icon-user-group',
'description' => '商户后台展示、资料和辅助能力配置。',
'sort' => 3,
'disabled' => false,
'rules' => [
[
'type' => 'input',
'field' => 'merchant_service_name',
'title' => '客服名称',
'value' => '',
'props' => [
'placeholder' => '请输入客服名称',
],
],
[
'type' => 'input',
'field' => 'merchant_service_phone',
'title' => '客服电话',
'value' => '',
'props' => [
'placeholder' => '请输入客服电话',
],
],
[
'type' => 'input',
'field' => 'merchant_service_email',
'title' => '客服邮箱',
'value' => '',
'props' => [
'placeholder' => '请输入客服邮箱',
],
],
[
'type' => 'textarea',
'field' => 'merchant_notice',
'title' => '商户公告',
'value' => '',
'props' => [
'placeholder' => '请输入商户公告',
'autoSize' => [
'minRows' => 3,
'maxRows' => 6,
],
],
],
],
],
'channel' => [
'title' => '通道配置',
'icon' => 'icon-apps',
'description' => '通道调度、同步和基础运维参数。',
'sort' => 4,
'disabled' => false,
'rules' => [
[
'type' => 'select',
'field' => 'channel_sync_interval',
'title' => '同步间隔',
'value' => '10',
'props' => [
'placeholder' => '请选择同步间隔',
],
'options' => [
['label' => '5 分钟', 'value' => '5'],
['label' => '10 分钟', 'value' => '10'],
['label' => '30 分钟', 'value' => '30'],
['label' => '60 分钟', 'value' => '60'],
],
],
[
'type' => 'input',
'field' => 'channel_default_timeout',
'title' => '默认超时时间',
'value' => '60',
'props' => [
'placeholder' => '请输入默认超时时间,单位秒',
],
],
[
'type' => 'input',
'field' => 'channel_retry_limit',
'title' => '同步重试次数',
'value' => '3',
'props' => [
'placeholder' => '请输入同步重试次数',
],
],
[
'type' => 'textarea',
'field' => 'channel_notice',
'title' => '通道说明',
'value' => '',
'props' => [
'placeholder' => '请输入通道说明',
'autoSize' => [
'minRows' => 3,
'maxRows' => 6,
],
],
],
],
],
'payment' => [
'title' => '支付配置',
'icon' => 'icon-safe',
'description' => '支付时效、通知重试和支付流程相关参数。',
'sort' => 5,
'disabled' => false,
'rules' => [
[
'type' => 'input',
'field' => 'pay_order_expire_minutes',
'title' => '订单有效期',
'value' => '30',
'props' => [
'placeholder' => '请输入订单有效期,单位分钟',
],
'validate' => [
['required' => true, 'message' => '订单有效期不能为空'],
],
],
[
'type' => 'input',
'field' => 'pay_notify_retry_limit',
'title' => '通知重试次数',
'value' => '3',
'props' => [
'placeholder' => '请输入通知重试次数',
],
],
[
'type' => 'input',
'field' => 'pay_notify_retry_interval',
'title' => '通知重试间隔',
'value' => '10',
'props' => [
'placeholder' => '请输入通知重试间隔,单位分钟',
],
],
[
'type' => 'input',
'field' => 'pay_callback_timeout_seconds',
'title' => '回调超时',
'value' => '60',
'props' => [
'placeholder' => '请输入回调超时时间,单位秒',
],
],
],
],
'notice' => [
'title' => '通知配置',
'icon' => 'icon-notification',
'description' => '通知开关、频率和失败重试策略。',
'sort' => 6,
'disabled' => false,
'rules' => [
[
'type' => 'select',
'field' => 'notice_enabled',
'title' => '通知开关',
'value' => '1',
'props' => [
'placeholder' => '请选择通知开关',
],
'options' => [
['label' => '禁用', 'value' => '0'],
['label' => '启用', 'value' => '1'],
],
],
[
'type' => 'input',
'field' => 'notice_retry_limit',
'title' => '通知重试次数',
'value' => '3',
'props' => [
'placeholder' => '请输入通知重试次数',
],
],
[
'type' => 'input',
'field' => 'notice_retry_interval',
'title' => '通知重试间隔',
'value' => '10',
'props' => [
'placeholder' => '请输入通知重试间隔,单位分钟',
],
],
[
'type' => 'input',
'field' => 'notice_webhook_url',
'title' => '通知地址',
'value' => '',
'props' => [
'placeholder' => '请输入通知地址',
],
],
],
],
'risk' => [
'title' => '风控配置',
'icon' => 'icon-fire',
'description' => '基础风控阈值和限制策略。',
'sort' => 7,
'disabled' => false,
'rules' => [
[
'type' => 'select',
'field' => 'risk_enabled',
'title' => '风控开关',
'value' => '1',
'props' => [
'placeholder' => '请选择风控开关',
],
'options' => [
['label' => '禁用', 'value' => '0'],
['label' => '启用', 'value' => '1'],
],
],
[
'type' => 'input',
'field' => 'risk_ip_limit',
'title' => 'IP 限制阈值',
'value' => '20',
'props' => [
'placeholder' => '请输入 IP 限制阈值',
],
],
[
'type' => 'input',
'field' => 'risk_order_limit',
'title' => '订单限制阈值',
'value' => '100',
'props' => [
'placeholder' => '请输入订单限制阈值',
],
],
[
'type' => 'textarea',
'field' => 'risk_notice',
'title' => '风控说明',
'value' => '',
'props' => [
'placeholder' => '请输入风控说明',
'autoSize' => [
'minRows' => 3,
'maxRows' => 6,
],
],
],
],
],
'other' => [
'title' => '其他配置',
'icon' => 'icon-folder',
'description' => '未归类到其它模块的补充配置。',
'sort' => 8,
'disabled' => false,
'rules' => [
[
'type' => 'input',
'field' => 'default_timezone',
'title' => '默认时区',
'value' => 'Asia/Shanghai',
'props' => [
'placeholder' => '请输入默认时区',
],
],
[
'type' => 'input',
'field' => 'default_currency',
'title' => '默认币种',
'value' => 'CNY',
'props' => [
'placeholder' => '请输入默认币种',
],
],
[
'type' => 'textarea',
'field' => 'system_note',
'title' => '系统备注',
'value' => '',
'props' => [
'placeholder' => '请输入系统备注',
'autoSize' => [
'minRows' => 3,
'maxRows' => 6,
],
],
],
],
],
];