File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ router.get('/', async (ctx) => {
4040 // await ctx.render('article-list', cacheArticleData)
4141
4242 } else {
43- console . log ( '进入查询数据库数据' )
4443 // 如果没有缓存数据,则读取数据库
4544 // 文章
4645 const article = await ArticleDao . list ( ctx . query )
@@ -74,8 +73,9 @@ router.get('/article/detail/:id', async (ctx) => {
7473 // 获取参数
7574 const cacheArticleDetail = await getRedis ( key )
7675 if ( cacheArticleDetail ) {
77- console . log ( '读缓存详情数据' )
78- ctx . response . status = 304 ;
76+ // 返回结果
77+ ctx . response . status = 200 ;
78+ await ctx . render ( 'article-detail' , cacheArticleDetail )
7979
8080 } else {
8181 // 通过验证器校验参数是否通过
@@ -106,7 +106,7 @@ router.get('/article/detail/:id', async (ctx) => {
106106 setRedis ( key , data , 60 )
107107
108108 // 响应返回页面
109- ctx . response . status = 304 ;
109+ ctx . response . status = 200 ;
110110 ctx . response . set ( 'Content-Type' , 'text/html charset=utf-8' )
111111 // 返回结果
112112 await ctx . render ( 'article-detail' , data )
You can’t perform that action at this time.
0 commit comments