1
|
'use strict';
|
1
|
'use strict';
|
2
|
-const api = global.yoho.ServiceAPI;
|
2
|
+const service = global.yoho.ServiceAPI;
|
|
|
3
|
+const api = global.yoho.LiveAPI;
|
3
|
const contentCodeConfig = require('../../../config/content-code');
|
4
|
const contentCodeConfig = require('../../../config/content-code');
|
4
|
const resourcesProcess = require(`${global.utils}/resources-process`);
|
5
|
const resourcesProcess = require(`${global.utils}/resources-process`);
|
5
|
|
6
|
|
|
@@ -18,13 +19,25 @@ const _formatTime = (a, b) => { |
|
@@ -18,13 +19,25 @@ const _formatTime = (a, b) => { |
18
|
status = b ? '预告' : '今天';
|
19
|
status = b ? '预告' : '今天';
|
19
|
}
|
20
|
}
|
20
|
return `${status} ${time.getHours() < 10 ? '0' + time.getHours() : time.getHours()}
|
21
|
return `${status} ${time.getHours() < 10 ? '0' + time.getHours() : time.getHours()}
|
21
|
- :${time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()}`;
|
22
|
+ :${time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()}`;
|
|
|
23
|
+};
|
|
|
24
|
+
|
|
|
25
|
+// 获取顶部bannel
|
|
|
26
|
+let _getBannerData = () => {
|
|
|
27
|
+ return service.get('operations/api/v5/resource/get', {
|
|
|
28
|
+ content_code: contentCodeConfig.live.index
|
|
|
29
|
+ }, {
|
|
|
30
|
+ code: 200,
|
|
|
31
|
+ cache: true
|
|
|
32
|
+ }).then((result) => {
|
|
|
33
|
+ return result.data ? resourcesProcess(result.data) : [];
|
|
|
34
|
+ });
|
22
|
};
|
35
|
};
|
23
|
|
36
|
|
24
|
// 获取精选视频
|
37
|
// 获取精选视频
|
25
|
const _getBestList = () => {
|
38
|
const _getBestList = () => {
|
26
|
return api.get('v1/living/best', {}, true).then(result => {
|
39
|
return api.get('v1/living/best', {}, true).then(result => {
|
27
|
- let list = result.data;
|
40
|
+ let list = result.data || [];
|
28
|
|
41
|
|
29
|
for (let item of list) {
|
42
|
for (let item of list) {
|
30
|
switch (item.living) {
|
43
|
switch (item.living) {
|
|
@@ -44,18 +57,6 @@ const _getBestList = () => { |
|
@@ -44,18 +57,6 @@ const _getBestList = () => { |
44
|
});
|
57
|
});
|
45
|
};
|
58
|
};
|
46
|
|
59
|
|
47
|
-// 获取顶部bannel
|
|
|
48
|
-let _getBannerData = () => {
|
|
|
49
|
- return api.get('operations/api/v5/resource/get', {
|
|
|
50
|
- content_code: contentCodeConfig.live.index
|
|
|
51
|
- }, {
|
|
|
52
|
- code: 200,
|
|
|
53
|
- cache: true
|
|
|
54
|
- }).then((result) => {
|
|
|
55
|
- return result.data ? resourcesProcess(result.data) : [];
|
|
|
56
|
- });
|
|
|
57
|
-};
|
|
|
58
|
-
|
|
|
59
|
// 获取直播中所有视频
|
60
|
// 获取直播中所有视频
|
60
|
const _getLivingList = () => {
|
61
|
const _getLivingList = () => {
|
61
|
return api.get('v1/living/listing', {}, true);
|
62
|
return api.get('v1/living/listing', {}, true);
|
|
@@ -64,7 +65,7 @@ const _getLivingList = () => { |
|
@@ -64,7 +65,7 @@ const _getLivingList = () => { |
64
|
// 获取直播预告列表
|
65
|
// 获取直播预告列表
|
65
|
const _getPrelivingList = () => {
|
66
|
const _getPrelivingList = () => {
|
66
|
return api.get('v1/living/starting', {}, true).then(result => {
|
67
|
return api.get('v1/living/starting', {}, true).then(result => {
|
67
|
- let list = result.data;
|
68
|
+ let list = result.data || [];
|
68
|
|
69
|
|
69
|
for (let item of list) {
|
70
|
for (let item of list) {
|
70
|
item.starting_time = _formatTime(item.starting_time);
|
71
|
item.starting_time = _formatTime(item.starting_time);
|