Files
along_django/peizhi/migrations/0015_huashuconfig.py

154 lines
6.3 KiB
Python

# Generated manually for HuashuConfig
from django.db import migrations, models
def seed_huashu_defaults(apps, schema_editor):
HuashuConfig = apps.get_model('peizhi', 'HuashuConfig')
defaults = [
{
'scene_key': 'chat_image_confirm',
'item_type': 'confirm_modal',
'title': '温馨提示',
'content': (
'平台禁止任何违法违规行为,聊天内容仅限于商家与接单员正常业务对接。'
'严禁赌博、诈骗及其他非法行为,违者后果自负。'
),
'confirm_text': '我已知晓,继续发送',
'cancel_text': '取消',
'keywords': [],
'match_mode': 'contains',
'priority': 0,
'is_active': True,
'sort_order': 0,
},
{
'scene_key': 'cs_welcome',
'item_type': 'text_display',
'title': '',
'content': '你好,请问有什么可以帮到您的?',
'confirm_text': '我知道了',
'cancel_text': '取消',
'keywords': [],
'match_mode': 'contains',
'priority': 0,
'is_active': True,
'sort_order': 0,
},
{
'scene_key': 'merchant_dispatch_confirm',
'item_type': 'confirm_modal',
'title': '派单确认',
'content': (
'请确认订单信息无误。派单成功后将扣除相应余额,'
'请确保订单描述合法合规,仅限正常业务对接。'
),
'confirm_text': '确认派单',
'cancel_text': '取消',
'keywords': [],
'match_mode': 'contains',
'priority': 0,
'is_active': True,
'sort_order': 0,
},
{
'scene_key': 'cs_auto_reply',
'item_type': 'auto_reply',
'title': '',
'content': '退款相关问题,请提供订单号,客服将尽快为您处理。',
'confirm_text': '我知道了',
'cancel_text': '取消',
'keywords': ['退款', '怎么退', '退钱'],
'match_mode': 'contains',
'priority': 10,
'is_active': True,
'sort_order': 0,
},
{
'scene_key': 'cs_auto_reply',
'item_type': 'auto_reply',
'title': '',
'content': '提现相关问题,请前往【我的-提现】查看规则,或留下您的具体问题。',
'confirm_text': '我知道了',
'cancel_text': '取消',
'keywords': ['提现', '取钱', '到账'],
'match_mode': 'contains',
'priority': 9,
'is_active': True,
'sort_order': 1,
},
{
'scene_key': 'cs_auto_reply',
'item_type': 'auto_reply',
'title': '',
'content': '您好,客服正在为您服务,请稍候,我们会尽快回复您。',
'confirm_text': '我知道了',
'cancel_text': '取消',
'keywords': ['你好', '在吗', '有人吗'],
'match_mode': 'contains',
'priority': 5,
'is_active': True,
'sort_order': 2,
},
]
for row in defaults:
HuashuConfig.objects.create(**row)
class Migration(migrations.Migration):
dependencies = [
('peizhi', '0014_alter_tixianquotadefault_leixing'),
]
operations = [
migrations.CreateModel(
name='HuashuConfig',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('scene_key', models.CharField(
choices=[
('chat_image_confirm', '聊天发图确认'),
('cs_welcome', '客服欢迎语'),
('cs_auto_reply', '客服自动回复'),
('merchant_dispatch_confirm', '商家派单确认'),
],
db_index=True,
max_length=50,
verbose_name='场景标识',
)),
('item_type', models.CharField(
choices=[
('confirm_modal', '确认弹窗'),
('text_display', '纯文本展示'),
('auto_reply', '自动回复'),
],
max_length=20,
verbose_name='条目类型',
)),
('title', models.CharField(blank=True, default='', max_length=200, verbose_name='标题')),
('content', models.TextField(verbose_name='正文内容')),
('confirm_text', models.CharField(blank=True, default='我知道了', max_length=50, verbose_name='确认按钮文案')),
('cancel_text', models.CharField(blank=True, default='取消', max_length=50, verbose_name='取消按钮文案')),
('keywords', models.JSONField(blank=True, default=list, verbose_name='触发关键词(JSON数组)')),
('match_mode', models.CharField(
choices=[('contains', '包含匹配'), ('exact', '精确匹配')],
default='contains',
max_length=20,
verbose_name='匹配模式',
)),
('priority', models.IntegerField(default=0, verbose_name='优先级(越大越先匹配)')),
('is_active', models.BooleanField(default=True, verbose_name='是否启用')),
('sort_order', models.IntegerField(default=0, verbose_name='排序')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
],
options={
'verbose_name': '话术配置',
'verbose_name_plural': '话术配置',
'db_table': 'huashu_config',
'ordering': ['scene_key', '-priority', 'sort_order', 'id'],
},
),
migrations.RunPython(seed_huashu_defaults, migrations.RunPython.noop),
]