Permalink
Browse files

年度总结

  • Loading branch information...
1 parent 0985154 commit b629bc4386b734999bf234423f457a5e95bb8e43 sunxinyu committed Feb 23, 2016
Showing with 173 additions and 17 deletions.
  1. +9 −4 controllers/article.js
  2. +1 −1 functions/article/article.js
  3. +106 −0 static/htmljs-year-2015.html
  4. +15 −4 tools/email.coffee
  5. +42 −8 views/email_tpl.jade
@@ -52,7 +52,6 @@
setInterval(function() {
return func_article.run_sort();
}, 1000 * 60 * 10);
-func_article.run_sort();
module.exports.controllers = {
"/": {
"get": function(req, res, next) {
@@ -61,9 +60,15 @@ func_article.run_sort();
},
"/email":{
get:function(req,res){
- func_article.getAll(1,100,['createdAt > ?',(moment(new Date().getTime() - 1000*60*60*24*7).format("YYYY-MM-DD"))],"static_score desc",function(err,weekly_articles){
- res.locals.weekly_articles = weekly_articles;
- res.render('email_tpl.jade');
+ func_article.getAll(1,20,['articles.createdAt > ?',(moment(new Date().getTime() - 1000*60*60*24*7).format("YYYY-MM-DD"))],"static_score desc",function(err,weekly_articles){
+ res.locals.weekly_articles = weekly_articles;
+ func_article.getAll(1,20,['articles.createdAt > ?',(moment(new Date().getTime() - 1000*60*60*24*30).format("YYYY-MM-DD"))],"static_score desc",function(err,month_articles){
+ res.locals.month_articles = month_articles;
+ func_article.getAll(1,20,['articles.createdAt > ?',(moment(new Date().getTime() - 1000*60*60*24*30*12).format("YYYY-MM-DD"))],"static_score desc",function(err,year_articles){
+ res.locals.year_articles = year_articles;
+ res.render('email_tpl.jade');
+ })
+ })
})
}
@@ -131,7 +131,7 @@
offset: (page - 1) * count,
limit: count,
order: order,
- attributes: ['id', 'publish_time', 'createdAt', 'zan_count', 'comment_count', 'visit_count', 'main_pic', 'title', 'user_id', 'user_nick', 'user_headpic', 'is_jian', 'is_top', 'type', 'column_id', 'uuid', 'pinyin', 'tags'],
+ attributes: ['id', 'publish_time', 'createdAt', 'zan_count', 'comment_count', 'visit_count', 'main_pic', 'title', 'user_id', 'user_nick', 'user_headpic', 'is_jian', 'is_top', 'type', 'column_id', 'uuid', 'pinyin', 'tags','static_score'],
include: [User, Column],
raw: false
};
@@ -0,0 +1,106 @@
+
+
+<!DOCTYPE html><html><head><meta charset="utf-8"><link rel="Shortcut Icon" href="http://htmljs.b0.upaiyun.com//images/logo.ico?123"><link href="http://htmljs.b0.upaiyun.com//images/logo.ico?123" rel="shortcut icon" type="image/x-icon"><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable = no"/>
+<link href="http://htmljs.b0.upaiyun.com//images/icon.png" rel="apple-touch-icon"/>
+<meta name="keywords" content="前端, 前端开发, web前端, web前端开发, 前端开发工程师, 前端开发攻城师,设计, 开发, 前端资源, CSS, JavaScript, Ajax, jQuery, html,html5,css3,浏览器兼容, 前端开发工具, 前端招聘, jQuery API, CSS整形和优化工具 , JS压缩工具 , JS格式化工具 , CSS参考手册 ,HTML参考手册 , 多重搜索 , nodejs , node , boostrap , sublime"/>
+<title>[前端乱炖] 2015年最受欢迎的20篇[原创]文章 强捏推荐阅读</title><base target="_blank"/><meta name="description" content="前端乱炖每周会为您推送本站精选的新鲜速递。">
+<style>
+
+html,body{margin:0;background: #fff;font-size: 14px;color:#444;}
+</style>
+</head>
+
+<body>
+ <div style="height:40px;line-height:40px;margin:0 -5px;background:#64ba9d;color:#fff;">
+ <div style="width: 600px;margin:0 auto;" class="wrapper">
+ <a href="http://www.html-js.com" style="text-decoration:none;color:#fff;">前端乱炖官网</a>
+ <a href="http://www.html-js.com/static/htmljs-weekly-8.html" style="padding:0 10px;text-decoration:none;color:#fff;">上一期</a>
+ </div>
+ </div>
+ <p style="margin:0;padding-top:0;border-bottom:1px dotted #ccc;padding-bottom:6px;text-align:center;font-size:18px;font-family:arial,sans-serif;margin-top:20px;line-height:30px;color:#333;">[前端乱炖] 2015年最受欢迎的20篇[原创]文章 强捏推荐阅读</p>
+<p style=" text-align:center;margin-bottom:24px;font-size:14px;font-family:arial,sans-serif;line-height:14px;color:#333;">@前端乱炖 是一个提供高质量原创内容的技术社区</p>
+
+<div style="margin-bottom:24px;border:1px solid #ccc;font-size:14px;color:#333;">
+ <p style="padding:0 16px">年度精选</p>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>【原创】移动端高清、多屏适配方案 </span><span>【移动端H5】</span><a href="http://www.html-js.com/article/Mobile-terminal-H5-mobile-terminal-HD-multi-screen-adaptation-scheme 3041">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/1200">Lovesueee</span><span style="margin-right:10px;"> 2015-07-02 </span><span style="margin-right:10px;"> 访问量 33355</span><span style="margin-right:10px;"> 点赞数 98</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>javascript组件开发方式 </span><span>【js从零单排】</span><a href="http://www.html-js.com/article/JS-from-zero-single-row-JavaScript-component-development-method">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/4470">竹隐</span><span style="margin-right:10px;"> 2015-03-16 </span><span style="margin-right:10px;"> 访问量 10443</span><span style="margin-right:10px;"> 点赞数 55</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>移动Web开发技巧汇总 </span><span>【前端分享】</span><a href="http://www.html-js.com/article/Front-end-sharing 2983">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/6218">凯凯刘</span><span style="margin-right:10px;"> 2015-06-09 </span><span style="margin-right:10px;"> 访问量 13241</span><span style="margin-right:10px;"> 点赞数 53</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>React Native第一课 </span><span>【即学即用React Native】</span><a href="http://www.html-js.com/article/Learn-that-use-React-Native-React-Native-the-first-lesson">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/526">张小俊128</span><span style="margin-right:10px;"> 2015-03-27 </span><span style="margin-right:10px;"> 访问量 31851</span><span style="margin-right:10px;"> 点赞数 41</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>Javascript 之高逼格代码 </span><span>【js菜鸟中的菜鸟开始学飞】</span><a href="http://www.html-js.com/article/JS-rookie-in-the-rookie-to-start-learning-to-fly-high-force-lattice-code-Javascript">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/2375">古道川</span><span style="margin-right:10px;"> 2015-03-19 </span><span style="margin-right:10px;"> 访问量 5199</span><span style="margin-right:10px;"> 点赞数 38</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>屌爆了,完美调试 微信webview(x5) </span><span>【微信】</span><a href="http://www.html-js.com/article/WeChat-cock-burst-perfect-debugging-WeChat-WebView-x5 3076">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/5618">sherlock221b</span><span style="margin-right:10px;"> 2015-07-23 </span><span style="margin-right:10px;"> 访问量 7901</span><span style="margin-right:10px;"> 点赞数 33</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>2015前端组件化框架之路 </span><span>【民工精髓的博客】</span><a href="http://www.html-js.com/article/The-essence-of-the-2015-migrant-workers-blog-frontend-component-framework-road">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/598">民工精髓</span><span style="margin-right:10px;"> 2015-03-25 </span><span style="margin-right:10px;"> 访问量 5905</span><span style="margin-right:10px;"> 点赞数 31</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>【原创】ui.router源码解析 </span><span>【前端源码解析】</span><a href="http://www.html-js.com/article/Front-end-source-code-analysis-original-uirouter-source-code-analysis">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/1200">Lovesueee</span><span style="margin-right:10px;"> 2015-04-20 </span><span style="margin-right:10px;"> 访问量 7435</span><span style="margin-right:10px;"> 点赞数 29</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>前端选择麻痹症 </span><span>【前端说】</span><a href="http://www.html-js.com/article/Front-end-front-end-select-paralysis">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/526">张小俊128</span><span style="margin-right:10px;"> 2015-03-02 </span><span style="margin-right:10px;"> 访问量 4391</span><span style="margin-right:10px;"> 点赞数 26</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>如何面试一名前端开发工程师? </span><span>【大搜车前端团队专栏】</span><a href="http://www.html-js.com/article/Large-search-front-team-column 2961">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/1">芋头</span><span style="margin-right:10px;"> 2015-05-26 </span><span style="margin-right:10px;"> 访问量 7295</span><span style="margin-right:10px;"> 点赞数 24</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>影响网页渲染的关键! </span><span>【OneAPM技术博客】</span><a href="http://www.html-js.com/article/OneAPM-technology-blog 2947">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/5715">OneAPM_王鹏</span><span style="margin-right:10px;"> 2015-05-22 </span><span style="margin-right:10px;"> 访问量 3431</span><span style="margin-right:10px;"> 点赞数 24</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>Vue.js 0.12 发布 </span><span>【Vue.js 中文入门】</span><a href="http://www.html-js.com/article/Vuejs-Chinese-entry-Vuejs-012-release 3035">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/1152">尤小右</span><span style="margin-right:10px;"> 2015-06-25 </span><span style="margin-right:10px;"> 访问量 4531</span><span style="margin-right:10px;"> 点赞数 21</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>《web前端最佳实践》—高性能css </span><span>【前端家园】</span><a href="http://www.html-js.com/article/Front-end-home-best-practice-in-front-of-the-web-high-performance-CSS">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/3652">灵感_idea</span><span style="margin-right:10px;"> 2015-04-04 </span><span style="margin-right:10px;"> 访问量 3581</span><span style="margin-right:10px;"> 点赞数 20</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>“NodeJS在大搜车” 之 MVC基础结构 </span><span>【大搜车前端团队专栏】</span><a href="http://www.html-js.com/article/Front-team-search-car-front-team-NodeJS-in-search-car-MVC-basic-structure 2985">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/1">芋头</span><span style="margin-right:10px;"> 2015-06-09 </span><span style="margin-right:10px;"> 访问量 7187</span><span style="margin-right:10px;"> 点赞数 18</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>Angular 2.0 和 1.x比较 </span><span>【AngularJS乱炖】</span><a href="http://www.html-js.com/article/AngularJS-mass-Angular-2-and-1x-comparison">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/2605">jnotnull</span><span style="margin-right:10px;"> 2015-03-09 </span><span style="margin-right:10px;"> 访问量 8617</span><span style="margin-right:10px;"> 点赞数 16</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>Webpack,101入门体验 </span><span>【webpack】</span><a href="http://www.html-js.com/article/Webpack 3009">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/5831">Yika</span><span style="margin-right:10px;"> 2015-06-18 </span><span style="margin-right:10px;"> 访问量 6855</span><span style="margin-right:10px;"> 点赞数 15</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>【译】15个必须知道的chrome开发者技巧(GIF) </span><span>【前端分享】</span><a href="http://www.html-js.com/article/The-front-end-to-share-translation-15-must-know-the-chrome-developer-skills-GIF 3003">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/6218">凯凯刘</span><span style="margin-right:10px;"> 2015-06-16 </span><span style="margin-right:10px;"> 访问量 1919</span><span style="margin-right:10px;"> 点赞数 15</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>《web前端最佳实践》—高维护性css </span><span>【前端家园】</span><a href="http://www.html-js.com/article/The-front-end-of-the-frontend-Web-Best-Practice--CSS-home">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/3652">灵感_idea</span><span style="margin-right:10px;"> 2015-03-28 </span><span style="margin-right:10px;"> 访问量 2215</span><span style="margin-right:10px;"> 点赞数 15</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>一个月时间整理《深入浅出Node.js》 </span><span>【小前端tw93】</span><a href="http://www.html-js.com/article/The-little-front-end-tw93-a-month-finishing-explain-profound-theories-in-simple-language-Nodejs">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/3937">tw93</span><span style="margin-right:10px;"> 2015-03-23 </span><span style="margin-right:10px;"> 访问量 2787</span><span style="margin-right:10px;"> 点赞数 15</span></p>
+ </div>
+ <div style="border-top:1px dotted #ccc;padding:0 16px">
+ <p> <span>前后端数据交互方法 </span><span>【Nimojs | 前端开发】</span><a href="http://www.html-js.com/article/Nimojs--frontend-development">点此访问</a></p>
+ <p style="color:#999;"> <span style="margin-right:10px;" href="http://www.html-js.com/user/1428">nimo</span><span style="margin-right:10px;"> 2015-03-09 </span><span style="margin-right:10px;"> 访问量 4099</span><span style="margin-right:10px;"> 点赞数 15</span></p>
+ </div>
+</div>
+</body>
View
@@ -1,20 +1,31 @@
mail = require './../lib/mail.js'
mustache = require 'mu2'
config = require './../config.coffee'
-
+tplmail = require "./../lib/tpl_mail.js"
buffer = ""
-mustache.compileAndRender('./../static/htmljs-weekly-11-clear.html', {})
+mustache.compileAndRender('./../static/htmljs-year-2015.html', {})
.on 'data',(c)->
buffer += c.toString()
.on 'end',()->
mail({
- subject:"前端乱炖周刊第11期-每周为您精选新鲜营养!",
+ subject:"[前端乱炖]2015年最受欢迎的20篇[原创]文章",
to:"xinyu198736@gmail.com",
# to:"weekly@htmljs.sendcloud.org",
# use_maillist:"true",
api_user:config.mail.api_user_list,
api_key: config.mail.api_key_list,
html:buffer
})
-
+ tplmail({
+ subject:"[前端乱炖]2015年最受欢迎的20篇[原创]文章2",
+ substitution_vars:JSON.stringify({
+ to:["xinyu198736@gmail.com"],
+ sub:{
+ "%content%":[buffer],
+ "%title%":['[前端乱炖]2015年最受欢迎的20篇[原创]文章2'],
+ "%url%":['http://www.html-js.com/static/htmljs-year-2015.html']
+ }
+ }),
+ template_invoke_name:"common",
+ })
View
@@ -1,11 +1,45 @@
+p(style="margin:0;padding-top:0;border-bottom:1px dotted #ccc;padding-bottom:6px;text-align:center;font-size:18px;font-family:arial,sans-serif;margin-top:20px;line-height:30px;")
+ | 前端乱炖 2015年最受欢迎的20篇[原创]文章 强捏推荐阅读
+p(style=" text-align:center;margin-bottom:24px;font-size:14px;font-family:arial,sans-serif;line-height:14px;")
+ | @前端乱炖 是一个提供高质量原创内容的技术社区
+div(style="margin-bottom:24px;border:1px solid #ccc;font-size:14px;font-family:arial,sans-serif;margin-top:20px;")
+ p(style="padding:0 16px") 周精选
+ each article in locals.weekly_articles
+ div(style="border-top:1px dotted #ccc;padding:0 16px")
+ p
+ span #{article&&article.title}
+ span 【#{article.column?article.column.name:''}
+ a(href="http://www.html-js.com/article/#{article.pinyin}") 点此访问
+ p(style="color:#999;font-size:12px;")
+ span #{article.user_nick}
+ span(style="margin-right:10px;") #{moment(article.createdAt).format("YYYY-MM-DD")}
+ span(style="margin-right:10px;") 访问量 #{article.visit_count}
+ span(style="margin-right:10px;") 点赞数 #{article.zan_count+article.comment_count}
+
div(style="margin-bottom:24px;border:1px solid #ccc;font-size:14px;")
- p(style="padding:0 16px") 北京
-
+ p(style="padding:0 16px") 月精选
+ each article in locals.month_articles
+ div(style="border-top:1px dotted #ccc;padding:0 16px")
+ p
+ span #{article&&article.title}
+ span 【#{article.column?article.column.name:''}
+ a(href="http://www.html-js.com/article/#{article.pinyin}") 点此访问
+ p(style="color:#999;")
+ span(style="margin-right:10px;",href="http://www.html-js.com/user/#{article.user_id}") #{article.user_nick}
+ span(style="margin-right:10px;") #{moment(article.createdAt).format("YYYY-MM-DD")}
+ span(style="margin-right:10px;") 访问量 #{article.visit_count}
+ span(style="margin-right:10px;") 点赞数 #{article.zan_count+article.comment_count}
- each article in locals.weekly_articles
+div(style="margin-bottom:24px;border:1px solid #ccc;font-size:14px;")
+ p(style="padding:0 16px") 年度精选
+ each article in locals.year_articles
div(style="border-top:1px dotted #ccc;padding:0 16px")
- p #{article&&article.title} - #{article.column?article.column.name:''}
- p #{article.user_nick}
- | #{moment(article.createdAt).format("YYYY-MM-DD")}
- | 访问量:#{article.visit_count}
- | 点赞数:#{article.zan_count}
+ p
+ span #{article&&article.title}
+ span 【#{article.column?article.column.name:''}
+ a(href="http://www.html-js.com/article/#{article.pinyin}") 点此访问
+ p(style="color:#999;")
+ span(style="margin-right:10px;",href="http://www.html-js.com/user/#{article.user_id}") #{article.user_nick}
+ span(style="margin-right:10px;") #{moment(article.createdAt).format("YYYY-MM-DD")}
+ span(style="margin-right:10px;") 访问量 #{article.visit_count}
+ span(style="margin-right:10px;") 点赞数 #{article.zan_count+article.comment_count}

0 comments on commit b629bc4

Please sign in to comment.