identifier生成

dev_trainings
jingquan huang 6 years ago
parent 346850df2b
commit 407f5615f2

@ -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 ||

@ -1039,6 +1039,15 @@ class GamesService
end end
private private
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 format_answer_list games def format_answer_list games
user_info = [] user_info = []

Loading…
Cancel
Save