file-service.js
635 Bytes
const Context = require('../common/context');
class FileService extends Context {
constructor() {
super();
}
getAbsoluteUrl(url, bucket) {
if (!url) {
return null;
}
let urlArr = url.split('/'),
stag = urlArr[urlArr.length - 1].substr(0, 2),
domain = `static.yhbimg.com/${bucket}`;
url = domain + url;
if (stag === '01') {
return `//img11.${url}`;
} else if (stag === '03') {
return `//flv01.${url}`;
} else {
return `//img12.${url}`;
}
}
}
module.exports = FileService;