add admin/live/anchor/detail

FFIB 5 lat temu
rodzic
commit
1c58122ac3
2 zmienionych plików z 25 dodań i 0 usunięć
  1. 2 0
      api/urls.py
  2. 23 0
      live/views.py

+ 2 - 0
api/urls.py

@@ -55,6 +55,8 @@ urlpatterns += [
55 55
     url(r'^admin/live/order/list$', admin_views.live_order_list, name='live_order_list'),   # 直播间订单列表
56 56
     url(r'^admin/live/order/delivery$', admin_views.live_order_delivery, name='live_order_delivery'),   # 直播间订单发货
57 57
 
58
+    url(r'^admin/live/anchor/detail$', admin_views.anchor_detail, name='anchor_detail'),   # 微信直播间列表
59
+
58 60
     #微信直播 api
59 61
     url(r'^admin/live/wx/room/list$', admin_views.fetch_wx_room_list, name='fetch_wx_room_list'),   # 微信直播间列表
60 62
 ]

+ 23 - 0
live/views.py

@@ -19,6 +19,29 @@ from utils.error.errno_utils import OrderStatusCode, UserStatusCode
19 19
 
20 20
 WECHAT = settings.WECHAT
21 21
 
22
+def anchor_detail(request):
23
+    anchor_id = get_query_value(request, 'anchor_id', '')
24
+
25
+    try:
26
+        anchor = AnchorInfo.objects.get(anchor_id=anchor_id)
27
+    except:
28
+        return response()
29
+    
30
+    rooms = RoomInfo.objects.filter(anchor_id=anchor_id)
31
+    rooms = [room.anchorData for room in rooms]
32
+    
33
+    return response(200, 'Get Room Anchor Details Success', '获取主播详情成功', data={
34
+        'anchor': {
35
+            'anchor_id': anchor.anchor_id,
36
+            'anchor_name': anchor.anchor_name,
37
+            'anchor_avatar': anchor.anchor_avatar_url,
38
+            'anchor_intro': anchor.anchor_intro,
39
+            'banner': anchor.banner_url,
40
+        },
41
+        'rooms': rooms
42
+    })
43
+
44
+
22 45
 def room_goods_detail(request):
23 46
   goods_id = get_query_value(request, 'goods_id', '')
24 47
   room_id = get_query_value(request, 'room_id', '')