|
|
@ -1,4 +1,4 @@
|
|
|
|
# bundle exec rake sync:public_message args=149,2903
|
|
|
|
# RAILS_ENV=production bundle exec rake sync:sigle_message args=3,-1,8848,48337,'2017-07-23','2017-10-31',1000
|
|
|
|
namespace :sync do
|
|
|
|
namespace :sync do
|
|
|
|
if ENV['args']
|
|
|
|
if ENV['args']
|
|
|
|
subject_id = ENV['args'].split(",")[0] # 对应课程的id
|
|
|
|
subject_id = ENV['args'].split(",")[0] # 对应课程的id
|
|
|
@ -33,7 +33,7 @@ namespace :sync do
|
|
|
|
else
|
|
|
|
else
|
|
|
|
shixun_ids = Shixun.find_by_sql("select shixun_id from stage_shixuns where stage_id in (select id from stages where
|
|
|
|
shixun_ids = Shixun.find_by_sql("select shixun_id from stage_shixuns where stage_id in (select id from stages where
|
|
|
|
subject_id=#{subject_id}) ").map(&:shixun_id)
|
|
|
|
subject_id=#{subject_id}) ").map(&:shixun_id)
|
|
|
|
discusses = Discuss.where("parent_id is null").where(dis_id: shixun_ids)
|
|
|
|
discusses = Discuss.where("parent_id is null and created_at between '#{start_time}' and '#{end_time}'").where(dis_id: shixun_ids)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
discusses.each do |discuss|
|
|
|
|
discusses.each do |discuss|
|
|
|
|