From c999d37f7ebbbdabcd55c20fddbbf6be77f58f9f Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 21 Mar 2024 16:58:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=90=8C=E6=AD=A5ac?= =?UTF-8?q?ge=E7=94=A8=E6=88=B7=E8=AE=B0=E5=BD=95=E5=9C=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/oauth/acge_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/oauth/acge_controller.rb b/app/controllers/oauth/acge_controller.rb index d9db8a895..73360cf6c 100644 --- a/app/controllers/oauth/acge_controller.rb +++ b/app/controllers/oauth/acge_controller.rb @@ -33,8 +33,11 @@ class Oauth::AcgeController < Oauth::BaseController username = uid[0..7] password = SecureRandom.hex(4) reg_result = autologin_register(username, email, password, 'acge', phone, name) - CSV.open("public/操作系统大赛用户信息.csv", 'wb') do |csv| - csv << [username, email, password, phone, name] + existing_rows = CSV.read("public/操作系统大赛用户信息.csv") + new_row = [username, email, password, phone, name] + existing_rows << new_row + CSV.open("public/操作系统大赛用户信息.csv", 'w') do |csv| + existing_rows.each { |row| csv << row } end if reg_result[:message].blank? open_user = OpenUsers::Acge.create!(user_id: reg_result[:user][:id], uid: uid)