修复配置名重复添加失败问题

dependabot/npm_and_yarn/fir_admin/async-2.6.4
nineven 3 years ago
parent 2bfd694f23
commit d7e3186f9d
  1. 2
      fir_client/vue.config.js
  2. 9
      fir_ser/api/migrations/0004_auto_20220330_0009.py
  3. 7
      fir_ser/api/models.py

@ -82,7 +82,7 @@ if (page) {
} }
} }
const version='2.2.6'; const version='2.2.8';
const pro_base_env = { const pro_base_env = {
baseUrl: 'https://flyapps.cn', baseUrl: 'https://flyapps.cn',

@ -1,4 +1,4 @@
# Generated by Django 3.2.3 on 2022-03-29 17:36 # Generated by Django 3.2.3 on 2022-03-30 00:09
import django.db.models.deletion import django.db.models.deletion
from django.conf import settings from django.conf import settings
@ -61,7 +61,7 @@ class Migration(migrations.Migration):
name='NotifyReceiver', name='NotifyReceiver',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('receiver_name', models.CharField(max_length=128, unique=True, verbose_name='姓名')), ('receiver_name', models.CharField(max_length=128, verbose_name='姓名')),
('email', models.EmailField(blank=True, max_length=255, null=True, verbose_name='邮箱')), ('email', models.EmailField(blank=True, max_length=255, null=True, verbose_name='邮箱')),
('description', models.CharField(blank=True, default='', max_length=256, verbose_name='备注')), ('description', models.CharField(blank=True, default='', max_length=256, verbose_name='备注')),
('create_time', models.DateTimeField(auto_now_add=True, verbose_name='添加时间')), ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='添加时间')),
@ -74,14 +74,14 @@ class Migration(migrations.Migration):
options={ options={
'verbose_name': '信息接收配置', 'verbose_name': '信息接收配置',
'verbose_name_plural': '信息接收配置', 'verbose_name_plural': '信息接收配置',
'unique_together': {('user_id', 'email'), ('user_id', 'weixin')}, 'unique_together': {('user_id', 'email'), ('user_id', 'weixin'), ('user_id', 'receiver_name')},
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='NotifyConfig', name='NotifyConfig',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('config_name', models.CharField(max_length=128, unique=True, verbose_name='通知名称')), ('config_name', models.CharField(max_length=128, verbose_name='通知名称')),
('message_type', models.SmallIntegerField( ('message_type', models.SmallIntegerField(
choices=[(0, '签名余额不足'), (1, '下载次数不足'), (2, '应用签名限额'), (3, '应用签名失败'), (4, '充值到账提醒'), (5, '优惠活动通知'), choices=[(0, '签名余额不足'), (1, '下载次数不足'), (2, '应用签名限额'), (3, '应用签名失败'), (4, '充值到账提醒'), (5, '优惠活动通知'),
(6, '证书到期消息'), (7, '系统提醒')], default=5, verbose_name='消息类型')), (6, '证书到期消息'), (7, '系统提醒')], default=5, verbose_name='消息类型')),
@ -96,6 +96,7 @@ class Migration(migrations.Migration):
options={ options={
'verbose_name': '信息接收配置', 'verbose_name': '信息接收配置',
'verbose_name_plural': '信息接收配置', 'verbose_name_plural': '信息接收配置',
'unique_together': {('user_id', 'config_name')},
}, },
), ),
] ]

@ -493,7 +493,7 @@ class SystemConfig(models.Model):
class NotifyReceiver(models.Model): class NotifyReceiver(models.Model):
receiver_name = models.CharField(max_length=128, unique=True, verbose_name="姓名") receiver_name = models.CharField(max_length=128, verbose_name="姓名")
user_id = models.ForeignKey(to=UserInfo, verbose_name="用户ID", on_delete=models.CASCADE) user_id = models.ForeignKey(to=UserInfo, verbose_name="用户ID", on_delete=models.CASCADE)
weixin = models.ForeignKey(to=ThirdWeChatUserInfo, verbose_name="微信ID", on_delete=models.CASCADE, null=True) weixin = models.ForeignKey(to=ThirdWeChatUserInfo, verbose_name="微信ID", on_delete=models.CASCADE, null=True)
email = models.EmailField(verbose_name='邮箱', max_length=255, blank=True, null=True) email = models.EmailField(verbose_name='邮箱', max_length=255, blank=True, null=True)
@ -503,7 +503,7 @@ class NotifyReceiver(models.Model):
class Meta: class Meta:
verbose_name = '信息接收配置' verbose_name = '信息接收配置'
verbose_name_plural = "信息接收配置" verbose_name_plural = "信息接收配置"
unique_together = (('user_id', 'email',), ('user_id', 'weixin')) unique_together = (('user_id', 'email',), ('user_id', 'weixin'), ('user_id', 'receiver_name'))
def __str__(self): def __str__(self):
return "%s-%s-%s" % (self.user_id, self.receiver_name, self.description) return "%s-%s-%s" % (self.user_id, self.receiver_name, self.description)
@ -511,7 +511,7 @@ class NotifyReceiver(models.Model):
class NotifyConfig(models.Model): class NotifyConfig(models.Model):
user_id = models.ForeignKey(to=UserInfo, verbose_name="用户ID", on_delete=models.CASCADE) user_id = models.ForeignKey(to=UserInfo, verbose_name="用户ID", on_delete=models.CASCADE)
config_name = models.CharField(max_length=128, unique=True, verbose_name="通知名称") config_name = models.CharField(max_length=128, verbose_name="通知名称")
message_type_choices = ( message_type_choices = (
(0, '签名余额不足'), (1, '下载次数不足'), (2, '应用签名限额'), (3, '应用签名失败'), (0, '签名余额不足'), (1, '下载次数不足'), (2, '应用签名限额'), (3, '应用签名失败'),
(4, '充值到账提醒'), (5, '优惠活动通知'), (6, '证书到期消息'), (7, '系统提醒')) (4, '充值到账提醒'), (5, '优惠活动通知'), (6, '证书到期消息'), (7, '系统提醒'))
@ -525,6 +525,7 @@ class NotifyConfig(models.Model):
class Meta: class Meta:
verbose_name = '信息接收配置' verbose_name = '信息接收配置'
verbose_name_plural = "信息接收配置" verbose_name_plural = "信息接收配置"
unique_together = (('user_id', 'config_name',),)
def __str__(self): def __str__(self):
return "%s-%s-%s" % (self.user_id, self.get_message_type_display(), self.sender) return "%s-%s-%s" % (self.user_id, self.get_message_type_display(), self.sender)

Loading…
Cancel
Save