更新新闻viewed字段

This commit is contained in:
ouyangxuhua 2015-08-24 17:44:13 +08:00
parent 4d0abbc4d3
commit bf596d7b4b
1 changed files with 12 additions and 0 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]