chore: launch_time 默认值

This commit is contained in:
fxxian 2024-04-23 15:40:52 +08:00
parent c85309b116
commit b06b482e1a
4 changed files with 45 additions and 1 deletions

View File

@ -218,6 +218,8 @@ class DeviceRemoteViewSet(mixins.ListModelMixin,
message = {'count': 0} message = {'count': 0}
elif command == 'mosqClean': elif command == 'mosqClean':
message = {'MosqDeviceClean': speed} message = {'MosqDeviceClean': speed}
elif command == 'addCount':
message = {'count': 10}
else: else:
return Response({'error': 'Invalid command'}, status=400) return Response({'error': 'Invalid command'}, status=400)

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2024-04-23 07:30
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mosquito', '0033_deviceinfo_chip_type'),
]
operations = [
migrations.AlterField(
model_name='deviceinfo',
name='launch_time',
field=models.DateTimeField(default=datetime.datetime(2023, 1, 11, 0, 0), verbose_name='第一次启动时间'),
),
]

View File

@ -0,0 +1,20 @@
# Generated by Django 2.2.4 on 2024-04-23 07:36
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('mosquito', '0034_auto_20240423_1530'),
]
operations = [
migrations.AlterField(
model_name='deviceinfo',
name='launch_time',
field=models.DateTimeField(default=datetime.datetime(2023, 1, 11, 0, 0, tzinfo=utc), verbose_name='第一次启动时间'),
),
]

View File

@ -1,4 +1,6 @@
import pytz
from django.db import models from django.db import models
from django.utils import timezone
from smart.models import SmartModule, SmartPush from smart.models import SmartModule, SmartPush
@ -83,7 +85,8 @@ class DeviceInfo(models.Model):
latitude = models.FloatField(blank=True, null=True, verbose_name='维度') latitude = models.FloatField(blank=True, null=True, verbose_name='维度')
location = models.CharField(max_length=100, blank=True, null=True, verbose_name='地理位置') location = models.CharField(max_length=100, blank=True, null=True, verbose_name='地理位置')
led_lifetime = models.PositiveIntegerField(default=30000, verbose_name='LED 寿命') led_lifetime = models.PositiveIntegerField(default=30000, verbose_name='LED 寿命')
launch_time = models.DateTimeField(blank=True, null=True, verbose_name='第一次启动时间') launch_time = models.DateTimeField(default=timezone.datetime(2023, 1, 11, tzinfo=timezone.utc),
verbose_name='第一次启动时间')
last_connect = models.DateTimeField(blank=True, null=True, verbose_name='最近连接时间') last_connect = models.DateTimeField(blank=True, null=True, verbose_name='最近连接时间')
# mqtt 数据 # mqtt 数据