|
|
'use strict';
|
|
|
const api = global.yoho.ServiceAPI;
|
|
|
const service = global.yoho.ServiceAPI;
|
|
|
const api = global.yoho.LiveAPI;
|
|
|
const contentCodeConfig = require('../../../config/content-code');
|
|
|
const resourcesProcess = require(`${global.utils}/resources-process`);
|
|
|
|
...
|
...
|
@@ -18,13 +19,25 @@ const _formatTime = (a, b) => { |
|
|
status = b ? '预告' : '今天';
|
|
|
}
|
|
|
return `${status} ${time.getHours() < 10 ? '0' + time.getHours() : time.getHours()}
|
|
|
:${time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()}`;
|
|
|
:${time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()}`;
|
|
|
};
|
|
|
|
|
|
// 获取顶部bannel
|
|
|
let _getBannerData = () => {
|
|
|
return service.get('operations/api/v5/resource/get', {
|
|
|
content_code: contentCodeConfig.live.index
|
|
|
}, {
|
|
|
code: 200,
|
|
|
cache: true
|
|
|
}).then((result) => {
|
|
|
return result.data ? resourcesProcess(result.data) : [];
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 获取精选视频
|
|
|
const _getBestList = () => {
|
|
|
return api.get('v1/living/best', {}, true).then(result => {
|
|
|
let list = result.data;
|
|
|
let list = result.data || [];
|
|
|
|
|
|
for (let item of list) {
|
|
|
switch (item.living) {
|
...
|
...
|
@@ -44,18 +57,6 @@ const _getBestList = () => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
// 获取顶部bannel
|
|
|
let _getBannerData = () => {
|
|
|
return api.get('operations/api/v5/resource/get', {
|
|
|
content_code: contentCodeConfig.live.index
|
|
|
}, {
|
|
|
code: 200,
|
|
|
cache: true
|
|
|
}).then((result) => {
|
|
|
return result.data ? resourcesProcess(result.data) : [];
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 获取直播中所有视频
|
|
|
const _getLivingList = () => {
|
|
|
return api.get('v1/living/listing', {}, true);
|
...
|
...
|
@@ -64,7 +65,7 @@ const _getLivingList = () => { |
|
|
// 获取直播预告列表
|
|
|
const _getPrelivingList = () => {
|
|
|
return api.get('v1/living/starting', {}, true).then(result => {
|
|
|
let list = result.data;
|
|
|
let list = result.data || [];
|
|
|
|
|
|
for (let item of list) {
|
|
|
item.starting_time = _formatTime(item.starting_time);
|
...
|
...
|
|