diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c1c25151..435c71fc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -132,16 +132,6 @@ class ApplicationController < ActionController::Base 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 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 || diff --git a/app/services/games_service.rb b/app/services/games_service.rb index 91645e84..b858abe6 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -1039,6 +1039,15 @@ class GamesService end 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 user_info = []