|
|
|
@ -258,7 +258,7 @@ class User < Principal
|
|
|
|
|
###添加留言 fq
|
|
|
|
|
def add_jour(user, notes, reference_user_id = 0, options = {})
|
|
|
|
|
if options.count == 0
|
|
|
|
|
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true)
|
|
|
|
|
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true, :is_readed => false)
|
|
|
|
|
else
|
|
|
|
|
jfm = self.journals_for_messages.build(options)
|
|
|
|
|
jfm.save
|
|
|
|
@ -294,7 +294,7 @@ class User < Principal
|
|
|
|
|
|
|
|
|
|
# 查询用户未读过的记录
|
|
|
|
|
def count_new_jour
|
|
|
|
|
count = self.journals_for_messages.where("status=?", 1).count
|
|
|
|
|
count = self.journals_for_messages.where("status=? and is_readed = ? " ,1, 0).count
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#added by nie
|
|
|
|
|