注册用户发送留言 、留言页面代码优化
This commit is contained in:
parent
bf6bdc8c9e
commit
c0391b967f
|
@ -1492,13 +1492,13 @@ class UsersController < ApplicationController
|
|||
@jour_count = jours.count
|
||||
@jour = jours.limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
if User.current == @user
|
||||
@jour.update_all(:is_readed => true, :status => false)
|
||||
@jour.each do |journal|
|
||||
# fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
journal.delay.set_children_readed_delay
|
||||
end
|
||||
end
|
||||
# if User.current == @user
|
||||
# @jour.update_all(:is_readed => true, :status => false)
|
||||
# @jour.each do |journal|
|
||||
# # fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
# journal.delay.set_children_readed_delay
|
||||
# end
|
||||
# end
|
||||
@state = false
|
||||
render :layout=>'new_base_user'
|
||||
end
|
||||
|
|
|
@ -73,13 +73,13 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
||||
|
||||
validates :notes, presence: true, if: :is_homework_jour?
|
||||
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message,
|
||||
after_create :act_as_course_activity, :act_as_course_message,
|
||||
act_as_at_message(:notes, :user_id), :act_as_user_feedback_message,
|
||||
:act_as_principal_activity, :act_as_student_score
|
||||
after_create :reset_counters!
|
||||
:act_as_principal_activity
|
||||
# after_create :reset_counters!
|
||||
#after_update :update_activity
|
||||
# after_destroy :reset_counters!
|
||||
after_save :be_user_score
|
||||
# after_save :be_user_score
|
||||
after_destroy :down_user_score, :down_course_score
|
||||
|
||||
# default_scope { where('m_parent_id IS NULL') }
|
||||
|
|
|
@ -1216,13 +1216,9 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
|
||||
#为新注册用户发送留言
|
||||
# 为新注册用户发送留言
|
||||
# 只发三条没可以不用delay job,而且这个最好是注册的时候就能看到
|
||||
def add_new_jour
|
||||
self.delay.add_new_jour_delay
|
||||
end
|
||||
|
||||
#为新注册用户发送留言
|
||||
def add_new_jour_delay
|
||||
Rails.logger.info "add_new_jour_delay!!!!!!!!!"
|
||||
if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
|
||||
if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||
|
@ -1238,6 +1234,26 @@ class User < Principal
|
|||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
end
|
||||
end
|
||||
# self.delay.add_new_jour_delay
|
||||
end
|
||||
|
||||
#为新注册用户发送留言
|
||||
def add_new_jour_delay
|
||||
# Rails.logger.info "add_new_jour_delay!!!!!!!!!"
|
||||
# if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
|
||||
# if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||
# lead_message1 = Message.find(19292)
|
||||
# notes1 = lead_message1.content
|
||||
# lead_message2 = Message.find(19291)
|
||||
# notes2 = lead_message2.content
|
||||
# lead_message3 = Message.find(19504)
|
||||
# notes3 = lead_message3.content
|
||||
# #user_id 默认为课程使者创建
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
# 更新邮箱的同事,更新invite_lists表中的邮箱信息
|
||||
|
|
Loading…
Reference in New Issue