This commit is contained in:
yuanke 2016-11-03 10:53:55 +08:00
parent a075b6d237
commit 4451ac80a0
1 changed files with 16 additions and 0 deletions

View File

@ -1197,18 +1197,27 @@ class User < Principal
#用户动态公共表记录
def act_as_principal_activity
tStarttime = Time.now
self.principal_acts << PrincipalActivity.new(:user_id => self.id,:principal_id => self.id)
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
Rails.logger.info "act_as_principal_activity wait time = #{tUsedtime} ms"
end
# 注册用户的时候消息默认点击时间为用户创建时间
def add_onclick_time
tStarttime = Time.now
if OnclickTime.where("user_id =?" , self.id).first.nil?
OnclickTime.create(:user_id => self.id, :onclick_time => self.created_on)
end
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
Rails.logger.info "add_onclick_time wait time = #{tUsedtime} ms"
end
#为新注册用户发送留言
def add_new_jour
tStarttime = Time.now
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)
@ -1223,6 +1232,9 @@ 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
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
Rails.logger.info "add_new_jour wait time = #{tUsedtime} ms"
end
# 更新邮箱的同事更新invite_lists表中的邮箱信息
@ -1286,9 +1298,13 @@ class User < Principal
def create_user_ealasticsearch_index
tStarttime = Time.now
if self.id != 2 && self.id != 4
self.__elasticsearch__.index_document if Rails.env.production?
end
tEndtime = Time.now
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
Rails.logger.info "create_user_ealasticsearch_index wait time = #{tUsedtime} ms"
end
def update_user_ealasticsearch_index
tStarttime = Time.now