40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
from django.db import models
|
||
from django.db.models import JSONField # 用于存储动态谈判条款
|
||
from django.utils import timezone # Import timezone for timestamping
|
||
from apps.daren_detail.models import CreatorProfile # 导入CreatorProfile模型
|
||
from apps.brands.models import Product # 导入Product模型
|
||
|
||
|
||
# Create your models here.
|
||
|
||
class Negotiation(models.Model):
|
||
STATUS_CHOICES = [
|
||
('brand_review', '品牌回顾'),
|
||
('price_negotiation', '价格谈判'),
|
||
('contract_review', '合同确认'),
|
||
('draft_ready', '准备合同'),
|
||
('draft_approved', '合同提交'),
|
||
('accepted', '已接受'),
|
||
('abandoned', '已放弃'),
|
||
]
|
||
|
||
creator = models.ForeignKey(CreatorProfile, on_delete=models.CASCADE)
|
||
product = models.ForeignKey(Product, on_delete=models.CASCADE)
|
||
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='price_negotiation')
|
||
current_round = models.IntegerField(default=1) # 当前谈判轮次
|
||
context = models.JSONField(default=dict) # 存储谈判上下文(如当前报价)
|
||
|
||
|
||
class Message(models.Model):
|
||
negotiation = models.ForeignKey(Negotiation, on_delete=models.CASCADE)
|
||
role = models.CharField(max_length=10) # user/assistant
|
||
content = models.TextField()
|
||
created_at = models.DateTimeField(auto_now_add=True)
|
||
stage = models.CharField(
|
||
max_length=32,
|
||
choices=Negotiation.STATUS_CHOICES,
|
||
default='brand_review' # 或你想要的其他默认阶段
|
||
)
|
||
|
||
# 我们可以在这里添加额外的模型或关系,但现在使用user_management中的现有模型
|