更新新闻viewed字段
This commit is contained in:
parent
4d0abbc4d3
commit
bf596d7b4b
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue