feat: 创建初始任务数据
添加 6 个示例任务展示功能: - 4 个已完成任务(日记系统、城市手册、OpenClaw、Git 仓库) - 1 个进行中任务(日记系统功能完善) - 1 个待开始任务(等待新任务)
This commit is contained in:
81
create_initial_tasks.py
Normal file
81
create_initial_tasks.py
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""创建初始工作任务"""
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import django
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'diary_system.settings')
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'backend'))
|
||||||
|
django.setup()
|
||||||
|
|
||||||
|
from diary.models import Task
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
# 创建今天的任务
|
||||||
|
today = timezone.now().date()
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{
|
||||||
|
'title': '日记系统 - 工作任务管理功能',
|
||||||
|
'description': '实现任务跟踪系统,包括:\n- 任务模型(状态、优先级、进展)\n- API 接口(CRUD、统计、进展更新)\n- 前端展示(任务列表、进度条)',
|
||||||
|
'status': 'completed',
|
||||||
|
'priority': 'high',
|
||||||
|
'progress_percent': 100,
|
||||||
|
'progress_notes': f'[{timezone.now().strftime("%Y-%m-%d %H:%M")}] 功能已完成并部署到云服务器',
|
||||||
|
'assigned_to': '码神',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '城市手册 - 服务修复',
|
||||||
|
'description': '修复 Gunicorn 和 Nginx 配置,确保服务正常运行',
|
||||||
|
'status': 'completed',
|
||||||
|
'priority': 'high',
|
||||||
|
'progress_percent': 100,
|
||||||
|
'assigned_to': '码神',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': 'OpenClaw - 双 IP 配置',
|
||||||
|
'description': '配置服务器双 IP(10.181.143.26 + 10.181.143.185),永久生效',
|
||||||
|
'status': 'completed',
|
||||||
|
'priority': 'medium',
|
||||||
|
'progress_percent': 100,
|
||||||
|
'assigned_to': '码神',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': 'Git 仓库 - 日记系统独立',
|
||||||
|
'description': '将日记系统从城市手册仓库分离,创建独立仓库',
|
||||||
|
'status': 'completed',
|
||||||
|
'priority': 'high',
|
||||||
|
'progress_percent': 100,
|
||||||
|
'assigned_to': '码神',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '日记系统 - 功能完善',
|
||||||
|
'description': '根据使用情况优化日记系统功能',
|
||||||
|
'status': 'in_progress',
|
||||||
|
'priority': 'medium',
|
||||||
|
'progress_percent': 30,
|
||||||
|
'assigned_to': '码神',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '等待北极星分配新任务',
|
||||||
|
'description': '待命,准备接收新任务',
|
||||||
|
'status': 'pending',
|
||||||
|
'priority': 'medium',
|
||||||
|
'progress_percent': 0,
|
||||||
|
'assigned_to': '码神',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
created = 0
|
||||||
|
for task_data in tasks:
|
||||||
|
task, created_flag = Task.objects.get_or_create(
|
||||||
|
title=task_data['title'],
|
||||||
|
defaults=task_data
|
||||||
|
)
|
||||||
|
if created_flag:
|
||||||
|
created += 1
|
||||||
|
print(f"✅ 创建任务:{task.title}")
|
||||||
|
else:
|
||||||
|
print(f"⏭️ 任务已存在:{task.title}")
|
||||||
|
|
||||||
|
print(f"\n🎉 共创建 {created} 个新任务")
|
||||||
30
deploy_update.sh
Executable file
30
deploy_update.sh
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 日记系统 - 更新部署脚本(云服务器)
|
||||||
|
# 用于更新已有部署
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "======================================"
|
||||||
|
echo "⚡ 日记系统 - 更新部署"
|
||||||
|
echo "======================================"
|
||||||
|
|
||||||
|
# SSH 到云服务器执行更新
|
||||||
|
ssh ubuntu@cssc.datalibstar.com << 'EOF'
|
||||||
|
cd /home/ubuntu/diary-system
|
||||||
|
|
||||||
|
echo "📥 拉取最新代码..."
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
|
echo "🗄️ 数据库迁移..."
|
||||||
|
cd backend
|
||||||
|
python3 manage.py migrate --noinput
|
||||||
|
|
||||||
|
echo "🔄 重启服务..."
|
||||||
|
sudo systemctl restart diary-system
|
||||||
|
|
||||||
|
echo "✅ 更新完成!"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🎉 部署完成!"
|
||||||
|
echo "访问地址:http://cssc.datalibstar.com:8001/"
|
||||||
Reference in New Issue
Block a user