签入版本
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
```bash
|
||||
# 进入项目目录(以实际解压路径为准)
|
||||
cd thinkphp6
|
||||
cd RXThinkCMF_ThinkPhp6_NaiveVue
|
||||
```
|
||||
|
||||
:::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.thinkphp6.naivevue ; 数据库名称
|
||||
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_ThinkPhp6_NaiveVue\uploads ; 上传文件存储目录(绝对路径)
|
||||
DOMAIN_URL = http://file.thinkphp6.naivevue ; 文件访问域名
|
||||
```
|
||||
|
||||
:::danger 生产环境务必修改
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
```text
|
||||
document/
|
||||
├── mysql/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # MySQL 版本
|
||||
│ └── rxthinkcmf.thinkphp6.naivevue.sql # MySQL 版本
|
||||
├── postgresql/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # PostgreSQL 版本
|
||||
│ └── rxthinkcmf.thinkphp6.naivevue.sql # PostgreSQL 版本
|
||||
├── sqlserver/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # SQL Server 版本
|
||||
│ └── rxthinkcmf.thinkphp6.naivevue.sql # SQL Server 版本
|
||||
├── oracle/
|
||||
│ └── rxthinkcmf.thinkphp6.elevue.sql # Oracle 版本
|
||||
│ └── rxthinkcmf.thinkphp6.naivevue.sql # Oracle 版本
|
||||
└── sqlite/
|
||||
└── rxthinkcmf.thinkphp6.elevue.sql # SQLite 版本
|
||||
└── rxthinkcmf.thinkphp6.naivevue.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.thinkphp6.naivevue` 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.thinkphp6.naivevue < document/mysql/rxthinkcmf.thinkphp6.naivevue.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.thinkphp6.naivevue ; 数据库名
|
||||
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.thinkphp6.naivevue" OWNER postgres ENCODING 'UTF8';
|
||||
|
||||
-- 授予用户对该数据库的所有权限
|
||||
GRANT ALL PRIVILEGES ON DATABASE "rxthinkcmf.thinkphp6.elevue" TO postgres;
|
||||
GRANT ALL PRIVILEGES ON DATABASE "rxthinkcmf.thinkphp6.naivevue" 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.thinkphp6.naivevue -f document/postgresql/rxthinkcmf.thinkphp6.naivevue.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.thinkphp6.naivevue
|
||||
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.thinkphp6.naivevue.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.thinkphp6.naivevue] 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.thinkphp6.naivevue -i document/sqlserver/rxthinkcmf.thinkphp6.naivevue.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.thinkphp6.naivevue
|
||||
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_thinkphp6_naivevue"
|
||||
DATAFILE '/u01/oradata/rxthinkcmf_thinkphp6_naivevue.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_thinkphp6_naivevue";
|
||||
|
||||
-- 授权
|
||||
-- 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.thinkphp6.naivevue.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.thinkphp6.naivevue
|
||||
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.thinkphp6.naivevue -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.thinkphp6.naivevue -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.thinkphp6.naivevue -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.thinkphp6.naivevue < document/mysql/rxthinkcmf.thinkphp6.naivevue.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.thinkphp6.naivevue\`;"
|
||||
|
||||
# 创建数据库(指定字符集)
|
||||
mysql -u root -proot -e "CREATE DATABASE \`rxthinkcmf.thinkphp6.elevue\` DEFAULT CHARACTER SET utf8mb4;"
|
||||
mysql -u root -proot -e "CREATE DATABASE \`rxthinkcmf.thinkphp6.naivevue\` DEFAULT CHARACTER SET utf8mb4;"
|
||||
|
||||
# 重新导入 SQL
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.elevue < document/mysql/rxthinkcmf.thinkphp6.elevue.sql
|
||||
mysql -u root -proot rxthinkcmf.thinkphp6.naivevue < document/mysql/rxthinkcmf.thinkphp6.naivevue.sql
|
||||
```
|
||||
|
||||
### Q: PostgreSQL 导入报错
|
||||
|
||||
@@ -15,7 +15,6 @@ Docker 方案适合快速体验项目功能,无需手动安装 PHP、MySQL 等
|
||||
## 文件结构
|
||||
|
||||
```
|
||||
thinkphp6/
|
||||
├── docker-compose.yml # 容器编排(项目根目录)
|
||||
├── docker/
|
||||
│ ├── Dockerfile # PHP-FPM 镜像定义
|
||||
@@ -31,7 +30,7 @@ thinkphp6/
|
||||
|
||||
```bash
|
||||
# 从官方网站 (https://www.rxthink.cn) 下载授权源码包并解压
|
||||
cd thinkphp6
|
||||
cd RXThinkCMF_ThinkPhp6_NaiveVue
|
||||
|
||||
# 配置应用环境变量
|
||||
cp .env.example .env
|
||||
@@ -127,12 +126,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.thinkphp6.naivevue} # 自动创建的数据库
|
||||
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.thinkphp6.naivevue.sql:/docker-entrypoint-initdb.d/init.sql:ro # 初始化 SQL
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_general_ci
|
||||
@@ -324,7 +323,7 @@ server {
|
||||
```ini
|
||||
# Docker 环境变量(密码等敏感信息,切勿提交 Git)
|
||||
MYSQL_ROOT_PASSWORD=Your_Strong_Password_2024
|
||||
MYSQL_DATABASE=rxthinkcmf.thinkphp6.elevue
|
||||
MYSQL_DATABASE=rxthinkcmf.thinkphp6.naivevue
|
||||
REDIS_PASSWORD=Your_Redis_Password_2024
|
||||
APP_DEBUG=false
|
||||
```
|
||||
@@ -409,10 +408,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.thinkphp6.naivevue < document/mysql/rxthinkcmf.thinkphp6.naivevue.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.thinkphp6.naivevue
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# 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.thinkphp6.naivevue ; 数据库名
|
||||
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_ThinkPhp6_NaiveVue\uploads ; 上传根目录(绝对路径)
|
||||
DOMAIN_URL = http://file.thinkphp6.naivevue ; 文件访问域名
|
||||
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.thinkphp6.naivevue` 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.thinkphp6.naivevue` 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.thinkphp6.naivevue` 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.thinkphp6.naivevue` 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.thinkphp6.naivevue\" 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.thinkphp6.naivevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp6.naivevue\" 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.thinkphp6.naivevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp6.naivevue\" 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.thinkphp6.naivevue\" OWNER postgres ENCODING 'UTF8';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"rxthinkcmf.thinkphp6.naivevue\" 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.thinkphp6.naivevue] 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.thinkphp6.naivevue] 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.thinkphp6.naivevue] 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.thinkphp6.naivevue] 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.thinkphp6.naivevue
|
||||
# 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_thinkphp6_naivevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp6_naivevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp6_naivevue";
|
||||
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_thinkphp6_naivevue" DATAFILE '/opt/oracle/oradata/XE/rxthinkcmf_thinkphp6_naivevue.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
|
||||
CREATE USER "root" IDENTIFIED BY "root" DEFAULT TABLESPACE "rxthinkcmf_thinkphp6_naivevue";
|
||||
GRANT CONNECT, RESOURCE, CREATE VIEW TO "root";
|
||||
GRANT UNLIMITED TABLESPACE TO "root";
|
||||
EXIT;
|
||||
@@ -905,20 +905,23 @@ strict-ssl = false
|
||||
|
||||
| 依赖 | 版本 | 说明 |
|
||||
|------|------|------|
|
||||
| `vue` | ^3.4.27 | 核心框架 |
|
||||
| `element-plus` | ^2.7.4 | UI 组件库 |
|
||||
| `pinia` | ^2.1.7 | 状态管理 |
|
||||
| `vue-router` | ^4.3.2 | 路由管理 |
|
||||
| `axios` | ^0.27.2 | HTTP 请求 |
|
||||
| `vue` | ^3.5.1 | 核心框架 |
|
||||
| `naive-ui` | ^2.40.0 | UI 组件库 |
|
||||
| `pinia` | ^2.2.2 | 状态管理 |
|
||||
| `vue-router` | ^4.4.3 | 路由管理 |
|
||||
| `axios` | ^1.7.7 | HTTP 请求 |
|
||||
| `typescript` | ^4.9.5 | 类型系统 |
|
||||
| `vite` | ^3.2.10 | 构建工具 |
|
||||
| `vite` | ^5.4.3 | 构建工具 |
|
||||
| `tinymce` | 5.10.3 | 富文本编辑器 |
|
||||
| `echarts` | ^5.5.0 | 图表库 |
|
||||
| `tailwindcss` | ^3.4.3 | CSS 框架 |
|
||||
| `xlsx` | ^0.18.5 | Excel 处理 |
|
||||
| `@element-plus/icons-vue` | ^2.3.1 | Element Plus 图标 |
|
||||
| `dayjs` | ^1.11.11 | 日期处理 |
|
||||
| `lodash` | ^4.17.21 | 工具函数库 |
|
||||
| `@vueup/vue-quill` | 1.0.0-beta.8 | 富文本编辑器(Quill) |
|
||||
| `echarts` | ^5.5.1 | 图表库 |
|
||||
| `tailwindcss` | ^3.4.10 | CSS 框架 |
|
||||
| `less` | ^4.2.0 | CSS 预处理器 |
|
||||
| `xlsx` | ^0.17.5 | Excel 处理 |
|
||||
| `@vicons/antd` | ^0.10.0 | 图标(Ant Design 图标集) |
|
||||
| `@vicons/ionicons5` | ^0.10.0 | 图标(Ionicons 图标集) |
|
||||
| `date-fns` | ^2.30.0 | 日期处理 |
|
||||
| `lodash-es` | ^4.17.21 | 工具函数库 |
|
||||
|
||||
## 开发工具推荐
|
||||
|
||||
|
||||
@@ -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.thinkphp6.naivevue\`.* 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.thinkphp6.naivevue/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.thinkphp6.naivevue
|
||||
|
||||
# 是否启用 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.thinkphp6.naivevue
|
||||
|
||||
# 是否启用 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.thinkphp6.naivevue/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.thinkphp6.naivevue/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.thinkphp6.naivevue/api/login -X POST -H "Content-Type: application/json" -d '{"username":"admin","password":"123456"}'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user