Authored by 郝肖肖

'live-ctx'

... ... @@ -72,9 +72,14 @@ module.exports = class extends global.yoho.BaseModel {
// 获取精选视频
_getBestList() {
return liveAPI.get('v1/living/best', {}, {
code: 200,
cache: false
return this.get({
api: liveAPI,
url: 'v1/living/best',
data: {},
param: {
code: 200,
cache: false
}
}).then(result => {
let list = result && result.data || [];
... ... @@ -107,9 +112,14 @@ module.exports = class extends global.yoho.BaseModel {
// 获取直播中所有视频
_getLivingList() {
return liveAPI.get('v1/living/listing', {}, {
code: 200,
cache: false
return this.get({
api: liveAPI,
url: 'v1/living/listing',
data: {},
param: {
code: 200,
cache: false
}
}).then(result => {
return result && result.data || [];
});
... ... @@ -117,9 +127,14 @@ module.exports = class extends global.yoho.BaseModel {
// 获取直播预告列表
_getPrelivingList() {
return liveAPI.get('v1/living/starting', {}, {
code: 200,
cache: false
return this.get({
api: liveAPI,
url: 'v1/living/starting',
data: {},
param: {
code: 200,
cache: false
}
}).then(result => {
let list = result && result.data || [];
... ... @@ -132,9 +147,14 @@ module.exports = class extends global.yoho.BaseModel {
// 获取回看列表
_getRecordList() {
return liveAPI.get('v1/living/replaying', {}, {
code: 200,
cache: false
return this.get({
api: liveAPI,
url: 'v1/living/replaying',
data: {},
param: {
code: 200,
cache: false
}
}).then(result => {
return result && result.data || [];
});
... ... @@ -153,39 +173,46 @@ module.exports = class extends global.yoho.BaseModel {
// 获取 回放视屏 信息
fetchReplayInfo(videoID) {
let url = 'v1/living/detail';
let data = { video_id: videoID };
let options = { cache: true };
return liveAPI.get(url, data, options)
.then(result => {
if (result && result.data) {
let d = result.data;
d.background = helpers.image(d.background, 640, 968);
d.pic = helpers.image(d.pic, 640, 968);
d.master_pic = helpers.image(d.master_pic, 180, 180);
d.humanTime = _formatTime(data.live_start_time * 1000);
d.video_src = d.url;
// 自定义数据
d.duration = '00:00:00'; // 回看时长 前端JS根据video获取
d.living = 3; // 重播 状态
d.canPlay = true;
d.atEnd = false;
d.isReplay = true;
}
return result || {};
});
return this.get({
api: liveAPI,
url: 'v1/living/detail',
data: data,
param: {
cache: true
}
}).then(result => {
if (result && result.data) {
let d = result.data;
d.background = helpers.image(d.background, 640, 968);
d.pic = helpers.image(d.pic, 640, 968);
d.master_pic = helpers.image(d.master_pic, 180, 180);
d.humanTime = _formatTime(data.live_start_time * 1000);
d.video_src = d.url;
// 自定义数据
d.duration = '00:00:00'; // 回看时长 前端JS根据video获取
d.living = 3; // 重播 状态
d.canPlay = true;
d.atEnd = false;
d.isReplay = true;
}
return result || {};
});
}
// 获取 直播视屏 信息
fetchLiveInfo(roomID) {
let url = 'v1/living/detail';
let data = { room_id: roomID };
return liveAPI.get(url, data).then(result => {
return this.get({
api: liveAPI,
url: 'v1/living/detail',
data: data
}).then(result => {
if (result && result.data) {
let d = result.data;
... ... @@ -216,18 +243,27 @@ module.exports = class extends global.yoho.BaseModel {
// 获取 直播 弹幕 host
getBarrageHost(type) {
return liveAPI.get('v1/system/gethosts', { type });
return this.get({
api: liveAPI,
url: 'v1/system/gethosts',
data: { type }
});
}
getReplyBarrage(videoID, startTime, timeInterval) {
const url = 'v1/living/getreplaybarrage';
const data = {
startTime,
timeInterval,
video_id: videoID
};
const options = { cache: true };
return liveAPI.get(url, data, options);
return this.get({
api: liveAPI,
url: 'v1/living/getreplaybarrage',
data: data,
param: {
cache: true
}
});
}
};
... ...