Authored by ccbikai

资源位优化

'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);
... ...
... ... @@ -17,7 +17,8 @@ module.exports = {
// api: 'http://devapi.yoho.cn:58078/',
// service: 'http://devservice.yoho.cn:58077/'
api: 'http://testapi.yoho.cn:28078/',
service: 'http://testservice.yoho.cn:28077/'
service: 'http://testservice.yoho.cn:28077/',
liveApi: 'http://api.live.yoho.cn/'
},
subDomains: {
host: '.m.yohobuy.com',
... ... @@ -86,7 +87,8 @@ if (isProduction) {
appName: 'm.yohobuy.com',
domains: {
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/'
service: 'http://service.yoho.yohoops.org/',
liveApi: 'http://api.live.yoho.cn/'
},
memcache: {
master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
... ... @@ -114,7 +116,8 @@ if (isProduction) {
appName: 'm.yohobuy.com for test',
domains: {
api: 'http://testapi.yoho.cn:28078/',
service: 'http://testservice.yoho.cn:28077/'
service: 'http://testservice.yoho.cn:28077/',
liveApi: 'http://api.live.yoho.cn/'
},
memcache: {
master: ['127.0.0.1:12111'],
... ...
... ... @@ -56,7 +56,7 @@
"uuid": "^2.0.2",
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.2.0",
"yoho-node-lib": "0.0.40"
"yoho-node-lib": "0.0.41"
},
"devDependencies": {
"autoprefixer": "^6.3.7",
... ...