@@ -4,17 +4,12 @@ def show
44 @blog_publish_count = Blog . with_status ( :publish ) . count
55 @blog_draft_count = Blog . with_status ( :draft ) . count
66 @comment_count = Blog . sum ( :comment_count )
7- @category_count = Category . count
8- @attach_count = Attach . count
9- @attach_size = Attach . sum ( 'file_size' )
10-
117 @total_visits = GaClient . get_total_visits if Setting . ga . chart_enable
128
139 render :json => {
1410 :blog => { :publish => @blog_publish_count , :draft => @blog_draft_count } ,
1511 :comment => @comment_count ,
16- :category => @category_count ,
17- :attach => { :count => @attach_count , :size => view_context . number_to_human_size ( @attach_size ) } ,
12+ :disqus_enable => Setting . disqus . enable ,
1813 :total_visits => @total_visits
1914 }
2015 end
@@ -46,4 +41,31 @@ def hot_blogs
4641
4742 render :json => @hot_blogs
4843 end
44+
45+ # 附件统计
46+ def attach
47+ @attach_count = Attach . count
48+ @attach_size = Attach . sum ( 'file_size' )
49+
50+ render :json => {
51+ :count => @attach_count ,
52+ :size => view_context . number_to_human_size ( @attach_size ) ,
53+ }
54+ end
55+
56+ # 评论数同步日志
57+ def sync_comment_logs
58+ @logs = Setting . sync_comment_logs || [ ]
59+ @logs . map! ( &:marshal_dump )
60+
61+ render :json => @logs
62+ end
63+
64+ # 同步评论数
65+ def sync_comment
66+ # 防御 get
67+ render :text => '' , :status => 404 and return if request . get?
68+ Comment . sync_count
69+ head :no_content
70+ end
4971end
0 commit comments