From 407f5615f22797fc133b8033542ea58b839e0a01 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 24 May 2019 10:24:37 +0800 Subject: [PATCH] =?UTF-8?q?identifier=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 10 ---------- app/services/games_service.rb | 9 +++++++++ 2 files changed, 9 insertions(+), 10 deletions(-) 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 = []