Authored by zzzzzzz

加强容错

... ... @@ -14,9 +14,14 @@ const _formatTime = (timestamp, b) => {
let diff = moment.duration(startTime.clone().startOf('day') - now.startOf('day')).days();
switch (diff) {
case 0: date = b ? '[预告]' : '[今天]'; break;
case 1: date = b ? '[预告明日]' : '[明天]'; break;
default: null;
case 0:
date = b ? '[预告]' : '[今天]';
break;
case 1:
date = b ? '[预告明日]' : '[明天]';
break;
default:
null;
}
return startTime.format(`${date}${time}`);
... ... @@ -40,7 +45,7 @@ const _getBestList = () => {
code: 200,
cache: false
}).then(result => {
let list = result.data || [];
let list = result && result.data || [];
for (let item of list) {
switch (item.living) {
... ... @@ -59,7 +64,7 @@ const _getBestList = () => {
// 格式化时间
item.starting_time = _formatTime(item.starting_time * 1000, true);
}
return result.data || [];
return result && result.data || [];
});
};
... ... @@ -69,7 +74,7 @@ const _getLivingList = () => {
code: 200,
cache: false
}).then(result => {
return result.data || [];
return result && result.data || [];
});
};
... ... @@ -79,12 +84,12 @@ const _getPrelivingList = () => {
code: 200,
cache: false
}).then(result => {
let list = result.data || [];
let list = result && result.data || [];
for (let item of list) {
item.starting_time = _formatTime(item.starting_time * 1000);
}
return result.data || [];
return result && result.data || [];
});
};
... ... @@ -94,7 +99,7 @@ const _getRecordList = () => {
code: 200,
cache: false
}).then(result => {
return result.data || [];
return result && result.data || [];
});
};
... ... @@ -106,12 +111,12 @@ const getAllList = () => {
// 获取 回放视屏 信息
const fetchReplayInfo = (videoID) => {
let url = 'v1/living/detail';
let data = {video_id: videoID};
let options = {cache: true};
let data = { video_id: videoID };
let options = { cache: true };
return liveAPI.get(url, data, options)
.then(result => {
if (result.data) {
if (result && result.data) {
let d = result.data;
d.logo = helpers.image(d.logo, 70, 70);
... ... @@ -126,18 +131,18 @@ const fetchReplayInfo = (videoID) => {
d.atEnd = false;
}
return result;
return result || {};
});
};
// 获取 直播视屏 信息
const fetchLiveInfo = (roomID) => {
let url = 'v1/living/detail';
let data = {room_id: roomID};
let data = { room_id: roomID };
return liveAPI.get(url, data)
.then(result => {
if (result.data) {
if (result && result.data) {
let d = result.data;
d.logo = helpers.image(d.logo, 70, 70);
... ... @@ -152,7 +157,7 @@ const fetchLiveInfo = (roomID) => {
d.atEnd = d.living === 2;
}
return result;
return result || {};
});
};
... ... @@ -166,7 +171,7 @@ const fetchInfo = (id, isReplay) => {
// 获取 直播 弹幕 host
const getBarrageHost = (type) => {
return liveAPI.get('v1/system/gethosts', {type});
return liveAPI.get('v1/system/gethosts', { type });
};
const getReplyBarrage = (videoID, startTime, timeInterval) => {
... ... @@ -176,7 +181,7 @@ const getReplyBarrage = (videoID, startTime, timeInterval) => {
timeInterval,
video_id: videoID
};
const options = {cache: true};
const options = { cache: true };
return liveAPI.get(url, data, options);
};
... ... @@ -187,4 +192,4 @@ module.exports = {
fetchInfo,
getBarrageHost,
getReplyBarrage
};
};
\ No newline at end of file
... ...
... ... @@ -138,7 +138,7 @@ function get_download_link() {
*/
function check_supperUniversalLink() {
var osversion = navigator.userAgent.match(/iPhone OS (\d*)/);
console.log(osversion && osversion[1]);
//console.log(osversion && osversion[1]);
return osversion && osversion[1];
/*if (osversion && osversion[1] >= 9) {
return true;
... ... @@ -311,7 +311,7 @@ $(document).ready(function() {
});
module.exports = (function(){
module.exports = (function() {
global.openAppOrLink = openAppOrLink;
global.get_download_link = get_download_link;
global.check_supperUniversalLink = check_supperUniversalLink;
... ... @@ -319,4 +319,4 @@ module.exports = (function(){
global.ManageQueryString = ManageQueryString;
global.getQueryString = getQueryString;
global.check_sys_open = check_sys_open;
})();
})();
\ No newline at end of file
... ...