Browse Source

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

pull/347/head
yystopf 2 years ago
parent
commit
c999d37f7e
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      app/controllers/oauth/acge_controller.rb

+ 5
- 2
app/controllers/oauth/acge_controller.rb View File

@@ -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)


Loading…
Cancel
Save