|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
class HacksController < ApplicationController
|
|
|
|
|
before_action :require_login, except: [:index]
|
|
|
|
|
before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set, :destroy]
|
|
|
|
|
before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set, :destroy, :cancel_publish]
|
|
|
|
|
before_action :require_teacher_identity, only: [:create]
|
|
|
|
|
before_action :require_auth_identity, only: [:update, :edit, :publish, :update_set, :delete_set, :destroy]
|
|
|
|
|
before_action :require_auth_identity, only: [:update, :edit, :publish, :update_set, :delete_set, :destroy, :cancel_publish]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 开启编程,如果第一次开启,创建一条记录,如果已经开启过的话,直接返回标识即可
|
|
|
|
@ -99,6 +99,12 @@ class HacksController < ApplicationController
|
|
|
|
|
render_ok
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 取消发布
|
|
|
|
|
def cancel_publish
|
|
|
|
|
@hack.update_attribute(:status, 0)
|
|
|
|
|
render_ok
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 发布列表
|
|
|
|
|
def unpulished_list
|
|
|
|
|
limit = params[:limit] || 16
|
|
|
|
|