Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq

Conflicts:
	db/schema.rb
This commit is contained in:
huang 2015-08-24 17:53:55 +08:00
commit 4af3c9816c
3 changed files with 28 additions and 6 deletions

View File

@ -99,6 +99,18 @@ class NewsController < ApplicationController
end
def show
query_forge_news = @news.forge_messages
query_forge_news.each do |query|
if User.current.id == query.user_id
query.update_attributes(:viewed => true)
end
end
query_course_news = @news.course_messages
query_course_news.each do |query|
if User.current.id == query.user_id
query.update_attributes(:viewed => true)
end
end
cs = CoursesService.new
result = cs.show_course_news params,User.current
@news = result[:news]

View File

@ -113,12 +113,12 @@ class UsersController < ApplicationController
forge_querys = @user.forge_messages
user_querys = @user.user_feedback_messages
forum_querys = @user.memo_messages
if User.current.id == @user.id
course_querys.update_all(:viewed => true)
forge_querys.update_all(:viewed => true)
user_querys.update_all(:viewed => true)
forum_querys.update_all(:viewed => true)
end
# if User.current.id == @user.id
# course_querys.update_all(:viewed => true)
# forge_querys.update_all(:viewed => true)
# user_querys.update_all(:viewed => true)
# forum_querys.update_all(:viewed => true)
# end
@new_message_count = @user.forge_messages.count + @user.memo_messages.count + @user.course_messages.count + @user.user_feedback_messages.count
case params[:type]
when nil

View File

@ -572,6 +572,16 @@ ActiveRecord::Schema.define(:version => 20150824092300) do
t.datetime "updated_at", :null => false
end
create_table "forum_messages", :force => true do |t|
t.integer "user_id"
t.integer "forum_id"
t.integer "memo_message_id"
t.string "memo_message_type"
t.integer "viewed"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.text "description"