update: readme.md

This commit is contained in:
Kerwin
2025-07-17 14:08:52 +08:00
parent b2644accdf
commit 0134b728d3
43 changed files with 751 additions and 228 deletions

65
.gitignore vendored
View File

@@ -8,6 +8,9 @@
*.out
go.work
# Go workspace file
go.work.sum
# Environment variables
.env
.env.local
@@ -56,54 +59,66 @@ jspm_packages/
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
# Output of npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
# next.js build output
.next
# Nuxt.js build / generate output
# nuxt.js build output
.nuxt
dist
# Gatsby files
.cache/
public
# vuepress build output
.vuepress/dist
# Storybook build outputs
.out
.storybook-out
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# Temporary folders
tmp/
temp/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Database
*.db
*.sqlite
*.sqlite3
# Uploads
uploads/*
!uploads/.gitkeep
!uploads/.gitkeep
# Build artifacts
build/
dist/
# Docker
.dockerignore
# Air live reload
tmp/

85
CHANGELOG.md Normal file
View File

@@ -0,0 +1,85 @@
# 📝 更新日志
本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/) 规范。
## [未发布]
### 新增
- 项目开源准备
- 完善文档和贡献指南
- 添加LICENSE文件
### 修复
- 修复README格式问题
- 优化项目结构说明
## [100 - 202401XX
### 新增
- 🎉 首次发布
- 📁 多平台网盘支持夸克、阿里云盘、百度网盘、UC网盘
- 🔍 智能搜索功能
- 📊 数据统计和分析
- 🏷️ 标签系统
- 👥 用户权限管理
- 📦 批量资源管理
- 🔄 自动处理功能
- 📈 热播剧管理
- ⚙️ 系统配置管理
- 🔐 JWT认证系统
- 📱 响应式设计
- 🌙 深色模式支持
- 🎨 现代化UI界面
### 技术特性
- 🦀 基于Golang 1023的高性能后端
- ⚡ Nuxt.js 3 + Vue 3前端框架
- 🗄️ PostgreSQL数据库
- 🔧 GORM ORM框架
- 🐳 Docker容器化部署
- 📝 TypeScript类型安全
### 核心功能
- 资源管理:增删改查、批量操作
- 分类管理:资源分类和标签
- 平台管理:多网盘平台支持
- 搜索统计:全文搜索和数据分析
- 系统配置:灵活的参数配置
---
## 版本说明
### 版本号格式
- **主版本号**不兼容的API修改
- **次版本号**:向下兼容的功能性新增
- **修订号**:向下兼容的问题修正
### 更新类型
- 🎉 **重大更新** - 新版本发布
-**新增功能** - 新功能或特性
- 🐛 **问题修复** - Bug修复
- 🔧 **优化改进** - 性能优化或代码改进
- 📚 **文档更新** - 文档或注释更新
- 🎨 **界面优化** - UI/UX改进
-**性能提升** - 性能相关改进
- 🔒 **安全更新** - 安全相关修复
- 🧪 **测试相关** - 测试用例或测试工具
- 🚀 **部署相关** - 部署或构建相关
---
## 贡献
如果您想为更新日志做出贡献,请:
1. 在提交代码时使用规范的提交信息2. 在Pull Request中描述您的更改
3. 遵循项目的贡献指南
---
## 链接
- [项目主页](https://github.com/your-username/l9pan)
- [问题反馈](https://github.com/your-username/l9pan/issues)
- [讨论区](https://github.com/your-username/l9

298
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,298 @@
# 🤝 贡献指南
感谢您对 L9Pan 项目的关注!我们欢迎所有形式的贡献。
## 📋 贡献类型
- 🐛 Bug 修复
- ✨ 新功能开发
- 📚 文档改进
- 🎨 UI/UX 优化
- ⚡ 性能优化
- 🧪 测试用例
- 🔧 工具改进
## 🚀 开始贡献
### 1. Fork 项目
1. 访问 [L9Pan GitHub 仓库](https://github.com/ctwj/panResManage)
2. 点击右上角的 Fork 按钮
3. 选择您的 GitHub 账户
### 2. 克隆您的 Fork
```bash
git clone https://github.com/YOUR_USERNAME/resManage.git
cd resManage
```
### 3. 添加上游仓库
```bash
git remote add upstream https://github.com/ctwj/panResManage.git
```
### 4. 创建功能分支
```bash
git checkout -b feature/your-feature-name
# 或者
git checkout -b fix/your-bug-fix
```
## 💻 开发环境设置
### 后端开发
```bash
# 安装 Go 依赖
go mod tidy
# 复制环境变量文件
cp env.example .env
# 编辑环境变量
vim .env
# 启动开发服务器
go run main.go
```
### 前端开发
```bash
# 进入前端目录
cd web
# 安装依赖
pnpm install
# 启动开发服务器
pnpm dev
```
### 数据库设置
```sql
CREATE DATABASE res_db;
```
## 📝 开发规范
### 代码风格
#### Go 代码规范
- 遵循 [Go 官方代码规范](https://golang.org/doc/effective_go.html)
- 使用 `gofmt` 格式化代码
- 函数名使用驼峰命名法
- 包名使用小写字母
- 错误处理要明确
#### TypeScript/JavaScript 规范
- 使用 TypeScript 编写代码
- 遵循 ESLint 规则
- 使用 Prettier 格式化代码
- 组件名使用 PascalCase
- 变量名使用 camelCase
### 提交信息规范
使用中文描述提交信息,格式如下:
```
类型(范围): 简短描述
详细描述(可选)
相关Issue: #123```
类型包括:
- `feat`: 新功能
- `fix`: 修复bug
- `docs`: 文档更新
- `style`: 代码格式调整
- `refactor`: 代码重构
- `test`: 测试相关
- `chore`: 构建过程或辅助工具的变动
示例:
```
feat(资源管理): 添加批量导入功能
- 支持Excel文件导入
- 添加导入进度显示
- 优化错误处理
相关Issue: #45
```
### 分支命名规范
- `feature/功能名称` - 新功能开发
- `fix/问题描述` - Bug修复
- `docs/文档类型` - 文档更新
- `refactor/重构内容` - 代码重构
- `test/测试内容` - 测试相关
## 🧪 测试
### 后端测试
```bash
# 运行所有测试
go test ./...
# 运行特定包的测试
go test ./handlers
# 运行测试并显示覆盖率
go test -cover ./...
```
### 前端测试
```bash
cd web
# 运行单元测试
pnpm test
# 运行E2E测试
pnpm test:e2## 📋 Pull Request 流程
###1. 确保代码质量
- ] 代码通过所有测试
- ] 代码符合项目规范
- ] 添加了必要的文档
- ] 更新了相关文档
### 2 提交 Pull Request
1推送您的分支到您的 Fork
```bash
git push origin feature/your-feature-name
```
2. 在 GitHub 上创建 Pull Request3. 填写 PR 模板4 等待代码审查
###3PR 模板
```markdown
## 📝 描述
简要描述您的更改
## 🎯 类型
- ] Bug 修复
- ] 新功能
- ] 文档更新
- ] 代码重构
- ] 性能优化
- 相关
## 🔗 相关 Issue
关闭 #123
## ✅ 检查清单
- ] 我的代码遵循项目的代码规范
- ] 我已经自测了我的更改
- ] 我已经添加了必要的测试
- ] 我已经更新了相关文档
- ] 我的更改不会产生新的警告
- 我添加了示例来证明我的更改是有效的
## 📸 截图(如果适用)
## 🔧 测试
请描述您如何测试您的更改
## 📋 其他信息
任何其他信息或上下文
```
## 🐛 报告 Bug
### Bug 报告模板
```markdown
## 🐛 Bug 描述
清晰简洁地描述 bug
## 🔄 重现步骤
1. 进入...2. 点击 '....3. 滚动到 ....4 看到错误
## ✅ 预期行为
清晰简洁地描述您期望发生的事情
## 📸 截图
如果适用,添加截图以帮助解释您的问题
## 💻 环境信息
- 操作系统: [例如 Windows 10]
- 浏览器: [例如 Chrome, Safari]
- 版本:例如 22]
## 📱 移动设备(如果适用)
- 设备: [例如 iPhone 6]
- 操作系统: 例如 iOS 8.1]
- 浏览器:例如 Safari]
- 版本: [例如 22]
## 🔧 其他上下文
在此处添加有关问题的任何其他上下文
```
## 💡 功能请求
### 功能请求模板
```markdown
## 💡 功能描述
清晰简洁地描述您想要的功能
## 🎯 问题描述
清晰简洁地描述这个功能要解决的问题
## 💭 建议的解决方案
清晰简洁地描述您希望发生的事情
## 🔄 替代方案
清晰简洁地描述您考虑过的任何替代解决方案或功能
## 📋 其他上下文
在此处添加有关功能请求的任何其他上下文或截图
```
## 📞 联系我们
如果您有任何问题或需要帮助,请通过以下方式联系我们:
- 📧 邮箱: 510199617@qq.com
- 💬 讨论区: [GitHub Discussions](https://github.com/your-username/l9pan/discussions)
- 🐛 问题反馈: [GitHub Issues](https://github.com/your-username/l9pan/issues)
## 🙏 致谢
感谢所有为 L9项目做出贡献的开发者
---
**记住:每一个贡献,无论大小,都是宝贵的!** 🎉

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 L9Pan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

323
README.md
View File

@@ -1,75 +1,114 @@
# 资源管理系统
# 🚀 panResManage - 网盘资源管理系统
一个基于 Golang + Nuxt.js 的资源管理系统,参考网盘资源管理界面设计。
<div align="center>
## 技术栈
![Go Version](https://img.shields.io/badge/Go-1230?logo=go&logoColor=white)
![Vue Version](https://img.shields.io/badge/Vue-334FC08D?logo=vue.js&logoColor=white)
![Nuxt Version](https://img.shields.io/badge/Nuxt-300.8+-00DC82?logo=nuxt.js&logoColor=white)
![License](https://img.shields.io/badge/License-MIT-yellow.svg)
![PostgreSQL](https://img.shields.io/badge/PostgreSQL-15+-336791go=postgresql&logoColor=white)
### 后端
- **Golang** - 主要编程语言
- **Gin** - Web框架
- **PostgreSQL** - 数据库
- **lib/pq** - PostgreSQL驱动
**一个现代化的网盘资源管理系统,支持多平台网盘资源统一管理和分享**
### 前端
- **Nuxt.js 3** - Vue.js框架
- **Vue 3** - 前端框架
- **TypeScript** - 类型安全
- **Tailwind CSS** - 样式框架
🌐 [在线演示](#) | 📖 [文档](#) | 🐛 问题反馈](#) | ⭐ [给个星标](#)
## 项目结构
</div>
```
res_db/
├── main.go # 主程序入口
├── go.mod # Go模块文件
├── env.example # 环境变量示例
├── models/ # 数据模型
│ ├── database.go # 数据库连接
│ └── resource.go # 资源模型
├── handlers/ # API处理器
│ ├── resource.go # 资源相关API
│ └── category.go # 分类相关API
├── web/ # 前端项目
│ ├── nuxt.config.ts # Nuxt配置
│ ├── package.json # 前端依赖
│ ├── pages/ # 页面
│ ├── components/ # 组件
│ └── composables/ # 组合式函数
└── uploads/ # 文件上传目录
---
## ✨ 功能特性
### 🎯 核心功能
- **📁 多平台网盘支持** - 支持夸克网盘、阿里云盘、百度网盘、UC网盘
- **🔍 智能搜索** - 全文搜索、标签筛选、分类浏览
- **📊 数据统计** - 资源统计、搜索分析、热门关键词
- **🏷️ 标签系统** - 灵活的标签管理和资源分类
### 🛠️ 管理功能
- **📦 批量操作** - 批量添加、导入、管理资源
- **🔄 自动处理** - 待处理资源自动转存和分享
- **📈 热播剧管理** - 热门影视资源自动更新
- **⚙️ 系统配置** - 灵活的系统参数配置
### 🎨 用户体验
- **📱 响应式设计** - 支持桌面端和移动端
- **🌙 深色模式** - 支持明暗主题切换
- **⚡ 高性能** - 基于Go的高并发后端
- **🎯 现代化UI** - 基于Tailwind CSS的美观界面
---
## 🏗️ 技术架构
### 后端技术栈
- **🦀 Golang 10.23+** - 高性能后端语言
- **🌿 Gin** - 轻量级Web框架
- **🗄️ PostgreSQL** - 关系型数据库
- **🔧 GORM** - ORM框架
- **🔐 JWT** - 身份认证
### 前端技术栈
- **⚡ Nuxt.js 3 - Vue.js全栈框架
- **🎨 Vue 3** - 渐进式JavaScript框架
- **📝 TypeScript** - 类型安全的JavaScript
- **🎨 Tailwind CSS** - 实用优先的CSS框架
- **🔧 Pinia** - 状态管理
### 开发工具
- **🐳 Docker** - 容器化部署
- **📦 pnpm** - 快速包管理器
- **🔍 Air** - Go热重载工具
---
## 🚀 快速开始
### 环境要求
- **Go**1.23+
- **Node.js** 18+
- **PostgreSQL** 15+
- **pnpm** (推荐) 或 npm
### 方式一Docker 部署(推荐)
```bash
# 克隆项目
git clone https://github.com/ctwj/panResManage.git
cd panResManagepan.git
cd l9pan
# 使用 Docker Compose 启动
docker-compose up -d
# 访问应用
open http://localhost:8080
```
## 快速开始
### 方式二:本地开发
### 1. 环境准备
确保已安装:
- Go 1.21+
- PostgreSQL 12+
- Node.js 18+
### 2. 数据库设置
```sql
CREATE DATABASE res_db;
#### 1. 克隆项目
```bash
git clone https://github.com/ctwj/panResManage.git
cd panResManage
```
### 3. 后端设置
#### 2 后端设置
```bash
# 复制环境变量文件
cp env.example .env
# 修改.env文件中的数据库配置
# 编辑环境变量
vim .env
# 安装依赖
# 安装Go依赖
go mod tidy
# 运行后端
# 启动后端服务
go run main.go
```
### 4. 前端设置
#### 3 前端设置
```bash
# 进入前端目录
cd web
@@ -77,64 +116,150 @@ cd web
# 安装依赖
pnpm install
# 运行开发服务器
# 启动开发服务器
pnpm dev
```
## API接口
### 资源管理
- `GET /api/resources` - 获取资源列表
- `POST /api/resources` - 创建资源
- `PUT /api/resources/:id` - 更新资源
- `DELETE /api/resources/:id` - 删除资源
- `GET /api/resources/:id` - 获取单个资源
### 分类管理
- `GET /api/categories` - 获取分类列表
- `POST /api/categories` - 创建分类
- `PUT /api/categories/:id` - 更新分类
- `DELETE /api/categories/:id` - 删除分类
### 搜索和统计
- `GET /api/search` - 搜索资源
- `GET /api/stats` - 获取统计信息
## 功能特性
- 📁 资源分类管理
- 🔍 全文搜索
- 📊 统计信息
- 🏷️ 标签系统
- 📈 下载/浏览统计
- 🎨 现代化UI界面
## 开发
### 后端开发
```bash
# 热重载开发
go install github.com/cosmtrek/air@latest
air
#### 4. 数据库设置
```sql
-- 创建数据库
CREATE DATABASE res_db;
```
### 前端开发
```bash
cd web
npm run dev
---
## 📁 项目结构
```
l9pan/
├── 📁 common/ # 通用功能模块
│ ├── 📄 pan_factory.go # 网盘工厂模式
│ ├── 📄 alipan.go # 阿里云盘实现
│ ├── 📄 baidu_pan.go # 百度网盘实现
│ ├── 📄 quark_pan.go # 夸克网盘实现
│ └── 📄 uc_pan.go # UC网盘实现
├── 📁 db/ # 数据库层
│ ├── 📁 entity/ # 数据实体
│ ├── 📁 repo/ # 数据仓库
│ ├── 📁 dto/ # 数据传输对象
│ └── 📁 converter/ # 数据转换器
├── 📁 handlers/ # API处理器
├── 📁 middleware/ # 中间件
├── 📁 utils/ # 工具函数
├── 📁 web/ # 前端项目
│ ├── 📁 pages/ # 页面组件
│ ├── 📁 components/ # 通用组件
│ ├── 📁 composables/ # 组合式函数
│ └── 📁 stores/ # 状态管理
├── 📁 docs/ # 项目文档
├── 📄 main.go # 主程序入口
├── 📄 Dockerfile # Docker配置
├── 📄 docker-compose.yml # Docker Compose配置
└── 📄 README.md # 项目说明
```
## 部署
---
## 🔧 配置说明
### 环境变量配置
### Docker部署
```bash
# 构建镜像
docker build -t res-db .
# 数据库配置
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your_password
DB_NAME=res_db
# 运行容器
docker run -p 8080:8080 res-db
# 服务器配置
PORT=8080
```
## 许可证
### 支持的网盘平台
MIT License
| 平台 | 状态 | 功能 |
|------|------|------|
| 夸克网盘 | ✅ 支持 | 转存、分享 |
| 阿里云盘 | 🚧 开发中 | 转存、分享 |
| 百度网盘 | 🚧 开发中 | 转存、分享 |
| UC网盘 | 🚧 开发中 | 转存、分享 |
---
## 📚 API 文档
### 公开统计
提供批量入库和搜索api通过 apiToken 授权
> 📖 完整API文档请访问`http://p.l9.lc/doc.html`
## 🤝 贡献指南
我们欢迎所有形式的贡献!
### 如何贡献
1**Fork** 本仓库2 **创建** 功能分支 (`git checkout -b feature/AmazingFeature`)
3** 更改 (`git commit -mAdd some AmazingFeature'`)
4. **推送** 到分支 (`git push origin feature/AmazingFeature`)
5. **创建** Pull Request
## 📄 许可证
本项目采用 [MIT License](LICENSE) 许可证。
```
MIT License
Copyright (c) 2024 L9Pan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
---
## 🙏 致谢
感谢以下开源项目的支持:
- [Gin](https://github.com/gin-gonic/gin) - Go Web框架
- [Nuxt.js](https://nuxt.com/) - Vue.js全栈框架
- [Tailwind CSS](https://tailwindcss.com/) - CSS框架
- [GORM](https://gorm.io/) - Go ORM库
---
## 📞 联系我们
- **项目地址**: [https://github.com/ctwj/panResManage](https://github.com/ctwj/panResManage)
- **问题反馈**: [Issues](https://github.com/ctwj/panResManage/issues)
- **邮箱**: 510199617@qq.com
---
<div align="center>
**如果这个项目对您有帮助,请给我们一个 ⭐ Star**
Made with ❤️ by [老九]
</div>

View File

@@ -5,11 +5,10 @@ import (
"log"
"os"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"res_db/db/entity"
)
var DB *gorm.DB

View File

@@ -1,8 +1,8 @@
package converter
import (
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
)
// ToResourceResponse 将Resource实体转换为ResourceResponse

View File

@@ -1,8 +1,8 @@
package converter
import (
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
)
// HotDramaToResponse 将热播剧实体转换为响应DTO

View File

@@ -1,8 +1,8 @@
package converter
import (
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
)
// ToSearchStatResponse 将SearchStat实体转换为SearchStatResponse

View File

@@ -3,8 +3,8 @@ package converter
import (
"time"
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
)
// SystemConfigToResponse 将系统配置实体转换为响应DTO

View File

@@ -1,8 +1,8 @@
package converter
import (
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
)
// ToUserResponse 将User实体转换为UserResponse

View File

@@ -1,29 +0,0 @@
-- 添加used_space字段
ALTER TABLE cks ADD COLUMN IF NOT EXISTS used_space BIGINT DEFAULT 0;
-- 更新现有数据将字符串类型的容量字段转换为bigint
-- 注意:这里需要根据实际情况调整转换逻辑
UPDATE cks SET
used_space = CASE
WHEN used_space_text IS NOT NULL AND used_space_text != '' THEN
CASE
WHEN used_space_text LIKE '%GB%' THEN
CAST(REPLACE(REPLACE(used_space_text, 'GB', ''), ' ', '') AS BIGINT) * 1024 * 1024 * 1024
WHEN used_space_text LIKE '%MB%' THEN
CAST(REPLACE(REPLACE(used_space_text, 'MB', ''), ' ', '') AS BIGINT) * 1024 * 1024
WHEN used_space_text LIKE '%KB%' THEN
CAST(REPLACE(REPLACE(used_space_text, 'KB', ''), ' ', '') AS BIGINT) * 1024
ELSE 0
END
ELSE 0
END
WHERE used_space_text IS NOT NULL;
-- 删除旧的字符串类型字段(可选,建议先备份数据)
-- ALTER TABLE cks DROP COLUMN IF EXISTS capacity;
-- ALTER TABLE cks DROP COLUMN IF EXISTS used_space_text;
-- ALTER TABLE cks DROP COLUMN IF EXISTS total_space_text;
-- 添加索引以提高查询性能
CREATE INDEX IF NOT EXISTS idx_cks_used_space ON cks(used_space);
CREATE INDEX IF NOT EXISTS idx_cks_space_left_space ON cks(space, left_space);

View File

@@ -1,7 +1,7 @@
package repo
import (
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

View File

@@ -1,7 +1,7 @@
package repo
import (
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

View File

@@ -1,7 +1,7 @@
package repo
import (
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

View File

@@ -1,7 +1,7 @@
package repo
import (
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

View File

@@ -1,7 +1,7 @@
package repo
import (
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

View File

@@ -2,9 +2,11 @@ package repo
import (
"fmt"
"res_db/db/entity"
"time"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

View File

@@ -3,7 +3,7 @@ package repo
import (
"time"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

View File

@@ -1,7 +1,7 @@
package repo
import (
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

View File

@@ -1,7 +1,7 @@
package repo
import (
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

View File

@@ -1,7 +1,7 @@
package repo
import (
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"gorm.io/gorm"
)

2
go.mod
View File

@@ -1,4 +1,4 @@
module res_db
module github.com/ctwj/panResManage
go 1.23.0

View File

@@ -1,7 +1,7 @@
package handlers
import (
"res_db/db/repo"
"github.com/ctwj/panResManage/db/repo"
)
var repoManager *repo.RepositoryManager

View File

@@ -4,9 +4,9 @@ import (
"net/http"
"strconv"
"res_db/db/converter"
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
"github.com/gin-gonic/gin"
)

View File

@@ -5,10 +5,10 @@ import (
"strconv"
"strings"
panutils "res_db/common"
"res_db/db/converter"
"res_db/db/dto"
"res_db/db/entity"
panutils "github.com/ctwj/panResManage/common"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
"github.com/gin-gonic/gin"
)

View File

@@ -4,10 +4,10 @@ import (
"net/http"
"strconv"
"res_db/db/converter"
"res_db/db/dto"
"res_db/db/entity"
"res_db/db/repo"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
"github.com/ctwj/panResManage/db/repo"
"github.com/gin-gonic/gin"
)

View File

@@ -4,9 +4,9 @@ import (
"net/http"
"strconv"
"res_db/db/converter"
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
"github.com/gin-gonic/gin"
)

View File

@@ -2,10 +2,12 @@ package handlers
import (
"net/http"
"res_db/db/converter"
"res_db/db/dto"
"strconv"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/gin-gonic/gin"
)

View File

@@ -5,9 +5,9 @@ import (
"strconv"
"strings"
"res_db/db/converter"
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
"github.com/gin-gonic/gin"
)

View File

@@ -4,9 +4,9 @@ import (
"net/http"
"strconv"
"res_db/db/converter"
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
"github.com/gin-gonic/gin"
)

View File

@@ -2,8 +2,8 @@ package handlers
import (
"net/http"
"res_db/utils"
"github.com/ctwj/panResManage/utils"
"github.com/gin-gonic/gin"
)

View File

@@ -4,8 +4,8 @@ import (
"net/http"
"strconv"
"res_db/db/converter"
"res_db/db/dto"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/gin-gonic/gin"
)

View File

@@ -1,11 +1,11 @@
package handlers
import (
"res_db/db"
"res_db/db/entity"
"runtime"
"time"
"github.com/ctwj/panResManage/db"
"github.com/ctwj/panResManage/db/entity"
"github.com/gin-gonic/gin"
)

View File

@@ -2,10 +2,11 @@ package handlers
import (
"net/http"
"res_db/db/converter"
"res_db/db/dto"
"res_db/db/repo"
"res_db/utils"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/repo"
"github.com/ctwj/panResManage/utils"
"github.com/gin-gonic/gin"
)

View File

@@ -5,9 +5,9 @@ import (
"net/http"
"strconv"
"res_db/db/converter"
"res_db/db/dto"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
"github.com/gin-gonic/gin"
)

View File

@@ -4,10 +4,10 @@ import (
"net/http"
"strconv"
"res_db/db/converter"
"res_db/db/dto"
"res_db/db/entity"
"res_db/middleware"
"github.com/ctwj/panResManage/db/converter"
"github.com/ctwj/panResManage/db/dto"
"github.com/ctwj/panResManage/db/entity"
"github.com/ctwj/panResManage/middleware"
"github.com/gin-gonic/gin"
)

11
main.go
View File

@@ -3,12 +3,13 @@ package main
import (
"log"
"os"
"res_db/utils"
"res_db/db"
"res_db/db/repo"
"res_db/handlers"
"res_db/middleware"
"github.com/ctwj/panResManage/utils"
"github.com/ctwj/panResManage/db"
"github.com/ctwj/panResManage/db/repo"
"github.com/ctwj/panResManage/handlers"
"github.com/ctwj/panResManage/middleware"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"

View File

@@ -5,7 +5,7 @@ import (
"strings"
"time"
"res_db/db/entity"
"github.com/ctwj/panResManage/db/entity"
"github.com/gin-gonic/gin"
"github.com/golang-jwt/jwt/v5"

View File

@@ -2,8 +2,8 @@ package middleware
import (
"net/http"
"res_db/db/repo"
"github.com/ctwj/panResManage/db/repo"
"github.com/gin-gonic/gin"
)

View File

@@ -1 +1,2 @@
# 此文件用于保持uploads目录在Git中
# This file keeps the uploads directory in git
# Uploaded files will be ignored by .gitignore

View File

@@ -2,8 +2,9 @@ package utils
import (
"log"
"res_db/db/repo"
"sync"
"github.com/ctwj/panResManage/db/repo"
)
// GlobalScheduler 全局调度器管理器

View File

@@ -2,13 +2,14 @@ package utils
import (
"log"
panutils "res_db/common"
commonutils "res_db/common/utils"
"res_db/db/entity"
"res_db/db/repo"
"strings"
"sync"
"time"
panutils "github.com/ctwj/panResManage/common"
commonutils "github.com/ctwj/panResManage/common/utils"
"github.com/ctwj/panResManage/db/entity"
"github.com/ctwj/panResManage/db/repo"
)
// Scheduler 定时任务管理器