🚀 SaaS 多租户平台

ThinkPHP 8.0 + RESTful API + 开放平台
📍 当前访问地址(请使用以下地址访问):

  • 本页面:./start.html
  • 管理后台:./admin/
  • 数据库初始化:./init.php
  • API 测试:./test.html

🎯 快速开始 - 3 个步骤

1

配置数据库连接

编辑项目根目录下的 .env 文件,配置数据库连接信息:

[DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = saas_platform USERNAME = root PASSWORD = your_password HOSTPORT = 3306 CHARSET = utf8mb4
2

初始化数据库和测试数据

点击下方按钮或直接访问 ./init.php?step=99 一键完成:

✨ 初始化内容:
  • 创建所有数据表(用户、租户、套餐、订阅、订单、API Key、日志等)
  • 生成管理员账号:admin / admin123
  • 创建 3 个基础套餐(基础版、专业版、企业版)
  • 创建 3 个测试租户
  • 生成测试订单和订阅数据
  • 生成测试 API Key 和调用日志
3

开始使用平台

初始化完成后,你可以:

✨ 平台核心功能

👥

多租户管理

完整的租户生命周期管理,支持租户独立数据隔离,灵活的套餐配置和订阅管理

🔑

API Key 开放平台

支持 API Key 生成、重置、禁用、撤销,IP 白名单限制,调用次数统计和限流控制

💰

订单与支付系统

完整的订单管理,支付回调处理,财务报表,支持多种套餐类型和计费模式

📦

套餐订阅管理

灵活的套餐配置,支持月度/年度订阅,自动续费,到期提醒,订阅状态追踪

📊

运营数据仪表板

实时数据统计,租户画像,订单分析,API 调用监控,使用趋势图表

🔐

权限与安全控制

JWT 认证,角色权限管理,操作审计日志,登录日志,数据安全保障

🌐

开放 API 接口

完整的 RESTful API,统一响应格式,OpenAPI 3.0 规范,多语言 SDK 示例

🔌

Webhook 事件通知

订阅创建、订单支付、Key 变更等事件实时推送,支持自定义事件和签名验证

🔌 核心 API 接口

📌 统一响应格式: 所有接口返回 { "code": 200, "msg": "ok", "data": {...} }

开放 API(使用 API Key 认证)

GET /open/ping 健康检查
POST /open/verify-key 验证 API Key
GET /open/tenant/info 获取当前租户信息
GET /open/subscription/status 获取订阅状态
GET /open/packages 获取套餐列表
GET /open/orders 获取订单列表
GET /open/usage-stats 获取 API 使用统计
GET /open/endpoints 获取所有可用端点

管理后台 API(需要 JWT 认证)

POST /api/plat/auth/login 管理员登录
GET /api/plat/dashboard 获取仪表板数据
GET /api/plat/tenant/list 租户列表
GET /api/plat/api-key/list API Key 列表
POST /api/plat/api-key/create 创建 API Key
POST /api/plat/api-key/reset-secret/:id 重置 Secret

API 文档接口

GET /api-doc/openapi.json OpenAPI 3.0 规范文档
GET /api-doc/overview 接口分组概览
GET /api-doc/sdk SDK 示例代码
GET /api-doc/webhook Webhook 事件列表
GET /api-doc/status 平台服务状态

📝 测试账号与数据

✅ 默认测试账号:
  • 管理员账号:admin / admin123
  • 登录入口:./admin/POST /api/plat/auth/login
📦

套餐数据

• 基础版(¥99/月)
• 专业版(¥299/月)
• 企业版(¥999/月)

🏢

测试租户

自动生成 3 个测试租户
各分配不同套餐

📋

订单数据

每个租户自动生成 3 个测试订单
包含不同状态和金额

🔑

API Key

每个租户自动生成 2-3 个测试 Key
含不同过期策略和权限配置

⚠️ 重要提示

🛡️ 安全提示:
1. 生产环境请务必删除或限制访问 ./init.php./test.html
2. 立即修改默认管理员密码:admin / admin123
3. 配置正确的数据库连接,避免使用 root 账号
4. API Key 的 Secret 仅在创建时显示一次,请妥善保存
5. 所有 API 调用都会记录日志,包括调用者 IP、时间、参数等
✅ 开发环境快速测试:
1. 确保 PHP 内置服务器运行:php -S 127.0.0.1:8000 -t public
2. 访问 ./start.html 查看本页面
3. 点击 "🚀 一键初始化" 完成数据库初始化
4. 进入 ./admin/ 开始使用管理后台

🎊 开始使用

所有功能模块已就绪,现在就可以开始你的 SaaS 平台之旅!

© 2026 SaaS 多租户平台 | ThinkPHP 8.0 | 版本 1.0.0

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-09-25 00:41:44 HTTP/2.0 GET : https://saas.lysq.vip/sitemap.xml
  2. 运行时间 : 0.036786s [ 吞吐率:27.18req/s ] 内存消耗:2,703.41kb 文件加载:123
  3. 缓存信息 : 0 reads,0 writes
  1. /www/wwwroot/saas.lysq.vip/public/index.php ( 0.74 KB )
  2. /www/wwwroot/saas.lysq.vip/vendor/autoload.php ( 0.73 KB )
  3. /www/wwwroot/saas.lysq.vip/vendor/composer/autoload_real.php ( 1.63 KB )
  4. /www/wwwroot/saas.lysq.vip/vendor/composer/platform_check.php ( 0.90 KB )
  5. /www/wwwroot/saas.lysq.vip/vendor/composer/ClassLoader.php ( 15.99 KB )
  6. /www/wwwroot/saas.lysq.vip/vendor/composer/autoload_static.php ( 9.51 KB )
  7. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /www/wwwroot/saas.lysq.vip/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  9. /www/wwwroot/saas.lysq.vip/vendor/symfony/polyfill-php80/bootstrap.php ( 1.50 KB )
  10. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  11. /www/wwwroot/saas.lysq.vip/vendor/symfony/polyfill-mbstring/bootstrap.php ( 0.35 KB )
  12. /www/wwwroot/saas.lysq.vip/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.86 KB )
  13. /www/wwwroot/saas.lysq.vip/vendor/ralouphie/getallheaders/src/getallheaders.php ( 1.60 KB )
  14. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  15. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  16. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  17. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  18. /www/wwwroot/saas.lysq.vip/vendor/guzzlehttp/guzzle/src/functions_include.php ( 0.16 KB )
  19. /www/wwwroot/saas.lysq.vip/vendor/guzzlehttp/guzzle/src/functions.php ( 10.05 KB )
  20. /www/wwwroot/saas.lysq.vip/vendor/symfony/translation/Resources/functions.php ( 0.55 KB )
  21. /www/wwwroot/saas.lysq.vip/vendor/qiniu/php-sdk/src/Qiniu/functions.php ( 10.13 KB )
  22. /www/wwwroot/saas.lysq.vip/vendor/qiniu/php-sdk/src/Qiniu/Config.php ( 10.19 KB )
  23. /www/wwwroot/saas.lysq.vip/vendor/qiniu/php-sdk/src/Qiniu/Http/Middleware/Middleware.php ( 0.68 KB )
  24. /www/wwwroot/saas.lysq.vip/vendor/symfony/var-dumper/Resources/functions/dump.php ( 0.99 KB )
  25. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  26. /www/wwwroot/saas.lysq.vip/vendor/symfony/var-dumper/VarDumper.php ( 3.73 KB )
  27. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  28. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  29. /www/wwwroot/saas.lysq.vip/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  30. /www/wwwroot/saas.lysq.vip/app/provider.php ( 0.19 KB )
  31. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Http.php ( 6.22 KB )
  32. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  33. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  34. /www/wwwroot/saas.lysq.vip/app/common.php ( 10.72 KB )
  35. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/helper.php ( 18.77 KB )
  36. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Config.php ( 5.93 KB )
  37. /www/wwwroot/saas.lysq.vip/config/app.php ( 0.95 KB )
  38. /www/wwwroot/saas.lysq.vip/config/cache.php ( 0.78 KB )
  39. /www/wwwroot/saas.lysq.vip/config/console.php ( 0.44 KB )
  40. /www/wwwroot/saas.lysq.vip/config/cookie.php ( 0.56 KB )
  41. /www/wwwroot/saas.lysq.vip/config/database.php ( 1.38 KB )
  42. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  43. /www/wwwroot/saas.lysq.vip/config/filesystem.php ( 0.61 KB )
  44. /www/wwwroot/saas.lysq.vip/config/lang.php ( 0.91 KB )
  45. /www/wwwroot/saas.lysq.vip/config/log.php ( 1.35 KB )
  46. /www/wwwroot/saas.lysq.vip/config/middleware.php ( 0.64 KB )
  47. /www/wwwroot/saas.lysq.vip/config/route.php ( 1.89 KB )
  48. /www/wwwroot/saas.lysq.vip/config/session.php ( 0.57 KB )
  49. /www/wwwroot/saas.lysq.vip/config/trace.php ( 0.34 KB )
  50. /www/wwwroot/saas.lysq.vip/config/view.php ( 0.86 KB )
  51. /www/wwwroot/saas.lysq.vip/app/event.php ( 0.25 KB )
  52. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Event.php ( 7.77 KB )
  53. /www/wwwroot/saas.lysq.vip/app/service.php ( 0.13 KB )
  54. /www/wwwroot/saas.lysq.vip/app/AppService.php ( 0.26 KB )
  55. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  56. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  57. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  58. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  59. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  60. /www/wwwroot/saas.lysq.vip/vendor/services.php ( 0.15 KB )
  61. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  62. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  63. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  64. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  65. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  66. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  67. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  68. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  69. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  70. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  71. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.20 KB )
  72. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.75 KB )
  73. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  74. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  75. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.30 KB )
  76. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  77. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  78. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  79. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  80. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  81. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  82. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  83. /www/wwwroot/saas.lysq.vip/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  84. /www/wwwroot/saas.lysq.vip/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  85. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  86. /www/wwwroot/saas.lysq.vip/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  87. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-helper/src/helper/Arr.php ( 17.45 KB )
  88. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  89. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/cache/Driver.php ( 9.02 KB )
  90. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  91. /www/wwwroot/saas.lysq.vip/app/Request.php ( 0.09 KB )
  92. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Request.php ( 54.64 KB )
  93. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/traits/UrlHandler.php ( 6.05 KB )
  94. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/traits/DomainHandler.php ( 5.49 KB )
  95. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/traits/HttpMethodHandler.php ( 4.74 KB )
  96. /www/wwwroot/saas.lysq.vip/app/middleware.php ( 0.26 KB )
  97. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  98. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  99. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  100. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/route/RuleName.php ( 5.74 KB )
  101. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  102. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.41 KB )
  103. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/route/Rule.php ( 27.49 KB )
  104. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  105. /www/wwwroot/saas.lysq.vip/route/app.php ( 41.63 KB )
  106. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  107. /www/wwwroot/saas.lysq.vip/apps/trade_security/route.php ( 3.71 KB )
  108. /www/wwwroot/saas.lysq.vip/plugins/alipay_login/route.php ( 0.51 KB )
  109. /www/wwwroot/saas.lysq.vip/plugins/dingtalk_notify/route.php ( 0.55 KB )
  110. /www/wwwroot/saas.lysq.vip/plugins/email_notify/route.php ( 0.54 KB )
  111. /www/wwwroot/saas.lysq.vip/plugins/payment_gateway/route.php ( 1.10 KB )
  112. /www/wwwroot/saas.lysq.vip/plugins/sms_notify/route.php ( 0.51 KB )
  113. /www/wwwroot/saas.lysq.vip/plugins/wechat_login/route.php ( 0.51 KB )
  114. /www/wwwroot/saas.lysq.vip/plugins/wecom_notify/route.php ( 0.44 KB )
  115. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/route/dispatch/Callback.php ( 3.78 KB )
  116. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/route/Dispatch.php ( 11.32 KB )
  117. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Response.php ( 9.07 KB )
  118. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/response/Html.php ( 0.97 KB )
  119. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  120. /www/wwwroot/saas.lysq.vip/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  121. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/log/driver/File.php ( 6.10 KB )
  122. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  123. /www/wwwroot/saas.lysq.vip/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
0.038540s