feat: 初始化智能物联网设备管理系统前后端基础项目

完成项目整体结构搭建,包含:
1. 前端Vue3+TS+Vite+Antd项目基础配置与核心依赖
2. 后端MidwayJS+TypeORM+JWT权限认证框架
3. 完整的用户、角色、权限、日志数据库表结构
4. 核心业务模块API与基础服务实现
5. 全局样式、路由、状态管理配置
This commit is contained in:
andyesfly committed 2026-05-28 16:23:15 +08:00
commit 3d7eb12103
89 files changed
+16085

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
import { MidwayConfig } from "@midwayjs/core";
import { join } from "path";
export default {
keys: "smart-grid-iot-secret-key",
koa: {
port: 7001
},
sequelize: {
dataSource: {
default: {
dialect: "mysql",
host: process.env.MYSQL_HOST || "localhost",
port: Number(process.env.MYSQL_PORT) || 3306,
database: process.env.MYSQL_DATABASE || "smart_grid_iot",
username: process.env.MYSQL_USERNAME || "root",
password: process.env.MYSQL_PASSWORD || "123",
timezone: "+08:00",
models: [join(__dirname, "../entity")],
define: {
timestamps: true,
underscored: true,
createdAt: "created_at",
updatedAt: "updated_at"
},
pool: {
max: 10,
min: 0,
acquire: 30000,
idle: 10000
}
}
},
sync: false
},
redis: {
client: {
host: process.env.REDIS_HOST || "localhost",
port: Number(process.env.REDIS_PORT) || 6379,
password: process.env.REDIS_PASSWORD || "",
db: 0
}
},
jwt: {
secret: "smart-grid-iot-admin-jwt-secret-key-2024",
expiresIn: "2h",
refreshExpiresIn: "7d"
},
cors: {
origin: "*",
allowMethods: "GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS",
exposeHeaders: "Content-Type,Authorization,X-Requested-With",
credentials: true
},
security: {
csrf: {
enable: false
}
},
middleware: ["authMiddleware", "rbacMiddleware", "logMiddleware"],
middlewareConfig: {
authMiddleware: {
match: "/api/**",
ignore: ["/api/auth/**", "/api/health"]
},
rbacMiddleware: {
match: "/api/**",
ignore: ["/api/auth/**", "/api/health", "/api/dashboard/**"]
},
logMiddleware: {
match: "/api/**",
ignore: ["/api/logs/**", "/api/health", "/api/auth/login"]
}
}
} as MidwayConfig;