清理调试代码和废弃文件

清理内容:
- 删除废弃文档:DEPLOY.md, FEISHU_PERMISSIONS.md, NGINX.md, WEBSOCKET.md, WINDOWS.md
- 删除废弃服务文件:qiniu-bot.service, start.bat, start.sh
- 删除废弃代码目录:src/cards/
- 优化日志:仅非生产环境输出调试日志
- 保留核心文件:Dockerfile, .env*, README.md, pm2.config.cjs

生产环境设置:
- NODE_ENV=production 时不输出调试日志
- NODE_ENV=development 时输出完整日志
This commit is contained in:
饭团
2026-03-06 12:22:31 +08:00
parent 875df38c0c
commit a18ddc028c
12 changed files with 10 additions and 2069 deletions

View File

@@ -1,185 +0,0 @@
/**
* 配置交互卡片模板
*/
class ConfigCard {
static create(configData) {
const bucketsText = Object.entries(configData.buckets || {})
.map(([name, bucket]) => {
return `**🪣 [${name}]**\n` +
`• 存储桶:${bucket.bucket}\n` +
`• 区域:${bucket.region}\n` +
`• 域名:${bucket.domain}\n` +
`• AccessKey: ${bucket.accessKey}`;
})
.join('\n\n');
return {
"config": {
"wide_screen_mode": true
},
"header": {
"template": "grey",
"title": {
"content": "⚙️ 七牛云配置",
"tag": "plain_text"
}
},
"elements": [
{
"tag": "div",
"text": {
"content": bucketsText || '暂无配置,请先添加存储桶配置。',
"tag": "lark_md"
}
},
{
"tag": "hr"
},
{
"tag": "div",
"text": {
"content": "**💡 修改配置**\n\n使用命令`/config set <key> <value>`\n\n示例\n`/config set default.domain https://new-cdn.com`",
"tag": "lark_md"
}
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"content": "📤 上传文件",
"tag": "plain_text"
},
"type": "primary",
"value": {
"action": "upload_file",
"type": "upload"
}
},
{
"tag": "button",
"text": {
"content": "❓ 帮助",
"tag": "plain_text"
},
"type": "default",
"value": {
"action": "help",
"type": "help"
}
}
]
}
]
};
}
static createEditForm(bucketName) {
return {
"config": {
"wide_screen_mode": true
},
"header": {
"template": "blue",
"title": {
"content": `✏️ 编辑配置 - ${bucketName}`,
"tag": "plain_text"
}
},
"elements": [
{
"tag": "input",
"label": {
"content": "AccessKey",
"tag": "plain_text"
},
"placeholder": {
"content": "请输入七牛云 AccessKey",
"tag": "plain_text"
},
"name": "access_key"
},
{
"tag": "input",
"label": {
"content": "SecretKey",
"tag": "plain_text"
},
"placeholder": {
"content": "请输入七牛云 SecretKey",
"tag": "plain_text"
},
"name": "secret_key"
},
{
"tag": "input",
"label": {
"content": "存储桶名称",
"tag": "plain_text"
},
"placeholder": {
"content": "例如my-bucket",
"tag": "plain_text"
},
"name": "bucket_name"
},
{
"tag": "input",
"label": {
"content": "区域",
"tag": "plain_text"
},
"placeholder": {
"content": "z0/z1/z2/na0/as0",
"tag": "plain_text"
},
"name": "region"
},
{
"tag": "input",
"label": {
"content": "CDN 域名",
"tag": "plain_text"
},
"placeholder": {
"content": "https://cdn.example.com",
"tag": "plain_text"
},
"name": "domain"
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"content": "💾 保存",
"tag": "plain_text"
},
"type": "primary",
"value": {
"action": "save_config",
"bucket": bucketName
}
},
{
"tag": "button",
"text": {
"content": "❌ 取消",
"tag": "plain_text"
},
"type": "default",
"value": {
"action": "cancel"
}
}
]
}
]
};
}
}
module.exports = { ConfigCard };

View File

