|
|
@ -132,16 +132,6 @@ class ApplicationController < ActionController::Base
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
|
|
|
|
|
|
|
|
# 随机生成字符
|
|
|
|
|
|
|
|
def generates_identifier(container, num)
|
|
|
|
|
|
|
|
code = DCODES.sample(num).join
|
|
|
|
|
|
|
|
while container.exists?(identifier: code) do
|
|
|
|
|
|
|
|
code = DCODES.sample(num).join
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
code
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def ec_public_auth major_school
|
|
|
|
def ec_public_auth major_school
|
|
|
|
unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 ||
|
|
|
|
unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 ||
|
|
|
|
major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0 ||
|
|
|
|
major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0 ||
|
|
|
|