hot-api.js
622 Bytes
const redis = global.yoho.redis;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
async getIndex() {
const keys = await redis.keysAsync('global:yoho:seo:hot:keywords:allIds:page:*').catch(() => {
return [];
});
return keys;
}
async getIds(page) {
return redis.getAsync(`global:yoho:seo:hot:keywords:allIds:page:${page}`).then(data => {
if (data) {
return JSON.parse(data);
}
return [];
}).catch(() => {
return [];
});
}
};