@@ -1,230 +0,0 @@
/**
* 上传交互卡片模板
*/
class UploadCard {
static create() {
return {
"config": {
"wide_screen_mode": true
},
"header": {
"template": "blue",
"title": {
"content": "🍙 七牛云上传助手",
"tag": "plain_text"
}
},
"elements": [
{
"tag": "div",
"text": {
"content": "**📤 快速上传文件到七牛云**\n\n支持指定路径、多存储桶、自动 CDN 刷新",
"tag": "lark_md"
}
},
{
"tag": "hr"
},
{
"tag": "div",
"text": {
"content": "**💡 使用方式**\n\n• 直接发送文件给我\n• 或使用命令:`/upload [路径] [存储桶]`\n• 支持 `--original` 使用原文件名",
"tag": "lark_md"
}
},
{
"tag": "hr"
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"content": "📎 选择文件上传",
"tag": "plain_text"
},
"type": "primary",
"value": {
"action": "upload_file",
"type": "upload"
}
},
{
"tag": "button",
"text": {
"content": "⚙️ 配置",
"tag": "plain_text"
},
"type": "default",
"value": {
"action": "config",
"type": "config"
}
},
{
"tag": "button",
"text": {
"content": "❓ 帮助",
"tag": "plain_text"
},
"type": "default",
"value": {
"action": "help",
"type": "help"
}
}
]
}
]
};
}
static createUploading(fileName) {
return {
"config": {
"wide_screen_mode": true
},
"header": {
"template": "blue",
"title": {
"content": "📤 上传中...",
"tag": "plain_text"
}
},
"elements": [
{
"tag": "div",
"text": {
"content": `**文件:** ${fileName}\n\n正在上传到七牛云,请稍候...`,
"tag": "lark_md"
}
},
{
"tag": "progress_bar",
"tag": "div",
"text": {
"content": "上传进度",
"tag": "plain_text"
},
"value": 50,
"color": "blue"
}
]
};
}
static createSuccess(result) {
return {
"config": {
"wide_screen_mode": true
},
"header": {
"template": "green",
"title": {
"content": "✅ 上传成功",
"tag": "plain_text"
}
},
"elements": [
{
"tag": "div",
"text": {
"content": `**📦 文件:** ${result.key}\n\n` +
`**🔗 链接:** [点击查看](${result.url})\n\n` +
`**🪣 存储桶:** ${result.bucket || 'default'}`,
"tag": "lark_md"
}
},
{
"tag": "hr"
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"content": "🔗 复制链接",
"tag": "plain_text"
},
"type": "default",
"value": {
"action": "copy_link",
"url": result.url
}
},
{
"tag": "button",
"text": {
"content": "📤 继续上传",
"tag": "plain_text"
},
"type": "primary",
"value": {
"action": "upload_file",
"type": "upload"
}
}
]
}
]
};
}
static createError(error) {
return {
"config": {
"wide_screen_mode": true
},
"header": {
"template": "red",
"title": {
"content": "❌ 上传失败",
"tag": "plain_text"
}
},
"elements": [
{
"tag": "div",
"text": {
"content": `**错误信息:**\n${error.message}\n\n请检查配置或联系管理员。`,
"tag": "lark_md"
}
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"content": "🔄 重试",
"tag": "plain_text"
},
"type": "primary",
"value": {
"action": "upload_file",
"type": "upload"
}
},
{
"tag": "button",
"text": {
"content": "⚙️ 检查配置",
"tag": "plain_text"
},
"type": "default",
"value": {
"action": "config",
"type": "config"
}
}
]
}
]
};
}
}
module.exports = { UploadCard };

View File

@@ -8,10 +8,12 @@ const path = require('path');
const https = require('https');
const lark = require('@larksuiteoapi/node-sdk');
// 日志函数
// 生产环境日志(仅关键信息)
function log(...args) {
const timestamp = new Date().toISOString();
console.log(`[${timestamp}] [FeishuAPI]`, ...args);
if (process.env.NODE_ENV !== 'production') {
const timestamp = new Date().toISOString();
console.log(`[${timestamp}] [FeishuAPI]`, ...args);
}
}
class FeishuAPI {

View File

@@ -18,9 +18,12 @@ const PORT = process.env.PORT || 3030;
app.use(express.json());
// 生产环境日志(仅关键信息)
function log(...args) {
const timestamp = new Date().toISOString();
console.log(`[${timestamp}]`, ...args);
if (process.env.NODE_ENV !== 'production') {
const timestamp = new Date().toISOString();
console.log(`[${timestamp}]`, ...args);
}
}
// 加载完整配置