parent
f8380edd24
commit
626241ef3f
@ -1 +1 @@
|
|||||||
json.(@live, :id, :description, :url)
|
json.(@live, :id, :description, :url, :platform, :live_time, :duration, :course_name)
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
json.lives @lives do |live|
|
json.lives @lives do |live|
|
||||||
json.(live, :id, :description, :on_status)
|
json.(live, :id, :description, :on_status, :duration, :course_name)
|
||||||
json.url live.on_status ? live.url : ""
|
json.url live.on_status ? live.url : ""
|
||||||
json.author_name live.user.show_real_name
|
json.author_name live.user.show_real_name
|
||||||
json.author_login live.user.login
|
json.author_login live.user.login
|
||||||
json.author_img url_to_avatar(live.user)
|
json.author_img url_to_avatar(live.user)
|
||||||
json.op_auth live.op_auth?
|
json.op_auth live.op_auth?
|
||||||
json.delete_auth live.delete_auth?
|
json.delete_auth live.delete_auth?
|
||||||
json.created_at live.created_at.strftime('%Y-%m-%d')
|
json.live_time live.live_time&.strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
json.platform live.platform_name
|
||||||
end
|
end
|
||||||
json.my_live_id @my_live_id
|
json.my_live_id @my_live_id
|
||||||
json.total_count @total_count
|
json.total_count @total_count
|
@ -0,0 +1,13 @@
|
|||||||
|
namespace :live_notice do
|
||||||
|
desc "send a live message to students before 30 minutes"
|
||||||
|
task message: :environment do
|
||||||
|
lives = LiveLink.where(on_status: 0).where("live_time <= '#{Time.now + 30*60}' and live_time > '#{Time.now}'")
|
||||||
|
lives.each do |live|
|
||||||
|
LivePublishJob.perform_later(live.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
task on_status: :environment do
|
||||||
|
LiveLink.where(on_status: 0).where("live_time <= '#{Time.now}'").update_all(on_status: 1)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue