javaeye3/script/stat_mobile_count_for_csdn.rb

12 lines
697 B
Ruby

#!/usr/bin/env ruby
ENV['RAILS_ENV'] = ARGV[0] || 'production'
require File.dirname(__FILE__) + '/../config/environment'
news_count = News.count :conditions => {:whole_category_id => 1, :status => 'approved'}
blog_count = Blog.viewable.count :conditions => {:whole_category_id => 1}
topic_count = Topic.count :conditions => ['forum_id = 48 AND announcement = 0 AND status_flag NOT IN (?)', ['hidden', 'delete', 'draft'] ]
open "http://special.csdn.net/index.php/others/mobiledata_update/news_iteye/#{news_count}"
open "http://special.csdn.net/index.php/others/mobiledata_update/blog_iteye/#{blog_count}"
open "http://special.csdn.net/index.php/others/mobiledata_update/bbs_iteye/#{topic_count}"