@@ -28,6 +28,7 @@ urlpatterns += [ |
||
| 28 | 28 |
url(r'^live/order/create$', live_views.live_order_create, name='live_order_create'), |
| 29 | 29 |
url(r'^live/order/cancel$', live_views.live_order_cancel, name='live_order_cancel'), |
| 30 | 30 |
url(r'^live/pay/notify_url$', live_views.notify_url_api, name='notify_url_api'), |
| 31 |
+ url(r'^live/room/anchor/detail$', live_views.room_anchor_details, name='room_anchor_details'), |
|
| 31 | 32 |
] |
| 32 | 33 |
|
| 33 | 34 |
urlpatterns += [ |
@@ -0,0 +1,19 @@ |
||
| 1 |
+# Generated by Django 2.2.12 on 2020-05-19 02:41 |
|
| 2 |
+ |
|
| 3 |
+from django.db import migrations, models |
|
| 4 |
+import django_models_ext.fileext |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+class Migration(migrations.Migration): |
|
| 8 |
+ |
|
| 9 |
+ dependencies = [ |
|
| 10 |
+ ('live', '0004_auto_20200518_2323'),
|
|
| 11 |
+ ] |
|
| 12 |
+ |
|
| 13 |
+ operations = [ |
|
| 14 |
+ migrations.AddField( |
|
| 15 |
+ model_name='anchorinfo', |
|
| 16 |
+ name='banner', |
|
| 17 |
+ field=models.ImageField(blank=True, help_text='主播 Banner图', upload_to=django_models_ext.fileext.upload_path, verbose_name='banner'), |
|
| 18 |
+ ), |
|
| 19 |
+ ] |
@@ -14,6 +14,7 @@ class AnchorInfo(BaseModelMixin): |
||
| 14 | 14 |
unionid = models.CharField(_('unionid'), max_length=32, blank=True, help_text='微信 Unionid', unique=True)
|
| 15 | 15 |
openid = models.CharField(_('openid'), max_length=32, blank=True, help_text='微信 Openid', unique=True)
|
| 16 | 16 |
# 真实相关 |
| 17 |
+ banner = models.ImageField(_('banner'), upload_to=upload_path, blank=True, help_text='主播 Banner图')
|
|
| 17 | 18 |
anchor_name = models.CharField(_('anchor_name'), max_length=255, blank=True, help_text='主播姓名', db_index=True)
|
| 18 | 19 |
anchor_avatar = models.ImageField(_('anchor_avatar'), upload_to=upload_path, help_text='主播头像')
|
| 19 | 20 |
anchor_intro = RichTextField(_('anchor_intro'), blank=True, help_text='主播介绍')
|
@@ -32,6 +33,13 @@ class AnchorInfo(BaseModelMixin): |
||
| 32 | 33 |
@property |
| 33 | 34 |
def anchor_avatar_url(self): |
| 34 | 35 |
return upload_file_url(self.anchor_avatar) |
| 36 |
+ @property |
|
| 37 |
+ def banner_path(self): |
|
| 38 |
+ return upload_file_path(self.banner) |
|
| 39 |
+ |
|
| 40 |
+ @property |
|
| 41 |
+ def banner_url(self): |
|
| 42 |
+ return upload_file_url(self.banner) |
|
| 35 | 43 |
|
| 36 | 44 |
|
| 37 | 45 |
class RoomInfo(BaseModelMixin): |
@@ -61,7 +61,7 @@ def room_anchor_details(request): |
||
| 61 | 61 |
except: |
| 62 | 62 |
return response() |
| 63 | 63 |
|
| 64 |
- rooms = RoomInfo.objects.get(anchor_id=anchor_id) |
|
| 64 |
+ rooms = RoomInfo.objects.filter(anchor_id=room.anchor_id) |
|
| 65 | 65 |
rooms = [room.anchorData for room in rooms] |
| 66 | 66 |
|
| 67 | 67 |
return response(200, 'Get Room Anchor Details Success', '获取主播详情成功', data={
|
@@ -69,7 +69,8 @@ def room_anchor_details(request): |
||
| 69 | 69 |
'anchor_id': anchor.anchor_id, |
| 70 | 70 |
'anchor_name': anchor.anchor_name, |
| 71 | 71 |
'anchor_avatar': anchor.anchor_avatar_url, |
| 72 |
- 'anchor_intro': anchor.anchor_intro |
|
| 72 |
+ 'anchor_intro': anchor.anchor_intro, |
|
| 73 |
+ 'banner': anchor.banner_url, |
|
| 73 | 74 |
}, |
| 74 | 75 |
'rooms': rooms |
| 75 | 76 |
}) |