新增:同步acge用户记录在册

This commit is contained in:
yystopf 2024-03-21 16:58:27 +08:00
parent 6e2816af75
commit c999d37f7e
1 changed files with 5 additions and 2 deletions

View File

@ -33,8 +33,11 @@ class Oauth::AcgeController < Oauth::BaseController
username = uid[0..7] username = uid[0..7]
password = SecureRandom.hex(4) password = SecureRandom.hex(4)
reg_result = autologin_register(username, email, password, 'acge', phone, name) reg_result = autologin_register(username, email, password, 'acge', phone, name)
CSV.open("public/操作系统大赛用户信息.csv", 'wb') do |csv| existing_rows = CSV.read("public/操作系统大赛用户信息.csv")
csv << [username, email, password, phone, name] 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 end
if reg_result[:message].blank? if reg_result[:message].blank?
open_user = OpenUsers::Acge.create!(user_id: reg_result[:user][:id], uid: uid) open_user = OpenUsers::Acge.create!(user_id: reg_result[:user][:id], uid: uid)