Commit fe697aec authored by 神楽坂玲奈's avatar 神楽坂玲奈

临时提交

parent 27403848
......@@ -53,8 +53,8 @@ class DuelsController < ApplicationController
@duel.winreason = params[:duel][:winreason]
@duel.replay = params[:duel][:replay]
@duel.version = params[:duel][:version]
@duel.user1 = User.find_by_name params[:duel][:user1_name] if params[:duel][:user1_name]
@duel.user2 = User.find_by_name params[:duel][:user2_name] if params[:duel][:user2_name]
@duel.user1 = User.find_or_create_by_name params[:duel][:user1_name] if params[:duel][:user1_name]
@duel.user2 = User.find_or_create_by_name params[:duel][:user2_name] if params[:duel][:user2_name]
[params[:duel][:user1_main], params[:duel][:user1_extra], params[:duel][:user2_main], params[:duel][:user2_extra]].each_with_index do |cards, index|
user = index / 2 == 0 ? @duel.user1 : @duel.user2
main = index % 2 == 0
......
......@@ -2,13 +2,22 @@ class MycardController < ApplicationController
def update
result = []
version = params[:version]
loop do
new_version = false
Dir.glob('public/mycard/mycard-update-*-*.zip') do |file|
if file =~ /mycard-update-(.+?)-(.+?).zip/
if $1 <= version and $2 > version
version = $2
result << "http://card.touhou.cc/mycard/#{$&}"
new_version = true
break
end
end
end
if !new_version
break
end
end
respond_to do |format|
format.json { render json: result }
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