detail.js
915 Bytes
class detailModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
getMagazineInfo(params) {
const infoPromise = this.get({data: {
method: 'app.eBook.queryEBookByEId',
e_id: params[0]
}});
const buyInfoPromise = this.get({data: {
method: 'app.eBook.querySubscriberInfo',
e_id: params[0]
}});
return Promise.all([infoPromise, buyInfoPromise]).then((infos)=> {
const [bookInfo, buyInfo] = infos;
let data = {};
if (bookInfo && bookInfo.code === 200) {
data = bookInfo.data;
data.subcribeCount = 0;
if (buyInfo && buyInfo.code === 200) {
data.subcribeCount = buyInfo.data.total;
}
}
return data;
});
}
}
module.exports = detailModel;