关闭匿评

This commit is contained in:
z9hang 2015-01-21 15:37:59 +08:00
parent 89e0f98034
commit b6207c0a47
2 changed files with 19 additions and 1 deletions

View File

@ -35,7 +35,7 @@ module Mobile
params do
requires :token, type: String
end
post ':id/alert_homework_anonymous_comment' do
post ':id/start_anonymous_comment' do
statue = Homeworks.get_service.start_anonymous_comment params,current_user.nil? ? User.find(2):current_user
messages = ""
case statue
@ -50,6 +50,15 @@ module Mobile
present :status, statue
end
desc "关闭匿评"
params do
requires :token, type: String
end
post ':id/stop_anonymous_comment' do
Homeworks.get_service.stop_anonymous_comment params,current_user.nil? ? User.find(2):current_user
present :status, 0
end
end
end
end

View File

@ -86,6 +86,15 @@ class HomeworkService
end
@statue
end
#关闭匿评
def stop_anonymous_comment params,current_user
@bid = Bid.find(params[:id])
@course = @bid.courses.first
unless is_course_teacher(current_user,@course) || current_user.admin?
raise '403'
end
@bid.update_column('comment_status', 2)
end
# 匿评作品详情
# attachs 该作品的所有附件