Commit 4cd560dc authored by 郭志伟's avatar 郭志伟

fix(activity): 问题调整

parent 8bec1cd4
......@@ -2,20 +2,20 @@ import { Controller, Context } from 'egg';
export default class ActivityController extends Controller {
public async home(ctx: Context) {
// const redisKey = `quantum-blocks:page:${ctx.params.id}`;
// let body = await ctx.service.redis.get(redisKey);
// if (body) {
// ctx.logger.info('请求redis成功 key: %j', redisKey);
// }
// if (!body) {
// let apollo = {};
// if (process.env.NODE_ENV === 'production' && process.env.EGG_SERVER_ENV === 'sit') {
// apollo = ctx.app.config.apollo || {};
// }
// body = await ctx.renderView('activity.js', { url: ctx.url, apollo });
// await ctx.service.redis.set(redisKey, body);
// }
// ctx.body = body;
ctx.body = await ctx.renderView('activity.js', { url: ctx.url });
const redisKey = `quantum-blocks:page:${ctx.params.id}`;
let body = await ctx.service.redis.get(redisKey);
if (body) {
ctx.logger.info('请求redis成功 key: %j', redisKey);
}
if (!body) {
let apollo = {};
if (process.env.NODE_ENV === 'production' && process.env.EGG_SERVER_ENV === 'sit') {
apollo = ctx.app.config.apollo || {};
}
body = await ctx.renderView('activity.js', { url: ctx.url, apollo });
await ctx.service.redis.set(redisKey, body);
}
ctx.body = body;
// ctx.body = await ctx.renderView('activity.js', { url: ctx.url });
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment