From efca75399436c2107ce340c7af801938acdbc548 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 4 Apr 2019 18:09:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E6=90=9C=E7=B4=A2500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 0d17ccf6..3881dd3d 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -158,7 +158,11 @@ class ManagementsController < ApplicationController @sub_type = 8 @g = Gitlab.client if params[:search] - myshixun_id = Game.where("identifier = #{params[:search]} or id = #{params[:search]}").pluck(:myshixun_id) + if params[:search].to_i.to_s == params[:search].to_s + myshixun_id = Game.where(:myshixun_id => params[:search].to_i).pluck(:myshixun_id) + else + myshixun_id = Game.where(:identifier => params[:search]).pluck(:myshixun_id) + end @myshixuns = Myshixun.where(:id => myshixun_id).includes(:shixun) else @myshixuns = Myshixun.where("0=0").includes(:shixun)