feat: 公告按页、身份标签、拼多多订单号、派单与抢单改造
This commit is contained in:
34
config/migrations/0008_gonggao_page_key.py
Normal file
34
config/migrations/0008_gonggao_page_key.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def backfill_gonggao_page_key(apps, schema_editor):
|
||||
Gonggao = apps.get_model('config', 'Gonggao')
|
||||
for row in Gonggao.objects.filter(page_key='').only('id'):
|
||||
row.page_key = 'order_pool'
|
||||
row.save(update_fields=['page_key'])
|
||||
for row in Gonggao.objects.filter(page_key__isnull=True).only('id'):
|
||||
row.page_key = 'order_pool'
|
||||
row.save(update_fields=['page_key'])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('config', '0007_platform_income_log'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='gonggao',
|
||||
name='page_key',
|
||||
field=models.CharField(
|
||||
db_index=True, default='order_pool', max_length=32,
|
||||
verbose_name='页面标识(order_pool/accept_order/merchant_home)',
|
||||
),
|
||||
),
|
||||
migrations.RunPython(backfill_gonggao_page_key, migrations.RunPython.noop),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='gonggao',
|
||||
unique_together={('club_id', 'page_key')},
|
||||
),
|
||||
]
|
||||
@@ -24,15 +24,20 @@ class Lunbo(QModel):
|
||||
|
||||
class Gonggao(QModel):
|
||||
club_id = models.CharField(max_length=16, default='xq', db_index=True, verbose_name='俱乐部ID')
|
||||
page_key = models.CharField(
|
||||
max_length=32, default='order_pool', db_index=True,
|
||||
verbose_name='页面标识(order_pool/accept_order/merchant_home)',
|
||||
)
|
||||
NoticeType = models.IntegerField(null=True, blank=True, verbose_name='公告类型')
|
||||
CreateTime = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
|
||||
UpdateTime = models.DateTimeField(auto_now=True, verbose_name='更改时间')
|
||||
Content = models.TextField(null=True, blank=True, verbose_name='公告介绍')
|
||||
|
||||
class Meta:
|
||||
db_table = 'gonggao'
|
||||
verbose_name = '公告'
|
||||
verbose_name_plural = '公告'
|
||||
# 不要索引!数据量太小
|
||||
unique_together = [['club_id', 'page_key']]
|
||||
|
||||
class Qunpeizhi(QModel):
|
||||
GroupType = models.IntegerField(null=True, blank=True, verbose_name='群类型:1.打手 2.管事')
|
||||
|
||||
@@ -138,7 +138,7 @@ class ShangpinGonggaoView(APIView):
|
||||
from jituan.services.display_config import get_gonggao_content, get_lunbo_urls, normalize_page_key
|
||||
|
||||
page_key = normalize_page_key(request.data.get('page_key'), image_type=1)
|
||||
gonggao_content = get_gonggao_content(request, notice_type=1)
|
||||
gonggao_content = get_gonggao_content(request, notice_type=1, page_key=page_key)
|
||||
lunbo_urls = get_lunbo_urls(request, page_key=page_key, image_type=1)
|
||||
response_data = {
|
||||
"shangpingonggao": gonggao_content,
|
||||
|
||||
Reference in New Issue
Block a user