签入版本
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
//
|
||||
// themeConfig: {
|
||||
// editLink: {
|
||||
// pattern: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp6_EleVue",
|
||||
// pattern: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp8_EleVue",
|
||||
// text: "Suggest changes to this page",
|
||||
// },
|
||||
//
|
||||
|
||||
@@ -87,7 +87,7 @@ export const sharedConfig = defineConfig({
|
||||
socialLinks: [
|
||||
{
|
||||
icon: "github",
|
||||
link: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp6_EleVue",
|
||||
link: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp8_EleVue",
|
||||
},
|
||||
],
|
||||
|
||||
@@ -98,7 +98,7 @@ export const sharedConfig = defineConfig({
|
||||
},
|
||||
|
||||
editLink: {
|
||||
pattern: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp6_EleVue",
|
||||
pattern: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp8_EleVue",
|
||||
text: "对本页提出修改建议",
|
||||
},
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { DefaultTheme, LocaleSpecificConfig } from "vitepress";
|
||||
|
||||
export const META_URL = "https://www.rxthink.cn";
|
||||
export const META_TITLE = "RXThinkCMF ThinkPHP6+ElementPlus 开发文档";
|
||||
export const META_TITLE = "RXThinkCMF ThinkPHP8+ElementPlus 开发文档";
|
||||
export const META_DESCRIPTION =
|
||||
"RXThinkCMF 企业级前后端分离后台管理系统 - ThinkPHP6.1 + Vue3 + ElementPlus";
|
||||
"RXThinkCMF 企业级前后端分离后台管理系统 - ThinkPHP8 + Vue3 + ElementPlus";
|
||||
|
||||
export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
|
||||
description: META_DESCRIPTION,
|
||||
@@ -17,7 +17,7 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
|
||||
|
||||
themeConfig: {
|
||||
editLink: {
|
||||
pattern: "https://gitee.com/rxthink/thinkphp6",
|
||||
pattern: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp8_EleVue",
|
||||
text: "对本页提出修改建议",
|
||||
},
|
||||
|
||||
@@ -147,7 +147,7 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
|
||||
text: "相关链接",
|
||||
items: [
|
||||
{ text: "官方网站", link: "https://www.rxthink.cn" },
|
||||
{ text: "Gitee 仓库", link: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp6_EleVue" },
|
||||
{ text: "Gitee 仓库", link: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp8_EleVue" },
|
||||
{ text: "ThinkPHP 官网", link: "https://www.thinkphp.cn/" },
|
||||
{ text: "Vue3 文档", link: "https://cn.vuejs.org/" },
|
||||
{ text: "ElementPlus", link: "https://element-plus.org/zh-CN/" },
|
||||
@@ -489,7 +489,7 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
|
||||
{ text: "K. 贡献指南", link: "/zh/other/contributing.html" },
|
||||
{ text: "L. 免责声明", link: "/zh/other/declare.html" },
|
||||
{ text: "M. 广告赞助", link: "/zh/other/sponsor.html" },
|
||||
{ text: "N. 开源协议", link: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp6_EleVue" },
|
||||
{ text: "N. 开源协议", link: "https://gitee.com/rxthinkcmf/RXThinkCMF_ThinkPhp8_EleVue" },
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 852 KiB After Width: | Height: | Size: 267 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 51 KiB |
@@ -234,7 +234,7 @@ BaseLogic::add()
|
||||
```ini
|
||||
; .env
|
||||
[FILE]
|
||||
UPLOAD_DIR = D:/uploads/rxthinkcmf ; 上传根目录
|
||||
UPLOAD_DIR = D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue\uploads ; 上传根目录
|
||||
DOMAIN_URL = https://cdn.example.com ; 文件访问域名
|
||||
MAX_SIZE = 10 ; 单文件最大 10MB
|
||||
IMAGE_EXT = jpg,jpeg,png,gif,bmp,webp,svg
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
```text
|
||||
document/
|
||||
├── mysql/rxthinkcmf.thinkphp6.elevue.sql # MySQL 版本
|
||||
├── postgresql/rxthinkcmf.thinkphp6.elevue.sql # PostgreSQL 版本
|
||||
├── sqlserver/rxthinkcmf.thinkphp6.elevue.sql # SQL Server 版本
|
||||
├── oracle/rxthinkcmf.thinkphp6.elevue.sql # Oracle 版本
|
||||
└── sqlite/rxthinkcmf.thinkphp6.elevue.sql # SQLite 版本
|
||||
├── mysql/rxthinkcmf.thinkphp8.elevue.sql # MySQL 版本
|
||||
├── postgresql/rxthinkcmf.thinkphp8.elevue.sql # PostgreSQL 版本
|
||||
├── sqlserver/rxthinkcmf.thinkphp8.elevue.sql # SQL Server 版本
|
||||
├── oracle/rxthinkcmf.thinkphp8.elevue.sql # Oracle 版本
|
||||
└── sqlite/rxthinkcmf.thinkphp8.elevue.sql # SQLite 版本
|
||||
```
|
||||
|
||||
各脚本已针对对应数据库的 SQL 语法做了适配,可直接导入使用。
|
||||
|
||||
@@ -294,7 +294,7 @@ ALTER TABLE think_city ADD INDEX idx_pid (pid);
|
||||
[DATABASE]
|
||||
TYPE = mysql
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue
|
||||
USERNAME = root
|
||||
PASSWORD = root
|
||||
HOSTPORT = 3306
|
||||
@@ -304,7 +304,7 @@ HOSTPORT = 3306
|
||||
[DATABASE]
|
||||
TYPE = pgsql
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue
|
||||
USERNAME = postgres
|
||||
PASSWORD = root
|
||||
HOSTPORT = 5432
|
||||
@@ -314,7 +314,7 @@ HOSTPORT = 5432
|
||||
[DATABASE]
|
||||
TYPE = sqlsrv
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue
|
||||
USERNAME = sa
|
||||
PASSWORD = root
|
||||
HOSTPORT = 1433
|
||||
@@ -324,7 +324,7 @@ HOSTPORT = 1433
|
||||
[DATABASE]
|
||||
TYPE = oracle
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue
|
||||
USERNAME = root
|
||||
PASSWORD = root
|
||||
HOSTPORT = 1521
|
||||
@@ -400,7 +400,7 @@ MySQL 是项目默认推荐的关系型数据库,XAMPP 已自带,开箱即
|
||||
# 若前面有分号则去掉,保存后重启 XAMPP
|
||||
|
||||
# 创建数据库
|
||||
D:\xampp8.2\mysql\bin\mysql.exe -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
D:\xampp8.2\mysql\bin\mysql.exe -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
```
|
||||
|
||||
```sh [macOS]
|
||||
@@ -409,7 +409,7 @@ brew services start mysql
|
||||
sudo mysql_secure_installation
|
||||
|
||||
# 创建数据库
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
```
|
||||
|
||||
```sh [Ubuntu / Debian]
|
||||
@@ -419,7 +419,7 @@ sudo systemctl enable mysql
|
||||
sudo mysql_secure_installation
|
||||
|
||||
# 创建数据库
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
```
|
||||
|
||||
```sh [Rocky Linux / CentOS]
|
||||
@@ -429,7 +429,7 @@ sudo systemctl enable mysqld
|
||||
sudo mysql_secure_installation
|
||||
|
||||
# 创建数据库
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
```
|
||||
|
||||
:::
|
||||
@@ -454,7 +454,7 @@ PostgreSQL 功能强大,支持 JSONB、全文检索等高级特性,需单独
|
||||
psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'root';"
|
||||
|
||||
# 创建数据库
|
||||
psql -U postgres -c "CREATE DATABASE \"rxthinkcmf.thinkphp6.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
psql -U postgres -c "CREATE DATABASE \"rxthinkcmf.thinkphp8.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
```
|
||||
|
||||
```sh [macOS]
|
||||
@@ -465,8 +465,8 @@ brew services start postgresql
|
||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'root';"
|
||||
|
||||
# 创建数据库
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp6.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp6.elevue\" TO postgres;"
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp8.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp8.elevue\" TO postgres;"
|
||||
```
|
||||
|
||||
```sh [Ubuntu / Debian]
|
||||
@@ -477,8 +477,8 @@ sudo systemctl start postgresql
|
||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'root';"
|
||||
|
||||
# 创建数据库
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp6.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp6.elevue\" TO postgres;"
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp8.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp8.elevue\" TO postgres;"
|
||||
```
|
||||
|
||||
```sh [Rocky Linux / CentOS]
|
||||
@@ -490,8 +490,8 @@ sudo systemctl start postgresql
|
||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'root';"
|
||||
|
||||
# 创建数据库
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp6.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp6.elevue\" TO postgres;"
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp8.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp8.elevue\" TO postgres;"
|
||||
```
|
||||
|
||||
:::
|
||||
@@ -558,7 +558,7 @@ SQL Server 是微软商业数据库,XAMPP 已自带 pdo_sqlsrv 驱动,Window
|
||||
# extension=php_pdo_sqlsrv_82_ts_x64.dll
|
||||
|
||||
# 创建数据库
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp8.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
```
|
||||
|
||||
```sh [macOS]
|
||||
@@ -571,7 +571,7 @@ docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=root" \
|
||||
pecl install pdo_sqlsrv
|
||||
|
||||
# 创建数据库
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp8.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
```
|
||||
|
||||
```sh [Ubuntu / Debian]
|
||||
@@ -593,7 +593,7 @@ echo "extension=pdo_sqlsrv.so" | sudo tee /etc/php/8.2/mods-available/pdo_sqlsrv
|
||||
sudo phpenmod pdo_sqlsrv
|
||||
|
||||
# 创建数据库
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp8.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
```
|
||||
|
||||
```sh [Rocky Linux / CentOS]
|
||||
@@ -613,7 +613,7 @@ sudo pecl install pdo_sqlsrv
|
||||
echo "extension=pdo_sqlsrv.so" | sudo tee /etc/php.d/pdo_sqlsrv.ini
|
||||
|
||||
# 创建数据库
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp8.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
```
|
||||
|
||||
:::
|
||||
@@ -647,7 +647,7 @@ Oracle 是企业级商业数据库,需手动安装 Instant Client 和 pdo_oci
|
||||
# .env 配置
|
||||
# DATABASE.TYPE = oracle
|
||||
# DATABASE.HOSTNAME = 127.0.0.1
|
||||
# DATABASE.DATABASE = rxthinkcmf.thinkphp6.elevue
|
||||
# DATABASE.DATABASE = rxthinkcmf.thinkphp8.elevue
|
||||
# DATABASE.USERNAME = root
|
||||
# DATABASE.PASSWORD = root
|
||||
# DATABASE.HOSTPORT = 1521
|
||||
@@ -679,8 +679,8 @@ sudo phpenmod pdo_oci
|
||||
|
||||
# 4. 创建表空间和用户
|
||||
sqlplus system/root@localhost:1521/XE <<EOF
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp6_elevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp6_elevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp6_elevue";
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp8_elevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp8_elevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp8_elevue";
|
||||
GRANT CONNECT, RESOURCE, CREATE VIEW TO "root";
|
||||
GRANT UNLIMITED TABLESPACE TO "root";
|
||||
EXIT;
|
||||
@@ -703,8 +703,8 @@ sudo phpenmod pdo_oci
|
||||
|
||||
# 4. 创建表空间和用户
|
||||
sqlplus system/root@localhost:1521/XE <<EOF
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp6_elevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp6_elevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp6_elevue";
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp8_elevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp8_elevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp8_elevue";
|
||||
GRANT CONNECT, RESOURCE, CREATE VIEW TO "root";
|
||||
GRANT UNLIMITED TABLESPACE TO "root";
|
||||
EXIT;
|
||||
@@ -720,15 +720,15 @@ EOF
|
||||
```text
|
||||
document/
|
||||
├── mysql/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # MySQL 版本
|
||||
│ └── rxthinkcmf.thinkphp8.elevue.sql # MySQL 版本
|
||||
├── postgresql/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # PostgreSQL 版本
|
||||
│ └── rxthinkcmf.thinkphp8.elevue.sql # PostgreSQL 版本
|
||||
├── sqlserver/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # SQL Server 版本
|
||||
│ └── rxthinkcmf.thinkphp8.elevue.sql # SQL Server 版本
|
||||
├── oracle/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # Oracle 版本
|
||||
│ └── rxthinkcmf.thinkphp8.elevue.sql # Oracle 版本
|
||||
└── sqlite/
|
||||
└── rxthinkcmf.thinkphp6.elevue.sql # SQLite 版本
|
||||
└── rxthinkcmf.thinkphp8.elevue.sql # SQLite 版本
|
||||
```
|
||||
|
||||
各数据库脚本包含完整的表结构定义和初始数据(用户、角色、菜单、字典、城市行政区划等),已针对各数据库的 SQL 语法做了适配,可直接导入使用。
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
├── templates/ ← 代码生成器模板
|
||||
├── runtime/ ← 运行时缓存(自动生成)
|
||||
├── vendor/ ← Composer 依赖
|
||||
├── wiki/ ← 文档站点(VitePress)
|
||||
├── document/ ← 开发参考手册(txt)
|
||||
├── .env ← 环境变量配置
|
||||
└── think ← ThinkPHP 命令行入口
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ ThinkPHP 6.1 Application │
|
||||
│ ThinkPHP 8 Application │
|
||||
│ │
|
||||
│ ┌───────────────────────────────────────────────────────────┐ │
|
||||
│ │ 中间件链(按顺序执行) │ │
|
||||
@@ -243,7 +243,7 @@ DictService 和 ParamService 均采用此架构,大幅减少数据库查询。
|
||||
└──────────────────────────┬───────────────────────────────────┘
|
||||
│ HTTP / JSON
|
||||
┌──────────────────────────┴───────────────────────────────────┐
|
||||
│ ThinkPHP 6.1 Application │
|
||||
│ ThinkPHP 8 Application │
|
||||
│ │
|
||||
│ ┌─────────────┐ ┌─────────────┐ ┌──────────────────────┐ │
|
||||
│ │ 中间件 │ │ 路由 │ │ 异常处理器 │ │
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
### 新增
|
||||
|
||||
- **自动参数校验**:Logic 层配置 `$validateClass` 后,`add`/`update` 自动调用验证器校验,覆盖所有 CRUD 入口(含导入),新增 CityValidate、TenantValidate,全模块验证器覆盖率 100%
|
||||
- **项目文档体系**:Wiki 文档站点全面改版,覆盖快速入门、模块开发、架构设计、运维部署全场景
|
||||
- **项目文档体系**:文档站点全面改版,覆盖快速入门、模块开发、架构设计、运维部署全场景
|
||||
- **生产环境部署指南**:Docker 容器化支持,提供 Dockerfile + docker-compose.yml 一键部署
|
||||
- **系统健康检查接口**:运行状态监控,服务可用性实时检测
|
||||
- **多数据库 SQL 脚本**:MySQL / PostgreSQL / SQL Server / Oracle / SQLite 五套完整建表脚本
|
||||
@@ -448,7 +448,7 @@
|
||||
|
||||
### 新增
|
||||
|
||||
- **ThinkPHP 6.1.x 框架初始化**:基于 ThinkPHP 6.1.x 搭建前后端分离 API 项目
|
||||
- **ThinkPHP 8 框架初始化**:基于 ThinkPHP 8 搭建前后端分离 API 项目
|
||||
- **`BaseModel` 模型基类**:软删除(`is_delete` 字段)+ 审计字段自动写入(`create_user` / `create_time` / `update_user` / `update_time`)
|
||||
- **`BaseController` 控制器基类**:统一响应格式(`success` / `fail` / `page`)+ 参数获取
|
||||
- **`BaseLogic` 逻辑基类**:基础 CRUD + 软删除 + 分页查询
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
```bash
|
||||
# 进入项目目录(以实际解压路径为准)
|
||||
cd thinkphp6
|
||||
cd RXThinkCMF_ThinkPhp8_EleVue
|
||||
```
|
||||
|
||||
:::tip 温馨提示
|
||||
@@ -90,7 +90,7 @@ APP_DEBUG = true
|
||||
[DATABASE]
|
||||
TYPE = mysql ; 数据库类型
|
||||
HOSTNAME = 127.0.0.1 ; 数据库地址
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue ; 数据库名
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue ; 数据库名
|
||||
USERNAME = root ; 用户名
|
||||
PASSWORD = root ; 密码
|
||||
HOSTPORT = 3306 ; 端口
|
||||
@@ -105,8 +105,8 @@ REFRESH_TTL = 604800 ; refresh_token 有效期(秒)
|
||||
|
||||
; 文件上传配置
|
||||
[FILE]
|
||||
UPLOAD_DIR = D:/uploads/rxthinkcmf ; 上传目录(绝对路径)
|
||||
DOMAIN_URL = http://file.thinkphp6.elevue ; 文件访问域名
|
||||
UPLOAD_DIR = D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue\uploads ; 上传目录(绝对路径)
|
||||
DOMAIN_URL = http://file.thinkphp8.elevue ; 文件访问域名
|
||||
```
|
||||
|
||||
:::danger 重要提示
|
||||
@@ -123,11 +123,11 @@ DOMAIN_URL = http://file.thinkphp6.elevue ; 文件访问域名
|
||||
|
||||
```text
|
||||
document/
|
||||
├── mysql/rxthinkcmf.thinkphp6.elevue.sql # MySQL 版本
|
||||
├── postgresql/rxthinkcmf.thinkphp6.elevue.sql # PostgreSQL 版本
|
||||
├── sqlserver/rxthinkcmf.thinkphp6.elevue.sql # SQL Server 版本
|
||||
├── oracle/rxthinkcmf.thinkphp6.elevue.sql # Oracle 版本
|
||||
└── sqlite/rxthinkcmf.thinkphp6.elevue.sql # SQLite 版本
|
||||
├── mysql/rxthinkcmf.thinkphp8.elevue.sql # MySQL 版本
|
||||
├── postgresql/rxthinkcmf.thinkphp8.elevue.sql # PostgreSQL 版本
|
||||
├── sqlserver/rxthinkcmf.thinkphp8.elevue.sql # SQL Server 版本
|
||||
├── oracle/rxthinkcmf.thinkphp8.elevue.sql # Oracle 版本
|
||||
└── sqlite/rxthinkcmf.thinkphp8.elevue.sql # SQLite 版本
|
||||
```
|
||||
|
||||
以 MySQL 为例:
|
||||
@@ -142,7 +142,7 @@ mysql -uroot -p
|
||||
# 在 MySQL 命令行中执行(创建项目数据库):
|
||||
# CHARACTER SET utf8mb4 → 支持 emoji 等四字节字符
|
||||
# COLLATE utf8mb4_general_ci → 不区分大小写的排序规则
|
||||
CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 第 2 步:导入数据库脚本
|
||||
@@ -150,7 +150,7 @@ CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLL
|
||||
# -uroot -proot → 用户名和密码
|
||||
# rxthinkcmf... → 目标数据库名
|
||||
# < file.sql → 将 SQL 文件作为 mysql 命令的输入
|
||||
mysql -uroot -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
mysql -uroot -proot rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
:::tip 温馨提示
|
||||
@@ -234,7 +234,7 @@ pnpm dev
|
||||
```
|
||||
|
||||
:::tip 温馨提示
|
||||
前端默认运行在 `8001` 端口,后端默认 `8000` 端口。`vite.config.ts` 中配置了代理,前端请求 `/api/*` 路径时自动转发到后端 `http://admin.thinkphp6.elevue/api/`。
|
||||
前端默认运行在 `8001` 端口,后端默认 `8000` 端口。`vite.config.ts` 中配置了代理,前端请求 `/api/*` 路径时自动转发到后端 `http://admin.thinkphp8.elevue/api/`。
|
||||
:::
|
||||
|
||||
## 第五步:功能验证
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
```nginx
|
||||
# =============================================================================
|
||||
# Nginx 站点配置 — ThinkPHP 6 后端 API
|
||||
# Nginx 站点配置 — ThinkPHP 8 后端 API
|
||||
# =============================================================================
|
||||
# 用途:生产环境 Nginx 反向代理,将 HTTP 请求转发给 PHP-FPM 处理
|
||||
# 配置路径:/etc/nginx/sites-available/rxthinkcmf
|
||||
@@ -118,7 +118,7 @@ sudo nano /etc/apache2/sites-available/000-default.conf
|
||||
|
||||
```apache
|
||||
# =============================================================================
|
||||
# Apache 虚拟主机配置 — ThinkPHP 6 后端 API
|
||||
# Apache 虚拟主机配置 — ThinkPHP 8 后端 API
|
||||
# =============================================================================
|
||||
# 配置路径:/etc/apache2/sites-available/000-default.conf
|
||||
# 生效命令:sudo systemctl restart apache2
|
||||
@@ -270,7 +270,7 @@ crontab -l
|
||||
# /mo 1 → 每 1 分钟执行一次
|
||||
# /f → 强制覆盖同名任务
|
||||
# =============================================================================
|
||||
schtasks /create /tn "RXThinkCMF_Job" /tr "cmd /c cd /d D:\xampp\htdocs\v3\thinkphp6 && C:\xampp\php\php.exe think job:run" /sc minute /mo 1 /f
|
||||
schtasks /create /tn "RXThinkCMF_Job" /tr "cmd /c cd /d D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue && C:\xampp\php\php.exe think job:run" /sc minute /mo 1 /f
|
||||
|
||||
# 或通过图形界面:Win+R → 输入 taskschd.msc → 回车
|
||||
```
|
||||
@@ -320,10 +320,10 @@ sudo systemctl start mysql
|
||||
# 创建生产数据库
|
||||
# CHARACTER SET utf8mb4 → 支持 emoji 等四字节字符
|
||||
# COLLATE utf8mb4_general_ci → 不区分大小写的排序规则
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
|
||||
# 导入初始化数据(项目自带的 SQL 文件)
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### PostgreSQL
|
||||
@@ -339,7 +339,7 @@ sudo apt install php8.2-pgsql
|
||||
sudo systemctl restart php8.2-fpm
|
||||
|
||||
# 创建数据库(-u postgres 以 postgres 用户执行)
|
||||
sudo -u postgres createdb rxthinkcmf.thinkphp6.elevue
|
||||
sudo -u postgres createdb rxthinkcmf.thinkphp8.elevue
|
||||
```
|
||||
|
||||
### SQLite
|
||||
|
||||
@@ -16,25 +16,25 @@
|
||||
# -proot → 数据库密码(生产环境建议用 -p 后不跟密码,交互式输入)
|
||||
# rxthinkcmf... → 要备份的数据库名
|
||||
# > backup_*.sql → 输出到文件,$(date +%Y%m%d) 自动生成日期后缀
|
||||
mysqldump -u root -proot rxthinkcmf.thinkphp6.elevue > backup_$(date +%Y%m%d).sql
|
||||
mysqldump -u root -proot rxthinkcmf.thinkphp8.elevue > backup_$(date +%Y%m%d).sql
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 压缩备份(推荐 — 可节省 70%+ 磁盘空间)
|
||||
# -----------------------------------------------------------------------------
|
||||
# | gzip → 将 mysqldump 输出通过管道传给 gzip 压缩
|
||||
mysqldump -u root -proot rxthinkcmf.thinkphp6.elevue | gzip > backup_$(date +%Y%m%d).sql.gz
|
||||
mysqldump -u root -proot rxthinkcmf.thinkphp8.elevue | gzip > backup_$(date +%Y%m%d).sql.gz
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 仅备份表结构(不含数据 — 用于对比表结构变更)
|
||||
# -----------------------------------------------------------------------------
|
||||
# --no-data → 只导出 CREATE TABLE 语句,不导出数据
|
||||
mysqldump -u root -proot --no-data rxthinkcmf.thinkphp6.elevue > schema_$(date +%Y%m%d).sql
|
||||
mysqldump -u root -proot --no-data rxthinkcmf.thinkphp8.elevue > schema_$(date +%Y%m%d).sql
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 仅备份数据(不含表结构 — 用于数据迁移)
|
||||
# -----------------------------------------------------------------------------
|
||||
# --no-create-info → 只导出 INSERT 语句,不导出 CREATE TABLE
|
||||
mysqldump -u root -proot --no-create-info rxthinkcmf.thinkphp6.elevue > data_$(date +%Y%m%d).sql
|
||||
mysqldump -u root -proot --no-create-info rxthinkcmf.thinkphp8.elevue > data_$(date +%Y%m%d).sql
|
||||
```
|
||||
|
||||
### 自动备份脚本
|
||||
@@ -52,7 +52,7 @@ mysqldump -u root -proot --no-create-info rxthinkcmf.thinkphp6.elevue > data_$(d
|
||||
# 配置参数(按实际环境修改)
|
||||
# -----------------------------------------------------------------------------
|
||||
BACKUP_DIR="/backup/mysql" # 备份文件存放目录
|
||||
DB_NAME="rxthinkcmf.thinkphp6.elevue" # 要备份的数据库名
|
||||
DB_NAME="rxthinkcmf.thinkphp8.elevue" # 要备份的数据库名
|
||||
DB_USER="root" # 数据库用户名
|
||||
DB_PASS="root" # 数据库密码
|
||||
DATE=$(date +%Y%m%d_%H%M%S) # 当前时间戳(年月日_时分秒)
|
||||
@@ -141,22 +141,22 @@ find $BACKUP_DIR -name "uploads_*.tar.gz" -mtime +30 -delete # 清理 30 天
|
||||
# 从 SQL 文件恢复(全量覆盖)
|
||||
# -----------------------------------------------------------------------------
|
||||
# < backup_*.sql → 将文件内容作为 mysql 命令的输入
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < backup_20260920.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue < backup_20260920.sql
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 从压缩文件恢复(gunzip 解压后传给 mysql)
|
||||
# -----------------------------------------------------------------------------
|
||||
# gunzip < file.sql.gz → 解压并输出到标准输出
|
||||
# | mysql → 通过管道传给 mysql 命令执行
|
||||
gunzip < backup_20260920.sql.gz | mysql -u root -proot rxthinkcmf.thinkphp6.elevue
|
||||
gunzip < backup_20260920.sql.gz | mysql -u root -proot rxthinkcmf.thinkphp8.elevue
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 恢复到新数据库(安全起见 — 先验证再切换)
|
||||
# -----------------------------------------------------------------------------
|
||||
# 1. 创建临时验证数据库
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue_restore`;"
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue_restore`;"
|
||||
# 2. 恢复备份到临时库
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue_restore < backup_20260920.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue_restore < backup_20260920.sql
|
||||
# 3. 验证数据无误后,重命名数据库(需停机操作)
|
||||
```
|
||||
|
||||
@@ -196,7 +196,7 @@ tar -xzf /backup/uploads_20260920.tar.gz -C / www/uploads/article/
|
||||
# =============================================================================
|
||||
|
||||
BACKUP_FILE=$1 # 第一个参数:备份文件路径
|
||||
VERIFY_DB="rxthinkcmf.thinkphp6.elevue_verify" # 临时验证数据库名
|
||||
VERIFY_DB="rxthinkcmf.thinkphp8.elevue_verify" # 临时验证数据库名
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 创建验证数据库(先删除旧的,再创建新的)
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
**数据库**:
|
||||
|
||||
- [ ] 安装 MySQL 8.0+(或 PostgreSQL / SQL Server / Oracle / SQLite)
|
||||
- [ ] 创建数据库:`CREATE DATABASE \`rxthinkcmf.thinkphp6.elevue\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;`
|
||||
- [ ] 创建数据库:`CREATE DATABASE \`rxthinkcmf.thinkphp8.elevue\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;`
|
||||
- [ ] 创建数据库用户并授权
|
||||
- [ ] 导入 SQL 脚本:`mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql`
|
||||
- [ ] 导入 SQL 脚本:`mysql -u root -proot rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql`
|
||||
|
||||
**Redis(可选)**:
|
||||
|
||||
@@ -146,7 +146,7 @@ server {
|
||||
cp -r /www/api /www/api_backup_$(date +%Y%m%d)
|
||||
|
||||
# 备份数据库(mysqldump 导出 SQL,$(date +%Y%m%d) 自动生成日期后缀)
|
||||
mysqldump -u root -proot rxthinkcmf.thinkphp6.elevue > /backup/db_$(date +%Y%m%d).sql
|
||||
mysqldump -u root -proot rxthinkcmf.thinkphp8.elevue > /backup/db_$(date +%Y%m%d).sql
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 第 2 步:更新代码
|
||||
@@ -157,7 +157,7 @@ composer install --no-dev --optimize-autoloader # 安装依赖(排除开
|
||||
# -----------------------------------------------------------------------------
|
||||
# 第 3 步:更新数据库(如有迁移脚本)
|
||||
# -----------------------------------------------------------------------------
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/migration.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue < document/mysql/migration.sql
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 第 4 步:清除缓存
|
||||
@@ -199,7 +199,7 @@ sudo nginx -s reload
|
||||
cp -r /www/api_backup_20260920/* /www/api/
|
||||
|
||||
# 恢复数据库
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < /backup/db_20260920.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue < /backup/db_20260920.sql
|
||||
|
||||
# 重启 PHP-FPM(清除 OPcache,加载旧代码)
|
||||
sudo systemctl restart php8.2-fpm
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
```text
|
||||
document/
|
||||
├── mysql/rxthinkcmf.thinkphp6.elevue.sql # MySQL 版本(约 78 万行)
|
||||
├── postgresql/rxthinkcmf.thinkphp6.elevue.sql # PostgreSQL 版本
|
||||
├── sqlserver/rxthinkcmf.thinkphp6.elevue.sql # SQL Server 版本
|
||||
├── oracle/rxthinkcmf.thinkphp6.elevue.sql # Oracle 版本
|
||||
└── sqlite/rxthinkcmf.thinkphp6.elevue.sql # SQLite 版本
|
||||
├── mysql/rxthinkcmf.thinkphp8.elevue.sql # MySQL 版本(约 78 万行)
|
||||
├── postgresql/rxthinkcmf.thinkphp8.elevue.sql # PostgreSQL 版本
|
||||
├── sqlserver/rxthinkcmf.thinkphp8.elevue.sql # SQL Server 版本
|
||||
├── oracle/rxthinkcmf.thinkphp8.elevue.sql # Oracle 版本
|
||||
└── sqlite/rxthinkcmf.thinkphp8.elevue.sql # SQLite 版本
|
||||
```
|
||||
|
||||
各数据库脚本已针对对应的 SQL 语法做了适配,可直接导入。
|
||||
@@ -28,7 +28,7 @@ document/
|
||||
# -u root -proot → 用户名和密码
|
||||
# rxthinkcmf... → 目标数据库名
|
||||
# < file.sql → 将 SQL 文件作为输入执行
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### PostgreSQL
|
||||
@@ -40,7 +40,7 @@ mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thi
|
||||
# -U postgres → 连接用户
|
||||
# -d ... → 目标数据库
|
||||
# -f file.sql → 执行 SQL 文件
|
||||
psql -U postgres -d rxthinkcmf.thinkphp6.elevue -f document/postgresql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
psql -U postgres -d rxthinkcmf.thinkphp8.elevue -f document/postgresql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### SQL Server
|
||||
@@ -54,7 +54,7 @@ psql -U postgres -d rxthinkcmf.thinkphp6.elevue -f document/postgresql/rxthinkcm
|
||||
# -P root → 密码
|
||||
# -d ... → 目标数据库
|
||||
# -i file.sql → 执行 SQL 文件
|
||||
sqlcmd -S localhost -U sa -P root -d rxthinkcmf.thinkphp6.elevue -i document/sqlserver/rxthinkcmf.thinkphp6.elevue.sql
|
||||
sqlcmd -S localhost -U sa -P root -d rxthinkcmf.thinkphp8.elevue -i document/sqlserver/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### Oracle
|
||||
@@ -65,7 +65,7 @@ sqlcmd -S localhost -U sa -P root -d rxthinkcmf.thinkphp6.elevue -i document/sql
|
||||
# -----------------------------------------------------------------------------
|
||||
# root/root@localhost:1521/XE → 用户/密码@主机:端口/服务名
|
||||
# @file.sql → 执行 SQL 文件
|
||||
sqlplus root/root@localhost:1521/XE @document/oracle/rxthinkcmf.thinkphp6.elevue.sql
|
||||
sqlplus root/root@localhost:1521/XE @document/oracle/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### SQLite
|
||||
@@ -76,7 +76,7 @@ sqlplus root/root@localhost:1521/XE @document/oracle/rxthinkcmf.thinkphp6.elevue
|
||||
# -----------------------------------------------------------------------------
|
||||
# 数据库文件路径 → SQLite 数据库存储在单个文件中
|
||||
# < file.sql → 将 SQL 文件作为输入执行
|
||||
sqlite3 /www/api/runtime/database.sqlite < document/sqlite/rxthinkcmf.thinkphp6.elevue.sql
|
||||
sqlite3 /www/api/runtime/database.sqlite < document/sqlite/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
@@ -162,7 +162,7 @@ CMD ["php-fpm"]
|
||||
|
||||
```nginx
|
||||
# =============================================================================
|
||||
# Nginx 配置 — ThinkPHP 6 反向代理
|
||||
# Nginx 配置 — ThinkPHP 8 反向代理
|
||||
# =============================================================================
|
||||
# 用途:Docker 容器内 Nginx 服务,将 HTTP 请求转发给 PHP-FPM 处理
|
||||
# 挂载方式:docker-compose 中 volumes 映射到 /etc/nginx/conf.d/default.conf
|
||||
@@ -323,7 +323,7 @@ services:
|
||||
# root 用户密码(必须 8 位以上,包含大小写字母和数字)
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
# 启动时自动创建的数据库
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-rxthinkcmf.thinkphp6.elevue}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-rxthinkcmf.thinkphp8.elevue}
|
||||
# 字符集(支持 emoji 等四字节字符)
|
||||
MYSQL_CHARSET: utf8mb4
|
||||
# 排序规则
|
||||
@@ -332,7 +332,7 @@ services:
|
||||
# 数据持久化(容器重建不丢数据)
|
||||
- mysql_data:/var/lib/mysql
|
||||
# 初始化 SQL(首次启动时自动执行,仅在数据卷为空时生效)
|
||||
- ./document/mysql/rxthinkcmf.thinkphp6.elevue.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
- ./document/mysql/rxthinkcmf.thinkphp8.elevue.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_general_ci
|
||||
@@ -389,7 +389,7 @@ networks:
|
||||
```ini
|
||||
# Docker 环境变量(密码等敏感信息,切勿提交 Git)
|
||||
MYSQL_ROOT_PASSWORD=Your_Strong_Password_2024
|
||||
MYSQL_DATABASE=rxthinkcmf.thinkphp6.elevue
|
||||
MYSQL_DATABASE=rxthinkcmf.thinkphp8.elevue
|
||||
REDIS_PASSWORD=Your_Redis_Password_2024
|
||||
APP_DEBUG=false
|
||||
```
|
||||
@@ -491,16 +491,16 @@ docker-compose exec app bash
|
||||
docker-compose exec mysql bash
|
||||
|
||||
# 在容器内执行 SQL
|
||||
docker-compose exec mysql mysql -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp6.elevue
|
||||
docker-compose exec mysql mysql -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp8.elevue
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# 数据库操作
|
||||
# --------------------------------------------------------------------------
|
||||
# 导入 SQL 文件
|
||||
docker-compose exec -T mysql mysql -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
docker-compose exec -T mysql mysql -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
|
||||
# 导出数据库备份
|
||||
docker-compose exec mysql mysqldump -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp6.elevue > backup_$(date +%Y%m%d).sql
|
||||
docker-compose exec mysql mysqldump -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp8.elevue > backup_$(date +%Y%m%d).sql
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# ThinkPHP 命令
|
||||
|
||||
@@ -132,8 +132,8 @@ ALTER USER 'root'@'localhost' IDENTIFIED BY 'strong_password_here';
|
||||
CREATE USER 'rxthinkcmf_app'@'localhost' IDENTIFIED BY 'app_password';
|
||||
|
||||
-- 授权应用用户只能访问项目数据库(最小权限原则)
|
||||
-- rxthinkcmf.thinkphp6.elevue.* → 该项目数据库的所有表
|
||||
GRANT ALL PRIVILEGES ON `rxthinkcmf.thinkphp6.elevue`.* TO 'rxthinkcmf_app'@'localhost';
|
||||
-- rxthinkcmf.thinkphp8.elevue.* → 该项目数据库的所有表
|
||||
GRANT ALL PRIVILEGES ON `rxthinkcmf.thinkphp8.elevue`.* TO 'rxthinkcmf_app'@'localhost';
|
||||
FLUSH PRIVILEGES; -- 刷新权限使配置生效
|
||||
|
||||
-- 禁止远程 root 登录(只允许本地连接)
|
||||
|
||||
@@ -97,7 +97,7 @@ mysql -u root -p -e "SELECT user, host FROM mysql.user;"
|
||||
# ON `数据库`.* → 指定数据库的所有表
|
||||
# TO 'root'@'%' → 允许从任意主机连接的 root 用户
|
||||
# IDENTIFIED BY → 设置密码
|
||||
mysql -u root -proot -e "GRANT ALL ON \`rxthinkcmf.thinkphp6.elevue\`.* TO 'root'@'%' IDENTIFIED BY 'root';"
|
||||
mysql -u root -proot -e "GRANT ALL ON \`rxthinkcmf.thinkphp8.elevue\`.* TO 'root'@'%' IDENTIFIED BY 'root';"
|
||||
mysql -u root -p -e "FLUSH PRIVILEGES;" # 刷新权限使配置生效
|
||||
```
|
||||
|
||||
@@ -112,7 +112,7 @@ sudo systemctl status postgresql
|
||||
# -----------------------------------------------------------------------------
|
||||
# 测试连接(-U 指定用户,-d 指定数据库,-c 执行 SQL)
|
||||
# -----------------------------------------------------------------------------
|
||||
psql -U postgres -d rxthinkcmf.thinkphp6.elevue -c "SELECT 1;"
|
||||
psql -U postgres -d rxthinkcmf.thinkphp8.elevue -c "SELECT 1;"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 检查客户端认证配置(pg_hba.conf 控制哪些 IP 可以连接)
|
||||
@@ -169,14 +169,14 @@ php -m | grep pdo_sqlsrv # 查找 pdo_sqlsrv 扩展
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# MySQL:通过 mysql 命令导入 SQL 文件
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
|
||||
# PostgreSQL:通过 psql 命令导入 SQL 文件
|
||||
# -U 指定用户,-d 指定数据库,-f 指定 SQL 文件
|
||||
psql -U postgres -d rxthinkcmf.thinkphp6.elevue -f document/postgresql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
psql -U postgres -d rxthinkcmf.thinkphp8.elevue -f document/postgresql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
|
||||
# SQLite:通过 sqlite3 命令导入 SQL 文件
|
||||
sqlite3 /www/api/runtime/database.sqlite < document/sqlite/rxthinkcmf.thinkphp6.elevue.sql
|
||||
sqlite3 /www/api/runtime/database.sqlite < document/sqlite/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
## PHP 问题
|
||||
@@ -268,13 +268,13 @@ grep JWT.SECRET .env
|
||||
# 检查用户角色分配(用户是否分配了角色)
|
||||
# -----------------------------------------------------------------------------
|
||||
# think_user_role 表存储用户与角色的关联关系
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue -e "SELECT * FROM think_user_role WHERE user_id=1;"
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue -e "SELECT * FROM think_user_role WHERE user_id=1;"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 检查角色权限(角色是否分配了菜单权限)
|
||||
# -----------------------------------------------------------------------------
|
||||
# think_role_menu 表存储角色与菜单的关联关系
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue -e "SELECT * FROM think_role_menu WHERE role_id=1;"
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue -e "SELECT * FROM think_role_menu WHERE role_id=1;"
|
||||
```
|
||||
|
||||
### 文件上传失败
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
├── public/ // 公共资源(入口文件、上传目录)
|
||||
├── route/ // 路由定义
|
||||
├── templates/ // 代码生成模板
|
||||
├── wiki/ // VitePress 文档站点
|
||||
├── vendor/ // Composer 依赖(不提交到版本控制)
|
||||
├── runtime/ // 运行时缓存(不提交到版本控制)
|
||||
├── .env.example // 环境变量模板
|
||||
|
||||
@@ -34,13 +34,13 @@ VITE_GLOB_API_URL =
|
||||
VITE_GLOB_API_URL_PREFIX = /api
|
||||
|
||||
# 代理配置(JSON 数组格式:[["前缀","目标地址"]])
|
||||
VITE_PROXY = [["/api","http://admin.thinkphp6.elevue/api"]]
|
||||
VITE_PROXY = [["/api","http://admin.thinkphp8.elevue/api"]]
|
||||
|
||||
# 上传接口地址
|
||||
VITE_GLOB_UPLOAD_URL = /api/upload
|
||||
|
||||
# 图片访问地址(用于预览上传的图片)
|
||||
VITE_GLOB_IMG_URL = http://file.thinkphp6.elevue
|
||||
VITE_GLOB_IMG_URL = http://file.thinkphp8.elevue
|
||||
|
||||
# 是否在生产环境删除 console(开发环境保留)
|
||||
VITE_DROP_CONSOLE = false
|
||||
@@ -118,7 +118,7 @@ VITE_GLOB_API_URL =
|
||||
### VITE_PROXY — 开发代理配置
|
||||
|
||||
```bash
|
||||
VITE_PROXY = [["/api","http://admin.thinkphp6.elevue/api"]]
|
||||
VITE_PROXY = [["/api","http://admin.thinkphp8.elevue/api"]]
|
||||
```
|
||||
|
||||
**格式:** JSON 数组,每项为 `[前缀, 目标地址]`
|
||||
@@ -151,7 +151,7 @@ VITE_GLOB_UPLOAD_URL = /api/upload
|
||||
|
||||
```bash
|
||||
# 开发环境
|
||||
VITE_GLOB_IMG_URL = http://file.thinkphp6.elevue
|
||||
VITE_GLOB_IMG_URL = http://file.thinkphp8.elevue
|
||||
|
||||
# 生产环境
|
||||
VITE_GLOB_IMG_URL = https://cdn.example.com
|
||||
@@ -211,7 +211,7 @@ export default defineConfig(({ mode }) => {
|
||||
port: Number(env.VITE_PORT) || 8001,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://admin.thinkphp6.elevue/api',
|
||||
target: 'http://admin.thinkphp8.elevue/api',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
@@ -242,7 +242,7 @@ export default defineConfig(({ mode }) => {
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://admin.thinkphp6.elevue/api', // 目标地址
|
||||
target: 'http://admin.thinkphp8.elevue/api', // 目标地址
|
||||
changeOrigin: true, // 修改请求头 Origin
|
||||
rewrite: (path) => path.replace(/^\/api/, ''), // 路径重写(可选)
|
||||
},
|
||||
@@ -257,7 +257,7 @@ server: {
|
||||
│
|
||||
▼ Vite proxy
|
||||
│
|
||||
▼ 转发到: http://admin.thinkphp6.elevue/api/user/page
|
||||
▼ 转发到: http://admin.thinkphp8.elevue/api/user/page
|
||||
```
|
||||
|
||||
## 构建命令
|
||||
@@ -342,7 +342,7 @@ server {
|
||||
# .env.staging
|
||||
VITE_GLOB_API_URL =
|
||||
VITE_GLOB_API_URL_PREFIX = /api
|
||||
VITE_GLOB_IMG_URL = https://test-cdn.example.com
|
||||
VITE_GLOB_IMG_URL = http://file.thinkphp8.elevue
|
||||
VITE_DROP_CONSOLE = true
|
||||
```
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
## 软件说明
|
||||
|
||||
基于 ThinkPHP 6.1、PHP 8.2、Vue3、TypeScript、Vite、ElementPlus 等技术栈构建的企业级前后端分离后台管理系统,支持 MySQL、PostgreSQL、SQL Server、Oracle、SQLite 等数据库。
|
||||
基于 ThinkPHP 8、PHP 8.2、Vue3、TypeScript、Vite、ElementPlus 等技术栈构建的企业级前后端分离后台管理系统,支持 MySQL、PostgreSQL、SQL Server、Oracle、SQLite 等数据库。
|
||||
|
||||
后端采用 PHP 语言,基于 ThinkPHP 6.1 框架、ThinkPHP ORM 数据库操作、PHP 8 Attribute 注解等主流技术栈;前端基于 Vue3、TypeScript、Vite 构建,采用 ElementPlus 框架,遵循 Vue 前后端分离主流设计思想。
|
||||
后端采用 PHP 语言,基于 ThinkPHP 8 框架、ThinkPHP ORM 数据库操作、PHP 8 Attribute 注解等主流技术栈;前端基于 Vue3、TypeScript、Vite 构建,采用 ElementPlus 框架,遵循 Vue 前后端分离主流设计思想。
|
||||
|
||||
系统采用完全前后端分离架构,前端通过 API 调用后端服务实现数据交互。内置完善的 RBAC 权限体系,权限颗粒度精细至按钮级别;支持多租户数据隔离和数据权限控制。系统预置了用户、角色、菜单、部门、岗位、职级、日志、字典、配置、参数、定时任务、代码生成器等基础功能模块,开箱即用。
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
+ 软件作者:@小蚂蚁云团队
|
||||
+ 软件协议:Apache-2.0
|
||||
+ 官网网址:[https://www.rxthink.cn](https://www.rxthink.cn)
|
||||
+ 文档网址:[http://docs.thinkphp6.elevue.rxthink.cn](http://docs.thinkphp6.elevue.rxthink.cn)
|
||||
+ 演示地址:[http://manage.thinkphp6.elevue.rxthink.cn](http://manage.thinkphp6.elevue.rxthink.cn)
|
||||
+ 文档网址:[http://docs.thinkphp8.elevue.rxthink.cn](http://docs.thinkphp8.elevue.rxthink.cn)
|
||||
+ 演示地址:[http://manage.thinkphp8.elevue.rxthink.cn](http://manage.thinkphp8.elevue.rxthink.cn)
|
||||
|
||||
## 软件版本
|
||||
|
||||
@@ -138,6 +138,10 @@
|
||||
<td><img src="/demo/27.png"/></td>
|
||||
<td><img src="/demo/28.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="/demo/29.png"/></td>
|
||||
<td><img src="/demo/30.png"/></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ think job:run
|
||||
11. 起始于:
|
||||
|
||||
```text
|
||||
D:\xampp\htdocs\v3\thinkphp6
|
||||
D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue
|
||||
```
|
||||
|
||||
12. 勾选"不管用户是否登录都要运行"
|
||||
@@ -252,7 +252,7 @@ D:\xampp\htdocs\v3\thinkphp6
|
||||
|
||||
```powershell
|
||||
# 手动运行测试
|
||||
cd D:\xampp\htdocs\v3\thinkphp6
|
||||
cd D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue
|
||||
C:\xampp\php\php.exe think job:run
|
||||
|
||||
# 在任务计划程序中右键任务 → 运行
|
||||
@@ -274,7 +274,7 @@ schtasks /create /tn "RXThinkCMF_Job" /tr "C:\xampp\php\php.exe think job:run" /
|
||||
# /f 强制覆盖同名任务
|
||||
|
||||
# 创建任务(指定工作目录)
|
||||
schtasks /create /tn "RXThinkCMF_Job" /tr "cmd /c cd /d D:\xampp\htdocs\v3\thinkphp6 && C:\xampp\php\php.exe think job:run" /sc minute /mo 1 /f
|
||||
schtasks /create /tn "RXThinkCMF_Job" /tr "cmd /c cd /d D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue && C:\xampp\php\php.exe think job:run" /sc minute /mo 1 /f
|
||||
|
||||
# 查询任务
|
||||
schtasks /query /tn "RXThinkCMF_Job"
|
||||
@@ -301,7 +301,7 @@ schtasks /query /fo table
|
||||
|
||||
```powershell
|
||||
# 带日志输出的完整命令
|
||||
schtasks /create /tn "RXThinkCMF_Job" /tr "cmd /c cd /d D:\xampp\htdocs\v3\thinkphp6 && C:\xampp\php\php.exe think job:run >> runtime\job.log 2>&1" /sc minute /mo 1 /f
|
||||
schtasks /create /tn "RXThinkCMF_Job" /tr "cmd /c cd /d D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue && C:\xampp\php\php.exe think job:run >> runtime\job.log 2>&1" /sc minute /mo 1 /f
|
||||
```
|
||||
|
||||
---
|
||||
@@ -632,7 +632,7 @@ crontab -e
|
||||
# 添加:* * * * * cd /www/api && php think job:run >> /dev/null 2>&1
|
||||
|
||||
# 方式二:Windows 计划任务
|
||||
schtasks /create /tn "RXThinkCMF_Job" /tr "cmd /c cd /d D:\xampp\htdocs\v3\thinkphp6 && C:\xampp\php\php.exe think job:run" /sc minute /mo 1 /f
|
||||
schtasks /create /tn "RXThinkCMF_Job" /tr "cmd /c cd /d D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue && C:\xampp\php\php.exe think job:run" /sc minute /mo 1 /f
|
||||
|
||||
# 方式三:Daemon 守护进程
|
||||
php think job:daemon
|
||||
|
||||
@@ -176,12 +176,6 @@ Closes #xxx
|
||||
- TypeScript/Vue:遵循 ESLint + Prettier 配置
|
||||
- 详见 [前端编码规范](/zh/standards/frontend-code.html) 和 [后端编码规范](/zh/standards/backend-code.html)
|
||||
|
||||
## 文档贡献
|
||||
|
||||
- 文档位于 `wiki/zh/` 目录,使用 VitePress + Markdown
|
||||
- 新增功能需同步更新文档
|
||||
- 文档遵循 [文档规范](/zh/standards/backend-code.html)
|
||||
|
||||
## 行为准则
|
||||
|
||||
- 尊重每一位贡献者
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
```bash
|
||||
# 进入项目目录(以实际解压路径为准)
|
||||
cd thinkphp6
|
||||
cd RXThinkCMF_ThinkPhp8_EleVue
|
||||
```
|
||||
|
||||
:::tip 温馨提示
|
||||
@@ -64,7 +64,7 @@ APP_DEBUG = true
|
||||
[DATABASE]
|
||||
TYPE = mysql ; 数据库类型(mysql / pgsql / sqlsrv / oracle / sqlite)
|
||||
HOSTNAME = 127.0.0.1 ; 数据库服务器地址
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue ; 数据库名称
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue ; 数据库名称
|
||||
USERNAME = root ; 数据库用户名
|
||||
PASSWORD = root ; 数据库密码
|
||||
HOSTPORT = 3306 ; 数据库端口
|
||||
@@ -76,8 +76,8 @@ SECRET = rxthinkcmf_jwt_secret_key_2024
|
||||
|
||||
; 文件上传配置
|
||||
[FILE]
|
||||
UPLOAD_DIR = D:/uploads/rxthinkcmf ; 上传文件存储目录(绝对路径)
|
||||
DOMAIN_URL = http://file.thinkphp6.elevue ; 文件访问域名
|
||||
UPLOAD_DIR = D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue\uploads ; 上传文件存储目录(绝对路径)
|
||||
DOMAIN_URL = http://file.thinkphp8.elevue ; 文件访问域名
|
||||
```
|
||||
|
||||
:::danger 生产环境务必修改
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
```text
|
||||
document/
|
||||
├── mysql/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # MySQL 版本
|
||||
│ └── rxthinkcmf.thinkphp8.elevue.sql # MySQL 版本
|
||||
├── postgresql/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # PostgreSQL 版本
|
||||
│ └── rxthinkcmf.thinkphp8.elevue.sql # PostgreSQL 版本
|
||||
├── sqlserver/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # SQL Server 版本
|
||||
│ └── rxthinkcmf.thinkphp8.elevue.sql # SQL Server 版本
|
||||
├── oracle/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # Oracle 版本
|
||||
│ └── rxthinkcmf.thinkphp8.elevue.sql # Oracle 版本
|
||||
└── sqlite/
|
||||
└── rxthinkcmf.thinkphp6.elevue.sql # SQLite 版本
|
||||
└── rxthinkcmf.thinkphp8.elevue.sql # SQLite 版本
|
||||
```
|
||||
|
||||
各数据库脚本已针对对应的 SQL 语法做了适配,可直接导入使用,无需手动转换。
|
||||
@@ -37,7 +37,7 @@ mysql -u root -p
|
||||
-- 创建项目数据库
|
||||
-- CHARACTER SET utf8mb4 → 支持 emoji 等四字节字符
|
||||
-- COLLATE utf8mb4_general_ci → 不区分大小写的排序规则
|
||||
CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
EXIT;
|
||||
```
|
||||
|
||||
@@ -50,7 +50,7 @@ EXIT;
|
||||
# -u root -proot → 数据库用户名和密码
|
||||
# rxthinkcmf... → 目标数据库名
|
||||
# < file.sql → 将 SQL 文件内容作为 mysql 命令的输入
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
:::tip 温馨提示
|
||||
@@ -63,7 +63,7 @@ mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thi
|
||||
[DATABASE]
|
||||
TYPE = mysql ; 数据库类型
|
||||
HOSTNAME = 127.0.0.1 ; 数据库地址
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue ; 数据库名
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue ; 数据库名
|
||||
USERNAME = root ; 用户名
|
||||
PASSWORD = root ; 密码
|
||||
HOSTPORT = 3306 ; 端口
|
||||
@@ -88,10 +88,10 @@ CREATE USER postgres WITH PASSWORD 'root';
|
||||
-- 创建项目数据库
|
||||
-- OWNER postgres → 指定数据库所有者
|
||||
-- ENCODING 'UTF8' → 使用 UTF-8 编码
|
||||
CREATE DATABASE "rxthinkcmf.thinkphp6.elevue" OWNER postgres ENCODING 'UTF8';
|
||||
CREATE DATABASE "rxthinkcmf.thinkphp8.elevue" OWNER postgres ENCODING 'UTF8';
|
||||
|
||||
-- 授予用户对该数据库的所有权限
|
||||
GRANT ALL PRIVILEGES ON DATABASE "rxthinkcmf.thinkphp6.elevue" TO postgres;
|
||||
GRANT ALL PRIVILEGES ON DATABASE "rxthinkcmf.thinkphp8.elevue" TO postgres;
|
||||
\q
|
||||
```
|
||||
|
||||
@@ -104,7 +104,7 @@ GRANT ALL PRIVILEGES ON DATABASE "rxthinkcmf.thinkphp6.elevue" TO postgres;
|
||||
# -U postgres → 连接用户
|
||||
# -d ... → 目标数据库
|
||||
# -f file.sql → 执行 SQL 文件
|
||||
psql -U postgres -d rxthinkcmf.thinkphp6.elevue -f document/postgresql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
psql -U postgres -d rxthinkcmf.thinkphp8.elevue -f document/postgresql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### 3. 配置 .env
|
||||
@@ -113,7 +113,7 @@ psql -U postgres -d rxthinkcmf.thinkphp6.elevue -f document/postgresql/rxthinkcm
|
||||
[DATABASE]
|
||||
TYPE = pgsql ; 数据库类型改为 pgsql
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue
|
||||
USERNAME = postgres ; PostgreSQL 默认用户
|
||||
PASSWORD = root
|
||||
HOSTPORT = 5432 ; PostgreSQL 默认端口
|
||||
@@ -146,7 +146,7 @@ touch /www/api/runtime/database.sqlite
|
||||
# sqlite3 → SQLite 命令行工具
|
||||
# 数据库文件路径 → SQLite 数据库存储在单个文件中
|
||||
# < file.sql → 将 SQL 文件作为输入执行
|
||||
sqlite3 /www/api/runtime/database.sqlite < document/sqlite/rxthinkcmf.thinkphp6.elevue.sql
|
||||
sqlite3 /www/api/runtime/database.sqlite < document/sqlite/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### 3. 配置 .env
|
||||
@@ -179,7 +179,7 @@ PREFIX = think_
|
||||
# -P root → 密码
|
||||
# -Q → 执行 SQL 查询后退出
|
||||
# COLLATE Chinese_PRC_CI_AS → 中文排序规则(不区分大小写)
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp8.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
```
|
||||
|
||||
### 2. 导入 SQL 脚本
|
||||
@@ -190,7 +190,7 @@ sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elev
|
||||
# -----------------------------------------------------------------------------
|
||||
# -d rxthinkcmf... → 目标数据库
|
||||
# -i file.sql → 执行 SQL 文件
|
||||
sqlcmd -S localhost -U sa -P root -d rxthinkcmf.thinkphp6.elevue -i document/sqlserver/rxthinkcmf.thinkphp6.elevue.sql
|
||||
sqlcmd -S localhost -U sa -P root -d rxthinkcmf.thinkphp8.elevue -i document/sqlserver/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### 3. 配置 .env
|
||||
@@ -199,7 +199,7 @@ sqlcmd -S localhost -U sa -P root -d rxthinkcmf.thinkphp6.elevue -i document/sql
|
||||
[DATABASE]
|
||||
TYPE = sqlsrv ; 数据库类型改为 sqlsrv
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue
|
||||
USERNAME = sa ; SQL Server 默认管理员
|
||||
PASSWORD = root
|
||||
HOSTPORT = 1433 ; SQL Server 默认端口
|
||||
@@ -220,15 +220,15 @@ sqlplus system/root@localhost:1521/XE
|
||||
-- DATAFILE → 数据文件的物理路径
|
||||
-- SIZE 100M → 初始大小 100MB
|
||||
-- AUTOEXTEND ON NEXT 100M → 空间不足时自动扩展 100MB
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp6_elevue"
|
||||
DATAFILE '/u01/oradata/rxthinkcmf_thinkphp6_elevue.dbf'
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp8_elevue"
|
||||
DATAFILE '/u01/oradata/rxthinkcmf_thinkphp8_elevue.dbf'
|
||||
SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
|
||||
-- 创建数据库用户
|
||||
-- IDENTIFIED BY → 设置密码
|
||||
-- DEFAULT TABLESPACE → 指定默认表空间
|
||||
CREATE USER "root" IDENTIFIED BY "root"
|
||||
DEFAULT TABLESPACE "rxthinkcmf_thinkphp6_elevue";
|
||||
DEFAULT TABLESPACE "rxthinkcmf_thinkphp8_elevue";
|
||||
|
||||
-- 授权
|
||||
-- CONNECT → 连接权限
|
||||
@@ -249,7 +249,7 @@ EXIT;
|
||||
# sqlplus → Oracle 命令行工具
|
||||
# root/root@localhost:1521/XE → 用户/密码@主机:端口/服务名
|
||||
# @file.sql → 执行 SQL 文件
|
||||
sqlplus root/root@localhost:1521/XE @document/oracle/rxthinkcmf.thinkphp6.elevue.sql
|
||||
sqlplus root/root@localhost:1521/XE @document/oracle/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### 3. 配置 .env
|
||||
@@ -258,7 +258,7 @@ sqlplus root/root@localhost:1521/XE @document/oracle/rxthinkcmf.thinkphp6.elevue
|
||||
[DATABASE]
|
||||
TYPE = oracle ; 数据库类型改为 oracle
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue
|
||||
USERNAME = root
|
||||
PASSWORD = root
|
||||
HOSTPORT = 1521 ; Oracle 默认端口
|
||||
@@ -288,13 +288,13 @@ curl http://localhost:8000/api/login -X POST \
|
||||
# MySQL:查询用户表记录数(验证表是否创建成功且有数据)
|
||||
# -----------------------------------------------------------------------------
|
||||
# -e → 执行 SQL 后退出
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue -e "SELECT COUNT(*) FROM think_user;"
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue -e "SELECT COUNT(*) FROM think_user;"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# PostgreSQL:查询用户表记录数
|
||||
# -----------------------------------------------------------------------------
|
||||
# -c → 执行 SQL 命令
|
||||
psql -U postgres -d rxthinkcmf.thinkphp6.elevue -c "SELECT COUNT(*) FROM think_user;"
|
||||
psql -U postgres -d rxthinkcmf.thinkphp8.elevue -c "SELECT COUNT(*) FROM think_user;"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# SQLite:查询用户表记录数
|
||||
@@ -305,7 +305,7 @@ sqlite3 /www/api/runtime/database.sqlite "SELECT COUNT(*) FROM think_user;"
|
||||
# SQL Server:查询用户表记录数
|
||||
# -----------------------------------------------------------------------------
|
||||
# -Q → 执行查询后退出
|
||||
sqlcmd -S localhost -U sa -P root -d rxthinkcmf.thinkphp6.elevue -Q "SELECT COUNT(*) FROM think_user;"
|
||||
sqlcmd -S localhost -U sa -P root -d rxthinkcmf.thinkphp8.elevue -Q "SELECT COUNT(*) FROM think_user;"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Oracle:查询用户表记录数(需先进入 SQL 命令行)
|
||||
@@ -338,7 +338,7 @@ EXIT;
|
||||
|
||||
```bash
|
||||
# --default-character-set=utf8mb4 → 指定字符集为 utf8mb4(支持 emoji)
|
||||
mysql -u root -proot --default-character-set=utf8mb4 rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
mysql -u root -proot --default-character-set=utf8mb4 rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### Q: 表已存在错误
|
||||
@@ -348,13 +348,13 @@ mysql -u root -proot --default-character-set=utf8mb4 rxthinkcmf.thinkphp6.elevue
|
||||
# 先删除旧数据库再重建(⚠️ 会清空所有数据)
|
||||
# -----------------------------------------------------------------------------
|
||||
# DROP DATABASE IF EXISTS → 如果存在则删除
|
||||
mysql -u root -proot -e "DROP DATABASE IF EXISTS \`rxthinkcmf.thinkphp6.elevue\`;"
|
||||
mysql -u root -proot -e "DROP DATABASE IF EXISTS \`rxthinkcmf.thinkphp8.elevue\`;"
|
||||
|
||||
# 创建数据库(指定字符集)
|
||||
mysql -u root -proot -e "CREATE DATABASE \`rxthinkcmf.thinkphp6.elevue\` DEFAULT CHARACTER SET utf8mb4;"
|
||||
mysql -u root -proot -e "CREATE DATABASE \`rxthinkcmf.thinkphp8.elevue\` DEFAULT CHARACTER SET utf8mb4;"
|
||||
|
||||
# 重新导入 SQL
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
```
|
||||
|
||||
### Q: PostgreSQL 导入报错
|
||||
|
||||
@@ -31,7 +31,7 @@ thinkphp6/
|
||||
|
||||
```bash
|
||||
# 从官方网站 (https://www.rxthink.cn) 下载授权源码包并解压
|
||||
cd thinkphp6
|
||||
cd RXThinkCMF_ThinkPhp8_EleVue
|
||||
|
||||
# 配置应用环境变量
|
||||
cp .env.example .env
|
||||
@@ -127,12 +127,12 @@ services:
|
||||
- "${MYSQL_PORT:-3306}:3306" # 宿主机端口(默认 3306),可通过环境变量覆盖
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-Your_Strong_Password_2024} # root 密码
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-rxthinkcmf.thinkphp6.elevue} # 自动创建的数据库
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-rxthinkcmf.thinkphp8.elevue} # 自动创建的数据库
|
||||
MYSQL_CHARSET: utf8mb4
|
||||
MYSQL_COLLATION: utf8mb4_general_ci
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql # 数据持久化
|
||||
- ./document/mysql/rxthinkcmf.thinkphp6.elevue.sql:/docker-entrypoint-initdb.d/init.sql:ro # 初始化 SQL
|
||||
- ./document/mysql/rxthinkcmf.thinkphp8.elevue.sql:/docker-entrypoint-initdb.d/init.sql:ro # 初始化 SQL
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_general_ci
|
||||
@@ -265,7 +265,7 @@ CMD ["php-fpm"]
|
||||
|
||||
```nginx
|
||||
# =============================================================================
|
||||
# Nginx 配置 — ThinkPHP 6 反向代理
|
||||
# Nginx 配置 — ThinkPHP 8 反向代理
|
||||
# =============================================================================
|
||||
|
||||
server {
|
||||
@@ -324,7 +324,7 @@ server {
|
||||
```ini
|
||||
# Docker 环境变量(密码等敏感信息,切勿提交 Git)
|
||||
MYSQL_ROOT_PASSWORD=Your_Strong_Password_2024
|
||||
MYSQL_DATABASE=rxthinkcmf.thinkphp6.elevue
|
||||
MYSQL_DATABASE=rxthinkcmf.thinkphp8.elevue
|
||||
REDIS_PASSWORD=Your_Redis_Password_2024
|
||||
APP_DEBUG=false
|
||||
```
|
||||
@@ -409,10 +409,10 @@ docker-compose exec mysql bash
|
||||
# 数据库操作
|
||||
# --------------------------------------------------------------------------
|
||||
# 导入 SQL(手动方式)
|
||||
docker-compose exec -T mysql mysql -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
docker-compose exec -T mysql mysql -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
|
||||
# 进入 MySQL 命令行
|
||||
docker-compose exec mysql mysql -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp6.elevue
|
||||
docker-compose exec mysql mysql -uroot -pYour_Strong_Password_2024 rxthinkcmf.thinkphp8.elevue
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# ThinkPHP 命令
|
||||
|
||||
@@ -27,7 +27,7 @@ SHOW_ERROR_MSG = true ; 显示错误详情(生产环境设
|
||||
[DATABASE]
|
||||
TYPE = mysql ; 数据库类型(mysql / pgsql / sqlsrv / oracle / sqlite)
|
||||
HOSTNAME = 127.0.0.1 ; 数据库服务器地址
|
||||
DATABASE = rxthinkcmf.thinkphp6.elevue ; 数据库名
|
||||
DATABASE = rxthinkcmf.thinkphp8.elevue ; 数据库名
|
||||
USERNAME = root ; 用户名
|
||||
PASSWORD = root ; 密码
|
||||
HOSTPORT = 3306 ; 端口
|
||||
@@ -42,8 +42,8 @@ REFRESH_TTL = 604800 ; refresh_token 有效期(秒),默
|
||||
ISSUER = rxthinkcmf ; 签发者标识
|
||||
|
||||
[FILE]
|
||||
UPLOAD_DIR = D:/uploads/rxthinkcmf ; 上传根目录(绝对路径)
|
||||
DOMAIN_URL = http://file.thinkphp6.elevue ; 文件访问域名
|
||||
UPLOAD_DIR = D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue\uploads ; 上传根目录(绝对路径)
|
||||
DOMAIN_URL = http://file.thinkphp8.elevue ; 文件访问域名
|
||||
IMAGE_EXT = gif,jpg,jpeg,png,bmp,webp,svg ; 允许的图片后缀
|
||||
FILE_EXT = gif,jpg,jpeg,png,bmp,webp,svg,doc,docx,xls,xlsx,ppt,pptx,pdf,zip,rar,txt,csv,mp3,mp4,sql,js,css ; 允许的文件后缀
|
||||
MAX_SIZE = 10 ; 单文件最大大小(MB)
|
||||
|
||||
@@ -389,7 +389,7 @@ MySQL 是项目默认推荐的关系型数据库,XAMPP 已自带,开箱即
|
||||
# 若前面有分号则去掉,保存后重启 XAMPP
|
||||
|
||||
# 创建数据库
|
||||
D:\xampp8.2\mysql\bin\mysql.exe -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
D:\xampp8.2\mysql\bin\mysql.exe -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
```
|
||||
|
||||
```sh [macOS]
|
||||
@@ -398,7 +398,7 @@ brew services start mysql
|
||||
sudo mysql_secure_installation
|
||||
|
||||
# 创建数据库
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
```
|
||||
|
||||
```sh [Ubuntu / Debian]
|
||||
@@ -408,7 +408,7 @@ sudo systemctl enable mysql
|
||||
sudo mysql_secure_installation
|
||||
|
||||
# 创建数据库
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
```
|
||||
|
||||
```sh [Rocky Linux / CentOS]
|
||||
@@ -418,7 +418,7 @@ sudo systemctl enable mysqld
|
||||
sudo mysql_secure_installation
|
||||
|
||||
# 创建数据库
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp6.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
mysql -u root -proot -e "CREATE DATABASE `rxthinkcmf.thinkphp8.elevue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
```
|
||||
|
||||
:::
|
||||
@@ -443,7 +443,7 @@ PostgreSQL 功能强大,支持 JSONB、全文检索等高级特性,需单独
|
||||
psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'root';"
|
||||
|
||||
# 创建数据库
|
||||
psql -U postgres -c "CREATE DATABASE \"rxthinkcmf.thinkphp6.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
psql -U postgres -c "CREATE DATABASE \"rxthinkcmf.thinkphp8.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
```
|
||||
|
||||
```sh [macOS]
|
||||
@@ -454,8 +454,8 @@ brew services start postgresql
|
||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'root';"
|
||||
|
||||
# 创建数据库
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp6.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp6.elevue\" TO postgres;"
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp8.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp8.elevue\" TO postgres;"
|
||||
```
|
||||
|
||||
```sh [Ubuntu / Debian]
|
||||
@@ -466,8 +466,8 @@ sudo systemctl start postgresql
|
||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'root';"
|
||||
|
||||
# 创建数据库
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp6.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp6.elevue\" TO postgres;"
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp8.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp8.elevue\" TO postgres;"
|
||||
```
|
||||
|
||||
```sh [Rocky Linux / CentOS]
|
||||
@@ -479,8 +479,8 @@ sudo systemctl start postgresql
|
||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'root';"
|
||||
|
||||
# 创建数据库
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp6.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp6.elevue\" TO postgres;"
|
||||
sudo -u postgres psql -c "CREATE DATABASE \"rxthinkcmf.thinkphp8.elevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp8.elevue\" TO postgres;"
|
||||
```
|
||||
|
||||
:::
|
||||
@@ -547,7 +547,7 @@ SQL Server 是微软商业数据库,XAMPP 已自带 pdo_sqlsrv 驱动,Window
|
||||
# extension=php_pdo_sqlsrv_82_ts_x64.dll
|
||||
|
||||
# 创建数据库
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp8.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
```
|
||||
|
||||
```sh [macOS]
|
||||
@@ -560,7 +560,7 @@ docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=root" \
|
||||
pecl install pdo_sqlsrv
|
||||
|
||||
# 创建数据库
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp8.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
```
|
||||
|
||||
```sh [Ubuntu / Debian]
|
||||
@@ -582,7 +582,7 @@ echo "extension=pdo_sqlsrv.so" | sudo tee /etc/php/8.2/mods-available/pdo_sqlsrv
|
||||
sudo phpenmod pdo_sqlsrv
|
||||
|
||||
# 创建数据库
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp8.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
```
|
||||
|
||||
```sh [Rocky Linux / CentOS]
|
||||
@@ -602,7 +602,7 @@ sudo pecl install pdo_sqlsrv
|
||||
echo "extension=pdo_sqlsrv.so" | sudo tee /etc/php.d/pdo_sqlsrv.ini
|
||||
|
||||
# 创建数据库
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp6.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
sqlcmd -S localhost -U sa -P root -Q "CREATE DATABASE [rxthinkcmf.thinkphp8.elevue] COLLATE Chinese_PRC_CI_AS"
|
||||
```
|
||||
|
||||
:::
|
||||
@@ -636,7 +636,7 @@ Oracle 是企业级商业数据库,需手动安装 Instant Client 和 pdo_oci
|
||||
# .env 配置
|
||||
# DATABASE.TYPE = oracle
|
||||
# DATABASE.HOSTNAME = 127.0.0.1
|
||||
# DATABASE.DATABASE = rxthinkcmf.thinkphp6.elevue
|
||||
# DATABASE.DATABASE = rxthinkcmf.thinkphp8.elevue
|
||||
# DATABASE.USERNAME = root
|
||||
# DATABASE.PASSWORD = root
|
||||
# DATABASE.HOSTPORT = 1521
|
||||
@@ -668,8 +668,8 @@ sudo phpenmod pdo_oci
|
||||
|
||||
# 4. 创建表空间和用户
|
||||
sqlplus system/root@localhost:1521/XE <<EOF
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp6_elevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp6_elevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp6_elevue";
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp8_elevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp8_elevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp8_elevue";
|
||||
GRANT CONNECT, RESOURCE, CREATE VIEW TO "root";
|
||||
GRANT UNLIMITED TABLESPACE TO "root";
|
||||
EXIT;
|
||||
@@ -692,8 +692,8 @@ sudo phpenmod pdo_oci
|
||||
|
||||
# 4. 创建表空间和用户
|
||||
sqlplus system/root@localhost:1521/XE <<EOF
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp6_elevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp6_elevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp6_elevue";
|
||||
CREATE TABLESPACE "rxthinkcmf_thinkphp8_elevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp8_elevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp8_elevue";
|
||||
GRANT CONNECT, RESOURCE, CREATE VIEW TO "root";
|
||||
GRANT UNLIMITED TABLESPACE TO "root";
|
||||
EXIT;
|
||||
|
||||
@@ -41,7 +41,7 @@ php think run --port 8080
|
||||
A: 检查以下几点:
|
||||
1. MySQL 服务是否启动:`systemctl status mysql`
|
||||
2. `.env` 中的数据库配置是否正确
|
||||
3. 数据库用户是否有权限:`GRANT ALL ON \`rxthinkcmf.thinkphp6.elevue\`.* TO 'root'@'localhost'`
|
||||
3. 数据库用户是否有权限:`GRANT ALL ON \`rxthinkcmf.thinkphp8.elevue\`.* TO 'root'@'localhost'`
|
||||
|
||||
### Q: 登录返回 401
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ VITE_PORT = 8001
|
||||
VITE_PUBLIC_PATH = /
|
||||
|
||||
# 代理配置(JSON 数组格式:[["前缀","目标地址"]])
|
||||
VITE_PROXY = [["/api","http://admin.thinkphp6.elevue/api"]]
|
||||
VITE_PROXY = [["/api","http://admin.thinkphp8.elevue/api"]]
|
||||
|
||||
# API 接口基础路径(留空,由代理处理)
|
||||
VITE_GLOB_API_URL =
|
||||
@@ -50,7 +50,7 @@ VITE_GLOB_API_URL_PREFIX = /api
|
||||
VITE_GLOB_UPLOAD_URL = /api/upload
|
||||
|
||||
# 图片访问地址
|
||||
VITE_GLOB_IMG_URL = http://file.thinkphp6.elevue
|
||||
VITE_GLOB_IMG_URL = http://file.thinkphp8.elevue
|
||||
|
||||
# 是否启用 Mock 数据(false = 使用真实后端 API)
|
||||
VITE_USE_MOCK = false
|
||||
@@ -75,7 +75,7 @@ VITE_GLOB_API_URL_PREFIX = /api
|
||||
VITE_GLOB_UPLOAD_URL = /api/upload
|
||||
|
||||
# 图片访问地址
|
||||
VITE_GLOB_IMG_URL = http://file.thinkphp6.elevue
|
||||
VITE_GLOB_IMG_URL = http://file.thinkphp8.elevue
|
||||
|
||||
# 是否启用 gzip 压缩
|
||||
VITE_BUILD_COMPRESS = gzip
|
||||
@@ -117,7 +117,7 @@ server: {
|
||||
port: 8001, // 开发服务器端口(对应 VITE_PORT)
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://admin.thinkphp6.elevue/api', // 后端服务地址(对应 VITE_PROXY)
|
||||
target: 'http://admin.thinkphp8.elevue/api', // 后端服务地址(对应 VITE_PROXY)
|
||||
changeOrigin: true, // 开启跨域(修改请求头的 Origin)
|
||||
rewrite: (path) => path, // 保持路径不变(不做路径替换)
|
||||
},
|
||||
@@ -135,7 +135,7 @@ server: {
|
||||
4. 登录成功后进入控制台页面
|
||||
|
||||
:::tip 代理原理
|
||||
浏览器 → `http://localhost:8001/api/login` → Vite 代理 → `http://admin.thinkphp6.elevue/api/login` → 后端处理
|
||||
浏览器 → `http://localhost:8001/api/login` → Vite 代理 → `http://admin.thinkphp8.elevue/api/login` → 后端处理
|
||||
:::
|
||||
|
||||
## 构建生产版本
|
||||
@@ -187,5 +187,5 @@ server: {
|
||||
# -X POST → POST 方法
|
||||
# -H → 设置 Content-Type 为 JSON
|
||||
# -d → 发送 JSON 请求体
|
||||
curl http://admin.thinkphp6.elevue/api/login -X POST -H "Content-Type: application/json" -d '{"username":"admin","password":"123456"}'
|
||||
curl http://admin.thinkphp8.elevue/api/login -X POST -H "Content-Type: application/json" -d '{"username":"admin","password":"123456"}'
|
||||
```
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
│ HTTP (JSON)
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ 后端(ThinkPHP 6.1) │
|
||||
│ 后端(ThinkPHP 8) │
|
||||
│ │
|
||||
│ 路由 → 中间件栈 → 控制器 → 逻辑层 → 模型 → 数据库 │
|
||||
│ │
|
||||
|
||||
@@ -109,9 +109,9 @@ php think db:migrate [选项]
|
||||
# --drop-target-first → 迁移前先删除目标库中的同名表(避免表已存在报错)
|
||||
php think db:migrate \
|
||||
--src-type=mysql --src-host=127.0.0.1 --src-hostport=3306 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=root --src-password=root \
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=root --src-password=root \
|
||||
--dst-type=pgsql --dst-host=127.0.0.1 --dst-hostport=5432 \
|
||||
--dst-database=rxthinkcmf.thinkphp6.elevue --dst-username=postgres --dst-password=123456 \
|
||||
--dst-database=rxthinkcmf.thinkphp8.elevue --dst-username=postgres --dst-password=123456 \
|
||||
--drop-target-first
|
||||
```
|
||||
|
||||
@@ -125,9 +125,9 @@ php think db:migrate \
|
||||
# --dst-hostport=1433 → SQL Server 默认端口
|
||||
php think db:migrate \
|
||||
--src-type=mysql --src-host=127.0.0.1 --src-hostport=3306 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=root --src-password=root \
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=root --src-password=root \
|
||||
--dst-type=sqlsrv --dst-host=127.0.0.1 --dst-hostport=1433 \
|
||||
--dst-database=rxthinkcmf.thinkphp6.elevue --dst-username=sa --dst-password=123456 \
|
||||
--dst-database=rxthinkcmf.thinkphp8.elevue --dst-username=sa --dst-password=123456 \
|
||||
--drop-target-first
|
||||
```
|
||||
|
||||
@@ -141,8 +141,8 @@ php think db:migrate \
|
||||
# --dst-database → SQLite 文件路径(文件不存在时自动创建)
|
||||
php think db:migrate \
|
||||
--src-type=mysql --src-host=127.0.0.1 --src-hostport=3306 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=root --src-password=root \
|
||||
--dst-type=sqlite --dst-database=runtime/rxthinkcmf.thinkphp6.elevue.db
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=root --src-password=root \
|
||||
--dst-type=sqlite --dst-database=runtime/rxthinkcmf.thinkphp8.elevue.db
|
||||
```
|
||||
|
||||
### MySQL → MySQL(同库复制)
|
||||
@@ -167,9 +167,9 @@ php think db:migrate \
|
||||
# -----------------------------------------------------------------------------
|
||||
php think db:migrate \
|
||||
--src-type=pgsql --src-host=127.0.0.1 --src-hostport=5432 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=postgres --src-password=123456 \
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=postgres --src-password=123456 \
|
||||
--dst-type=mysql --dst-host=127.0.0.1 --dst-hostport=3306 \
|
||||
--dst-database=rxthinkcmf.thinkphp6.elevue --dst-username=root --dst-password=root \
|
||||
--dst-database=rxthinkcmf.thinkphp8.elevue --dst-username=root --dst-password=root \
|
||||
--drop-target-first
|
||||
```
|
||||
|
||||
@@ -181,9 +181,9 @@ php think db:migrate \
|
||||
# -----------------------------------------------------------------------------
|
||||
php think db:migrate \
|
||||
--src-type=sqlsrv --src-host=127.0.0.1 --src-hostport=1433 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=sa --src-password=123456 \
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=sa --src-password=123456 \
|
||||
--dst-type=mysql --dst-host=127.0.0.1 --dst-hostport=3306 \
|
||||
--dst-database=rxthinkcmf.thinkphp6.elevue --dst-username=root --dst-password=root \
|
||||
--dst-database=rxthinkcmf.thinkphp8.elevue --dst-username=root --dst-password=root \
|
||||
--drop-target-first
|
||||
```
|
||||
|
||||
@@ -196,9 +196,9 @@ php think db:migrate \
|
||||
# --tables=think_user,think_role,think_menu → 只迁移这 3 张表
|
||||
php think db:migrate \
|
||||
--src-type=mysql --src-host=127.0.0.1 --src-hostport=3306 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=root --src-password=root \
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=root --src-password=root \
|
||||
--dst-type=pgsql --dst-host=127.0.0.1 --dst-hostport=5432 \
|
||||
--dst-database=rxthinkcmf.thinkphp6.elevue --dst-username=postgres --dst-password=123456 \
|
||||
--dst-database=rxthinkcmf.thinkphp8.elevue --dst-username=postgres --dst-password=123456 \
|
||||
--tables=think_user,think_role,think_menu \
|
||||
--drop-target-first
|
||||
```
|
||||
@@ -210,17 +210,17 @@ php think db:migrate \
|
||||
```bash
|
||||
$ php think db:migrate \
|
||||
--src-type=mysql --src-host=127.0.0.1 --src-hostport=3306 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=root --src-password=root \
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=root --src-password=root \
|
||||
--dst-type=pgsql --dst-host=127.0.0.1 --dst-hostport=5432 \
|
||||
--dst-database=rxthinkcmf.thinkphp6.elevue --dst-username=postgres --dst-password=123456 \
|
||||
--dst-database=rxthinkcmf.thinkphp8.elevue --dst-username=postgres --dst-password=123456 \
|
||||
--drop-target-first
|
||||
|
||||
==============================================================
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp6.elevue → 目标: pgsql:rxthinkcmf.thinkphp6.elevue
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp8.elevue → 目标: pgsql:rxthinkcmf.thinkphp8.elevue
|
||||
[迁移开始] 待迁移 25 张表
|
||||
==============================================================
|
||||
[·] [1/5] 建目标库...
|
||||
· 目标库 "rxthinkcmf.thinkphp6.elevue" 已就绪
|
||||
· 目标库 "rxthinkcmf.thinkphp8.elevue" 已就绪
|
||||
[✓] [1/5] 建目标库 完成(耗时 0ms)
|
||||
[·] [2/5] 建表结构(25 张表)...
|
||||
[✓] [2/5] 建表结构 完成(耗时 440ms),25 张表,118 个索引,0 个外键
|
||||
@@ -266,17 +266,17 @@ $ php think db:migrate \
|
||||
```bash
|
||||
$ php think db:migrate \
|
||||
--src-type=mysql --src-host=127.0.0.1 --src-hostport=3306 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=root --src-password=root \
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=root --src-password=root \
|
||||
--dst-type=sqlsrv --dst-host=127.0.0.1 --dst-hostport=1433 \
|
||||
--dst-database=rxthinkcmf.thinkphp6.elevue --dst-username=sa --dst-password=123456 \
|
||||
--dst-database=rxthinkcmf.thinkphp8.elevue --dst-username=sa --dst-password=123456 \
|
||||
--drop-target-first
|
||||
|
||||
==============================================================
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp6.elevue → 目标: sqlsrv:rxthinkcmf.thinkphp6.elevue
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp8.elevue → 目标: sqlsrv:rxthinkcmf.thinkphp8.elevue
|
||||
[迁移开始] 待迁移 25 张表
|
||||
==============================================================
|
||||
[·] [1/5] 建目标库...
|
||||
· 目标库 "rxthinkcmf.thinkphp6.elevue" 已就绪
|
||||
· 目标库 "rxthinkcmf.thinkphp8.elevue" 已就绪
|
||||
[✓] [1/5] 建目标库 完成(耗时 0ms)
|
||||
[·] [2/5] 建表结构(25 张表)...
|
||||
[✓] [2/5] 建表结构 完成(耗时 1.5s),25 张表,118 个索引,0 个外键
|
||||
@@ -298,13 +298,13 @@ $ php think db:migrate \
|
||||
```bash
|
||||
$ php think db:migrate \
|
||||
--src-type=mysql --src-host=127.0.0.1 --src-hostport=3306 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=root --src-password=root \
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=root --src-password=root \
|
||||
--dst-type=oracle --dst-host=127.0.0.1 --dst-hostport=1521 \
|
||||
--dst-database=rxthinkcmf --dst-username=system --dst-password=123456 \
|
||||
--drop-target-first
|
||||
|
||||
==============================================================
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp6.elevue → 目标: oracle:rxthinkcmf.thinkphp6.elevue
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp8.elevue → 目标: oracle:rxthinkcmf.thinkphp8.elevue
|
||||
[迁移开始] 待迁移 25 张表
|
||||
==============================================================
|
||||
[·] [1/5] 建目标库...
|
||||
@@ -347,15 +347,15 @@ $ php think db:migrate \
|
||||
```bash
|
||||
$ php think db:migrate \
|
||||
--src-type=mysql --src-host=127.0.0.1 --src-hostport=3306 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=root --src-password=root \
|
||||
--dst-type=sqlite --dst-database=runtime/rxthinkcmf.thinkphp6.elevue.db
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=root --src-password=root \
|
||||
--dst-type=sqlite --dst-database=runtime/rxthinkcmf.thinkphp8.elevue.db
|
||||
|
||||
==============================================================
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp6.elevue → 目标: sqlite:runtime/rxthinkcmf.thinkphp6.elevue.db
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp8.elevue → 目标: sqlite:runtime/rxthinkcmf.thinkphp8.elevue.db
|
||||
[迁移开始] 待迁移 25 张表
|
||||
==============================================================
|
||||
[·] [1/5] 建目标库...
|
||||
· 目标库 "runtime/rxthinkcmf.thinkphp6.elevue.db" 已就绪
|
||||
· 目标库 "runtime/rxthinkcmf.thinkphp8.elevue.db" 已就绪
|
||||
[✓] [1/5] 建目标库 完成(耗时 0ms)
|
||||
[·] [2/5] 建表结构(25 张表)...
|
||||
[✓] [2/5] 建表结构 完成(耗时 1s),25 张表,118 个索引,0 个外键
|
||||
@@ -378,18 +378,18 @@ $ php think db:migrate \
|
||||
```bash
|
||||
$ php think db:migrate \
|
||||
--src-type=mysql --src-host=127.0.0.1 --src-hostport=3306 \
|
||||
--src-database=rxthinkcmf.thinkphp6.elevue --src-username=root --src-password=root \
|
||||
--src-database=rxthinkcmf.thinkphp8.elevue --src-username=root --src-password=root \
|
||||
--dst-type=pgsql --dst-host=127.0.0.1 --dst-hostport=5432 \
|
||||
--dst-database=rxthinkcmf.thinkphp6.elevue --dst-username=postgres --dst-password=123456 \
|
||||
--dst-database=rxthinkcmf.thinkphp8.elevue --dst-username=postgres --dst-password=123456 \
|
||||
--tables=think_user,think_role,think_menu \
|
||||
--drop-target-first
|
||||
|
||||
==============================================================
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp6.elevue → 目标: pgsql:rxthinkcmf.thinkphp6.elevue
|
||||
[迁移开始] 源: mysql:rxthinkcmf.thinkphp8.elevue → 目标: pgsql:rxthinkcmf.thinkphp8.elevue
|
||||
[迁移开始] 待迁移 3 张表
|
||||
==============================================================
|
||||
[·] [1/5] 建目标库...
|
||||
· 目标库 "rxthinkcmf.thinkphp6.elevue" 已就绪
|
||||
· 目标库 "rxthinkcmf.thinkphp8.elevue" 已就绪
|
||||
[✓] [1/5] 建目标库 完成(耗时 0ms)
|
||||
[·] [2/5] 建表结构(3 张表)...
|
||||
· 已删除目标表: think_user
|
||||
@@ -789,7 +789,7 @@ D:\xampp8.2\php\php.exe -m | findstr sqlite
|
||||
5. `--drop-target-first` 会删除目标表的全部数据(含索引、外键和注释),请谨慎使用
|
||||
6. 大表迁移建议调大 `--batch-size`(如 5000)以提高效率
|
||||
7. 迁移过程中如遇中断,已提交的 `--batch-size` 批次数据不会回滚,建议使用 `--drop-target-first` 重试
|
||||
8. 含点号的数据库名(如 `rxthinkcmf.thinkphp6.elevue`)各驱动均已适配
|
||||
8. 含点号的数据库名(如 `rxthinkcmf.thinkphp8.elevue`)各驱动均已适配
|
||||
9. 索引、外键和注释在建表阶段同步迁移,使用 `--drop-target-first` 重建时会一并重建
|
||||
10. 外键约束在所有表创建后统一添加,避免引用顺序问题
|
||||
11. 命令退出码:成功返回 0,失败或行数校验未通过返回 1(可用于 CI/CD 判断)
|
||||
@@ -850,7 +850,7 @@ A: Oracle 没有原生自增语法。迁移工具会自动为自增列创建序
|
||||
|
||||
### Q: 含点号的数据库名支持吗?
|
||||
|
||||
A: 支持。如 `rxthinkcmf.thinkphp6.elevue` 这类含点号的库名,各驱动均已适配。
|
||||
A: 支持。如 `rxthinkcmf.thinkphp8.elevue` 这类含点号的库名,各驱动均已适配。
|
||||
|
||||
### Q: SQLite 作为目标有什么限制?
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ return [
|
||||
```ini
|
||||
; .env
|
||||
[FILE]
|
||||
UPLOAD_DIR = D:/uploads/rxthinkcmf
|
||||
UPLOAD_DIR = D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue\uploads
|
||||
```
|
||||
|
||||
**要求:**
|
||||
@@ -47,10 +47,10 @@ UPLOAD_DIR = D:/uploads/rxthinkcmf
|
||||
|
||||
| 环境 | 路径示例 |
|
||||
|------|---------|
|
||||
| Windows 开发 | `D:/uploads/rxthinkcmf` |
|
||||
| Linux 开发 | `/home/www/uploads/rxthinkcmf` |
|
||||
| Linux 生产 | `/data/uploads/rxthinkcmf` |
|
||||
| Docker | `/uploads/rxthinkcmf`(挂载卷) |
|
||||
| Windows 开发 | `D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue\uploads` |
|
||||
| Linux 开发 | `/home/www/uploads` |
|
||||
| Linux 生产 | `/opt/data/uploads` |
|
||||
| Docker | `/data/apps/uploads`(挂载卷) |
|
||||
|
||||
### domain_url — 文件访问域名
|
||||
|
||||
@@ -70,7 +70,7 @@ DOMAIN_URL = https://cdn.example.com
|
||||
| 环境 | 域名示例 |
|
||||
|------|---------|
|
||||
| 本地开发 | (留空,使用相对路径) |
|
||||
| 测试环境 | `https://test-cdn.example.com` |
|
||||
| 测试环境 | `http://file.thinkphp8.elevue` |
|
||||
| 生产环境 | `https://cdn.example.com` |
|
||||
| 对象存储 | `https://bucket-name.oss-cn-hangzhou.aliyuncs.com` |
|
||||
|
||||
@@ -124,7 +124,7 @@ FILE_EXT = gif,jpg,jpeg,png,bmp,webp,svg,doc,docx,xls,xlsx,ppt,pptx,pdf,zip,rar,
|
||||
|
||||
```ini
|
||||
[FILE]
|
||||
UPLOAD_DIR = D:/uploads/rxthinkcmf
|
||||
UPLOAD_DIR = D:\xampp8.2\htdocs\RXThinkCMF_ThinkPhp8_EleVue\uploads
|
||||
DOMAIN_URL =
|
||||
MAX_SIZE = 10
|
||||
```
|
||||
@@ -133,8 +133,8 @@ MAX_SIZE = 10
|
||||
|
||||
```ini
|
||||
[FILE]
|
||||
UPLOAD_DIR = /home/www/uploads/rxthinkcmf
|
||||
DOMAIN_URL = https://test-cdn.example.com
|
||||
UPLOAD_DIR = /home/www/uploads
|
||||
DOMAIN_URL = http://file.thinkphp8.elevue
|
||||
MAX_SIZE = 10
|
||||
```
|
||||
|
||||
@@ -142,7 +142,7 @@ MAX_SIZE = 10
|
||||
|
||||
```ini
|
||||
[FILE]
|
||||
UPLOAD_DIR = /data/uploads/rxthinkcmf
|
||||
UPLOAD_DIR = /opt/data/uploads
|
||||
DOMAIN_URL = https://cdn.example.com
|
||||
MAX_SIZE = 10
|
||||
IMAGE_EXT = jpg,jpeg,png,gif,bmp,webp
|
||||
@@ -154,7 +154,7 @@ FILE_EXT = jpg,jpeg,png,gif,bmp,webp,doc,docx,xls,xlsx,pdf,zip,rar
|
||||
```ini
|
||||
; 如果使用阿里云 OSS 等对象存储,domain_url 设为 OSS 域名
|
||||
[FILE]
|
||||
UPLOAD_DIR = /data/uploads/rxthinkcmf
|
||||
UPLOAD_DIR = /opt/data/uploads
|
||||
DOMAIN_URL = https://your-bucket.oss-cn-hangzhou.aliyuncs.com
|
||||
MAX_SIZE = 50
|
||||
```
|
||||
@@ -235,12 +235,12 @@ class ArticleLogic extends BaseTenantLogic
|
||||
|
||||
```text
|
||||
配置:
|
||||
upload_dir = /data/uploads/rxthinkcmf
|
||||
upload_dir = /opt/data/uploads
|
||||
fileSaveDir = article
|
||||
|
||||
结果:
|
||||
临时文件: /data/uploads/rxthinkcmf/temp/20260920/abc.jpg
|
||||
正式文件: /data/uploads/rxthinkcmf/article/20260920/abc.jpg
|
||||
临时文件: /opt/data/uploads/temp/20260920/abc.jpg
|
||||
正式文件: /opt/data/uploads/article/20260920/abc.jpg
|
||||
数据库存: /uploads/article/20260920/abc.jpg
|
||||
前端显示: https://cdn.example.com/uploads/article/20260920/abc.jpg
|
||||
```
|
||||
@@ -252,7 +252,7 @@ class ArticleLogic extends BaseTenantLogic
|
||||
```nginx
|
||||
# 配置 Nginx 直接处理文件请求,不经过 PHP
|
||||
location /uploads/ {
|
||||
alias /data/uploads/rxthinkcmf/;
|
||||
alias /opt/data/uploads/;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
@@ -285,8 +285,8 @@ location ~ /\. {
|
||||
|
||||
```bash
|
||||
# Linux
|
||||
chmod -R 755 /data/uploads/rxthinkcmf
|
||||
chown -R www:www /data/uploads/rxthinkcmf
|
||||
chmod -R 755 /opt/data/uploads
|
||||
chown -R www:www /opt/data/uploads
|
||||
```
|
||||
|
||||
### 问题 2:上传后图片不显示
|
||||
@@ -319,7 +319,7 @@ max_execution_time = 300
|
||||
|
||||
```bash
|
||||
# 定时任务:每天凌晨清理 1 天前的临时文件
|
||||
find /data/uploads/rxthinkcmf/temp/ -type f -mtime +1 -delete
|
||||
find /opt/data/uploads/temp/ -type f -mtime +1 -delete
|
||||
```
|
||||
|
||||
## 安全建议
|
||||
|
||||
@@ -157,7 +157,7 @@ pnpm build # 生产环境构建
|
||||
|
||||
```bash
|
||||
# 1. 从官方网站下载源码包并解压
|
||||
cd thinkphp6
|
||||
cd RXThinkCMF_ThinkPhp8_EleVue
|
||||
|
||||
# 2. 安装依赖
|
||||
composer install
|
||||
@@ -165,7 +165,7 @@ composer install
|
||||
# 3. 配置 .env(数据库、JWT 密钥)
|
||||
|
||||
# 4. 导入数据库
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp8.elevue < document/mysql/rxthinkcmf.thinkphp8.elevue.sql
|
||||
|
||||
# 5. 启动后端
|
||||
php think run
|
||||
|
||||
Reference in New Issue
Block a user