瀏覽代碼

修改时光相册、时光日记表

linhaohong 4 月之前
父節點
當前提交
38bdc54da4
共有 1 個文件被更改,包括 20 次插入22 次删除
  1. 20 22
      Roomumy/models.py

+ 20 - 22
Roomumy/models.py

@@ -74,8 +74,6 @@ class AlbumTitle(models.Model):
 class TimeAlbum(models.Model):
 class TimeAlbum(models.Model):
     id = models.AutoField(primary_key=True)
     id = models.AutoField(primary_key=True)
     device_id = models.CharField(default='', max_length=32, verbose_name='关联设备',  db_index=True)
     device_id = models.CharField(default='', max_length=32, verbose_name='关联设备',  db_index=True)
-    serial_no = models.CharField(default='', max_length=32, verbose_name='关联序列号',  db_index=True)
-    user_id = models.CharField(default='', max_length=32, verbose_name='关联用户id', db_index=True)
     album_date = models.IntegerField(default=0, verbose_name='相册日期', db_index=True)
     album_date = models.IntegerField(default=0, verbose_name='相册日期', db_index=True)
     album_title = models.TextField(default=0, verbose_name='相册标题')
     album_title = models.TextField(default=0, verbose_name='相册标题')
     created_time = models.IntegerField(default=0, verbose_name='创建时间')
     created_time = models.IntegerField(default=0, verbose_name='创建时间')
@@ -88,38 +86,38 @@ class TimeAlbum(models.Model):
         app_label = 'Roomumy'
         app_label = 'Roomumy'
 
 
 
 
-class TimeDiary(models.Model):
+class AlbumMedia(models.Model):
     id = models.AutoField(primary_key=True)
     id = models.AutoField(primary_key=True)
-    user_id = models.CharField(default='', max_length=32, verbose_name='关联用户id', db_index=True)
-    # 0 不喜欢 1 喜欢
-    liked_status = models.IntegerField(default=0, verbose_name='喜欢状态')
+    time_album_id = models.IntegerField(default=0, verbose_name=u'时光相册表id', db_index=True)
+    # 这三个字段组成存储桶的访问链接
+    device_id = models.CharField(default='', max_length=32, verbose_name='关联设备', db_index=True)
+    channel = models.IntegerField(default=1, verbose_name='通道')
+    event_time = models.IntegerField(default=0, verbose_name='事件时间')
+    # 0表示隐藏 1表示显示 2表示被添加为日记
+    status = models.SmallIntegerField(default=1, verbose_name='状态')
+    # 1: 阿里云, 2: AWS, 3: oci美国凤凰城, 4: oci英国伦敦, 5: 华为云
+    storage_location = models.SmallIntegerField(default=0, verbose_name='存储位置')
+    created_time = models.IntegerField(default=0, verbose_name='创建时间')
+    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
 
 
     class Meta:
     class Meta:
-        db_table = "time_diary"
-        verbose_name = "用户时光日记表"
+        db_table = "album_media"
+        verbose_name = "相册媒体表"
         verbose_name_plural = verbose_name
         verbose_name_plural = verbose_name
         app_label = 'Roomumy'
         app_label = 'Roomumy'
 
 
 
 
-class AlbumMedia(models.Model):
+class TimeDiary(models.Model):
     id = models.AutoField(primary_key=True)
     id = models.AutoField(primary_key=True)
-    time_album_id = models.IntegerField(default=0, verbose_name=u'时光相册表id', db_index=True)
-    time_diary = models.ForeignKey(TimeDiary, to_field='id', on_delete=models.CASCADE, default=None,
-                                   verbose_name='关联时光日记表', db_constraint=False, null=True)
-    baby_id = models.IntegerField(default=0, verbose_name='关联宝宝id')
-    image = models.CharField(max_length=255, default='', verbose_name='图片地址')
-    video = models.CharField(max_length=255, default='', verbose_name='视频地址')
-    thumbnail = models.CharField(max_length=255, default='', verbose_name='缩略图')
-    # 1表示显示 2表示被添加为日记
-    status = models.SmallIntegerField(default=0, verbose_name='状态')
-    # 1: 阿里云, 2: AWS, 3: oci美国凤凰城, 4: oci英国伦敦, 5: 华为云
-    storage_location = models.SmallIntegerField(default=0, verbose_name='存储位置')
+    user_id = models.CharField(default='', max_length=32, verbose_name='关联用户id', db_index=True)
+    album_media = models.ForeignKey(AlbumMedia, to_field='id', on_delete=models.CASCADE, default=None,
+                                   verbose_name='相册媒体表', db_constraint=False, null=True)
     created_time = models.IntegerField(default=0, verbose_name='创建时间')
     created_time = models.IntegerField(default=0, verbose_name='创建时间')
     updated_time = models.IntegerField(default=0, verbose_name='更新时间')
     updated_time = models.IntegerField(default=0, verbose_name='更新时间')
 
 
     class Meta:
     class Meta:
-        db_table = "album_media"
-        verbose_name = "相册媒体表"
+        db_table = "time_diary"
+        verbose_name = "用户时光日记表"
         verbose_name_plural = verbose_name
         verbose_name_plural = verbose_name
         app_label = 'Roomumy'
         app_label = 'Roomumy'