Commit 6a349380 authored by 神楽坂玲奈's avatar 神楽坂玲奈

在线大厅fix

parent e48c15c5
#encoding: UTF-8 #encoding: UTF-8
class RoomsController < ApplicationController class RoomsController < ApplicationController
User_Filter = /\[(\d+),(.+?),(-1|0)\]/ User_Filter = /\[(\d+),(.+?)(?:,(-1|0)|)\]/
Room_Filter = /\[(\d+),(.+?),(wait|start)(#{User_Filter}+?)\]/ Room_Filter = /\[(\d+),(.+?),(wait|start)(#{User_Filter}+?)\]/
require 'open-uri' require 'open-uri'
layout 'losses' layout 'losses'
...@@ -16,11 +16,16 @@ class RoomsController < ApplicationController ...@@ -16,11 +16,16 @@ class RoomsController < ApplicationController
room = {id: id.to_i, name: name, status: status} room = {id: id.to_i, name: name, status: status}
room[:users] = [] room[:users] = []
users.scan(User_Filter) do |player, name, certified| users.scan(User_Filter) do |player, name, certified|
if certified=="-1" certified = if certified.nil?
name[-5,5] != "(未认证)"
else
certified == "-1"
end
if certified
user = User.find_by_name(name) user = User.find_by_name(name)
user = {player: player.to_i, id: user ? user.id : 0, name: name, certified: true} user = {player: player.to_i, id: user ? user.id : 0, name: name, certified: true}
else else
user = {player: player.to_i, id: 0, name: name, certified: certified=="-1"} user = {player: player.to_i, id: 0, name: name, certified: false}
end end
room[:users] << user room[:users] << user
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment