Permalink
Browse files

文章的静态评分

  • Loading branch information...
1 parent 33f9c25 commit 44a071b7b79fe8a70b34109c4665905464386d01 sunxinyu committed Feb 23, 2016
Showing with 9 additions and 1 deletion.
  1. +4 −1 functions/article/article.js
  2. +5 −0 models/articles.js
@@ -110,8 +110,11 @@
var score;
if (article && article.publish_time && article.publish_time > 1000000) {
score = (article.comment_count / 5 + article.visit_count / 500) / Math.pow((new Date().getTime() / 1000 - article.createdAt.getTime() / 1000) / 60 / 60 + 2, 1.8);
+
+ static_score = ( article.comment_count + article.zan_count ) * 100 + article.visit_count / 500 / Math.pow((new Date().getTime() / 1000 - article.createdAt.getTime() / 1000) )
return article.updateAttributes({
- score: score
+ score: score,
+ static_score:static_score
}, ['score']).success(function() {});
}
}).error(function(error) {
View
@@ -72,6 +72,11 @@
type: "double",
"private": true
},
+ static_score:{
+ defaultValue: 0,
+ type: "double",
+ "private": true
+ },
pinyin: "varchar(1000)",
is_buy: {
defaultValue: 0,

0 comments on commit 44a071b

Please sign in to comment.