You've already forked opc-backend
开发了多角色登录与鉴权接口:实现了普通用户、企业和管理员的登录分流,并支持Token验证。
开发了权限控制接口:实现了通过数据库分配菜单权限节点,控制接口访问安全。 开发了实名认证中心:实现了个人身份证信息与企业营业执照的提交与审核接口。 开发了任务与协作大厅核心业务:实现了任务的发布、接单、状态流转以及专家邀约接口。 配置了全局环境变量与数据库引擎:集成了 PostgreSQL 数据库、Redis 缓存与 MinIO 对象存储。
This commit is contained in:
141
tasks/management/commands/seed_tasks.py
Normal file
141
tasks/management/commands/seed_tasks.py
Normal file
@@ -0,0 +1,141 @@
|
||||
"""Seed 10 realistic tasks for the OPC platform."""
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
from datetime import timedelta
|
||||
from tasks.models import Task, TaskStatus
|
||||
from users.models import User, Enterprise
|
||||
import random
|
||||
|
||||
|
||||
TASKS_DATA = [
|
||||
{
|
||||
"title": "企业官网全栈开发(Vue3 + Django)",
|
||||
"description": "为某科技公司打造全新的企业官方网站。前端使用 Vue 3 + Element Plus 框架,后端使用 Django REST Framework,需支持响应式布局、多语言切换以及 CMS 内容管理模块。要求有 SEO 优化方案和完善的部署文档。",
|
||||
"skill_tags": ["Vue.js", "Django", "前端开发", "全栈"],
|
||||
"budget_min": 25000, "budget_max": 45000,
|
||||
"task_type": "全栈开发",
|
||||
"deadline_days": 45,
|
||||
},
|
||||
{
|
||||
"title": "移动端 App UI/UX 设计(电商类)",
|
||||
"description": "为跨境电商平台设计一套完整的移动端 App UI/UX 方案,包括首页、商品详情、购物车、个人中心等核心页面。需要提供高保真 Figma 原型设计稿和设计规范文档,要求符合 iOS/Android 双端设计规范。",
|
||||
"skill_tags": ["UI设计", "UX设计", "Figma", "电商"],
|
||||
"budget_min": 15000, "budget_max": 30000,
|
||||
"task_type": "设计",
|
||||
"deadline_days": 30,
|
||||
},
|
||||
{
|
||||
"title": "数据分析看板开发(ECharts + Python)",
|
||||
"description": "基于已有的销售数据,开发一套实时数据分析看板,使用 ECharts 进行数据可视化呈现,后端使用 Python/Pandas 进行数据处理与聚合。需支持时间范围筛选、多维度交叉分析和 PDF 报表导出。",
|
||||
"skill_tags": ["数据分析", "Python", "ECharts", "可视化"],
|
||||
"budget_min": 18000, "budget_max": 35000,
|
||||
"task_type": "数据分析",
|
||||
"deadline_days": 25,
|
||||
},
|
||||
{
|
||||
"title": "微信小程序开发(社区团购类)",
|
||||
"description": "开发一款社区团购微信小程序,核心功能包括商品展示、拼团下单、分销推荐、订单管理和微信支付对接。后端使用云开发或已有 API 接口,需提供完整的源代码和部署文档。",
|
||||
"skill_tags": ["微信小程序", "JavaScript", "云开发"],
|
||||
"budget_min": 20000, "budget_max": 40000,
|
||||
"task_type": "移动开发",
|
||||
"deadline_days": 40,
|
||||
},
|
||||
{
|
||||
"title": "AI 智能客服系统集成",
|
||||
"description": "将大语言模型(如 DeepSeek / ChatGLM)集成到企业已有的客服系统中,实现智能工单分类、自动回复建议和知识库检索。需对接企业内部 API 和 CRM 系统,并提供模型微调方案。",
|
||||
"skill_tags": ["AI", "NLP", "Python", "API集成"],
|
||||
"budget_min": 35000, "budget_max": 60000,
|
||||
"task_type": "AI开发",
|
||||
"deadline_days": 50,
|
||||
},
|
||||
{
|
||||
"title": "品牌视觉设计(完整VI体系)",
|
||||
"description": "为创业公司提供完整的品牌视觉识别系统设计,包括 Logo、标准色、品牌字体、名片、信纸信封、品牌手册等全套 VI 设计。需提供 AI/PSD 源文件和 PDF 品牌手册。",
|
||||
"skill_tags": ["品牌设计", "VI设计", "Logo设计", "平面设计"],
|
||||
"budget_min": 12000, "budget_max": 25000,
|
||||
"task_type": "设计",
|
||||
"deadline_days": 20,
|
||||
},
|
||||
{
|
||||
"title": "自动化测试框架搭建(Web + API)",
|
||||
"description": "为已有的 SaaS 系统搭建完整的自动化测试框架,包括 Web 端 UI 自动化(Playwright/Selenium)和 API 自动化(Pytest + Requests),集成 CI/CD 流水线,输出测试报告和覆盖率统计。",
|
||||
"skill_tags": ["自动化测试", "Python", "Playwright", "CI/CD"],
|
||||
"budget_min": 16000, "budget_max": 28000,
|
||||
"task_type": "测试",
|
||||
"deadline_days": 30,
|
||||
},
|
||||
{
|
||||
"title": "短视频剪辑与运营(抖音/快手)",
|
||||
"description": "为餐饮品牌制作 20 条抖音/快手短视频内容,包括脚本撰写、实拍素材剪辑、字幕特效和 BGM 搭配。需提供周度内容日历和数据复盘报告,每条视频时长 15-60 秒。",
|
||||
"skill_tags": ["视频剪辑", "短视频运营", "内容创作"],
|
||||
"budget_min": 8000, "budget_max": 15000,
|
||||
"task_type": "内容运营",
|
||||
"deadline_days": 30,
|
||||
},
|
||||
{
|
||||
"title": "企业内部管理系统二次开发",
|
||||
"description": "基于现有的 Django Admin 管理后台进行二次开发,增加审批流引擎、消息通知模块、权限动态配置和数据导出功能。需配合前端 Vue 改造部分页面,提高运营效率。",
|
||||
"skill_tags": ["Django", "Vue.js", "后端开发", "系统集成"],
|
||||
"budget_min": 22000, "budget_max": 38000,
|
||||
"task_type": "后端开发",
|
||||
"deadline_days": 35,
|
||||
},
|
||||
{
|
||||
"title": "跨境电商数据爬取与分析",
|
||||
"description": "对 Amazon、eBay 等跨境电商平台的商品数据进行采集(Scrapy/Selenium),建立竞品价格监控和市场趋势分析模型。需要提供每日自动采集脚本和可视化分析 Dashboard。",
|
||||
"skill_tags": ["爬虫", "数据分析", "Python", "Scrapy"],
|
||||
"budget_min": 10000, "budget_max": 20000,
|
||||
"task_type": "数据采集",
|
||||
"deadline_days": 20,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Seed 10 realistic tasks for the OPC platform'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
# Find a publisher: prefer admin/staff user
|
||||
publisher = User.objects.filter(is_staff=True, is_deleted=False).first()
|
||||
if not publisher:
|
||||
publisher = User.objects.filter(is_deleted=False).first()
|
||||
if not publisher:
|
||||
self.stderr.write('No users found. Please create at least one user first.')
|
||||
return
|
||||
|
||||
# Find an enterprise if available
|
||||
enterprise = Enterprise.objects.filter(is_deleted=False, status='VERIFIED').first()
|
||||
|
||||
created = 0
|
||||
for data in TASKS_DATA:
|
||||
deadline = timezone.now().date() + timedelta(days=data.pop('deadline_days'))
|
||||
task, was_created = Task.objects.get_or_create(
|
||||
title=data['title'],
|
||||
defaults={
|
||||
'publisher': publisher,
|
||||
'enterprise': enterprise,
|
||||
'description': data['description'],
|
||||
'skill_tags': data['skill_tags'],
|
||||
'budget_min': data['budget_min'],
|
||||
'budget_max': data['budget_max'],
|
||||
'task_type': data['task_type'],
|
||||
'deadline': deadline,
|
||||
'status': TaskStatus.OPEN,
|
||||
'contact_name': publisher.nickname or publisher.username,
|
||||
'contact_email': publisher.email,
|
||||
}
|
||||
)
|
||||
if was_created:
|
||||
created += 1
|
||||
self.stdout.write(f' ✓ Created: {task.title}')
|
||||
else:
|
||||
self.stdout.write(f' - Exists: {task.title}')
|
||||
|
||||
# Mark 3 random tasks as recommended
|
||||
recommended = Task.objects.filter(status=TaskStatus.OPEN, is_recommended=False).order_by('?')[:3]
|
||||
for i, t in enumerate(recommended):
|
||||
t.is_recommended = True
|
||||
t.recommend_priority = 10 - i
|
||||
t.save(update_fields=['is_recommended', 'recommend_priority'])
|
||||
|
||||
self.stdout.write(self.style.SUCCESS(f'\n✅ Seeded {created} new tasks, marked {len(recommended)} as recommended.'))
|
||||
Reference in New Issue
Block a user