Add gather_screenshot for api tg_group_gather_start_api

Brightcells vor 8 Jahren
Ursprung
Commit
e8cd9652b7
3 geänderte Dateien mit 28 neuen Zeilen und 0 gelöschten Zeilen
  1. 19 0
      group/migrations/0032_groupinfo_gather_screenshot.py
  2. 6 0
      group/models.py
  3. 3 0
      group/tourguidegroup_views.py

+ 19 - 0
group/migrations/0032_groupinfo_gather_screenshot.py

@@ -0,0 +1,19 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.db import models, migrations
5
+
6
+
7
+class Migration(migrations.Migration):
8
+
9
+    dependencies = [
10
+        ('group', '0031_groupphotoinfo_photo_md5'),
11
+    ]
12
+
13
+    operations = [
14
+        migrations.AddField(
15
+            model_name='groupinfo',
16
+            name='gather_screenshot',
17
+            field=models.CharField(help_text='\u65c5\u6e38\u56e2\u96c6\u5408\u5730\u70b9\u622a\u56fe', max_length=255, null=True, verbose_name='gather_screenshot', blank=True),
18
+        ),
19
+    ]

+ 6 - 0
group/models.py

@@ -43,6 +43,7 @@ class GroupInfo(CreateUpdateMixin):
43 43
     gather_lon = models.FloatField(_(u'gather_lon'), blank=True, null=True, help_text=_(u'旅游团集合经度'))
44 44
     gather_lat = models.FloatField(_(u'gather_lat'), blank=True, null=True, help_text=_(u'旅游团集合纬度'))
45 45
     gather_location = models.CharField(_(u'gather_location'), max_length=255, blank=True, null=True, help_text=u'旅游团集合地点')
46
+    gather_screenshot = models.CharField(_(u'gather_screenshot'), max_length=255, blank=True, null=True, help_text=u'旅游团集合地点截图')
46 47
 
47 48
     attentions_path = models.CharField(_(u'attentions_path'), max_length=255, blank=True, null=True, help_text=u'注意事项照片存放路径')
48 49
     schedules_path = models.CharField(_(u'schedules_path'), max_length=255, blank=True, null=True, help_text=u'行程安排照片存放路径')
@@ -67,6 +68,10 @@ class GroupInfo(CreateUpdateMixin):
67 68
         return img_url(self.schedules_path)
68 69
 
69 70
     @property
71
+    def gather_screenshot_url(self):
72
+        return img_url(self.gather_screenshot)
73
+
74
+    @property
70 75
     def group_photo_num(self):
71 76
         return GroupPhotoInfo.objects.filter(group_id=self.group_id, status=True).count()
72 77
 
@@ -92,6 +97,7 @@ class GroupInfo(CreateUpdateMixin):
92 97
             'gather_lon': self.gather_lon,
93 98
             'gather_lat': self.gather_lat,
94 99
             'gather_location': self.gather_location,
100
+            'gather_screenshot': self.gather_screenshot_url,
95 101
             'created_at': tc.remove_microsecond(self.created_at),
96 102
             'banners': {
97 103
                 'attentions': self.group_attentions_url,

+ 3 - 0
group/tourguidegroup_views.py

@@ -251,6 +251,7 @@ def tg_group_gather_start_api(request):
251 251
     gather_lon = request.POST.get('lon', '')  # 经度
252 252
     gather_lat = request.POST.get('lat', '')  # 纬度
253 253
     gather_location = request.POST.get('gather_location', '')  # 地点
254
+    gather_screenshot = request.FILES.get('gather_screenshot', '')
254 255
 
255 256
     # 群组校验
256 257
     try:
@@ -267,6 +268,8 @@ def tg_group_gather_start_api(request):
267 268
     group.gather_lon = gather_lon
268 269
     group.gather_lat = gather_lat
269 270
     group.gather_location = gather_location
271
+    if gather_screenshot:
272
+        group.gather_screenshot = file_save(gather_screenshot, prefix='tour', ext='jpeg').photo_path
270 273
     group.save()
271 274
 
272 275
     # Redis 群组数据缓存更新