diff --git a/app/models/user.rb b/app/models/user.rb index 5c22f46e7..b3a1da84d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -655,6 +655,7 @@ class User < ApplicationRecord # 邮箱:w***l@qq.com def hidden_mail + Rails.logger.info("######-----: #{mail}") Util.conceal(mail, :email).to_s end diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index e6c089ac2..b32c87c4e 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -3,7 +3,7 @@ class Videos::DispatchCallbackService < ApplicationService def initialize(params) @video = Video.find_by(uuid: params[:VideoId]) - @params = params`` + @params = params end def call diff --git a/lib/tasks/tfxy.rake b/lib/tasks/tfxy.rake index db929127c..f1644e320 100644 --- a/lib/tasks/tfxy.rake +++ b/lib/tasks/tfxy.rake @@ -18,7 +18,12 @@ namespace :tfxy do teach_data_last_row = teach_data.last_row 2.upto(teach_data_last_row) do |r| - old_user = User.where("phone = '#{teach_data.cell(r, 5)}' OR mail = '#{teach_data.cell(r, 6)}' OR login = 'tfxy#{teach_data.cell(r, 1)}' " ).first + + if teach_data.cell(r, 6).to_s&.strip.present? + old_user = User.where("phone = '#{teach_data.cell(r, 5)}' OR mail = '#{teach_data.cell(r, 6).to_s.strip}' OR login = 'tfxy#{teach_data.cell(r, 1)}' " ).first + else + old_user = User.where("phone = '#{teach_data.cell(r, 5)}' OR login = 'tfxy#{teach_data.cell(r, 1)}' ").first + end if !old_user.present? user = User.new( @@ -29,7 +34,7 @@ namespace :tfxy do lastname: teach_data.cell(r, 2), nickname: teach_data.cell(r, 2), password: "Edu#{teach_data.cell(r, 5)}", - mail: teach_data.cell(r, 6), + mail: teach_data.cell(r, 6).to_s&.strip.present? ? teach_data.cell(r, 6).to_s&.strip : nil, profile_completed: true, professional_certification: 1, certification: 1, @@ -157,8 +162,8 @@ namespace :tfxy do 2.upto(student_data_last_row) do |r| # 邮箱存在 - if student_data.cell(r, 9).strip.present? - old_user = User.where("phone = '#{student_data.cell(r, 8)}' OR mail = '#{student_data.cell(r, 9).strip}' OR login = 'tfxy#{student_data.cell(r, 1)}' " ).first + if student_data.cell(r, 9).to_s&.strip.present? + old_user = User.where("phone = '#{student_data.cell(r, 8)}' OR mail = '#{student_data.cell(r, 9).to_s.strip}' OR login = 'tfxy#{student_data.cell(r, 1)}' " ).first else old_user = User.where("phone = '#{student_data.cell(r, 8)}' OR login = 'tfxy#{student_data.cell(r, 1)}' " ).first end @@ -172,7 +177,7 @@ namespace :tfxy do lastname: student_data.cell(r, 2), nickname: student_data.cell(r, 2), password: "Edu#{student_data.cell(r, 1)}", - mail: student_data.cell(r, 9).strip, + mail: student_data.cell(r, 9).to_s&.strip.present? ? student_data.cell(r, 9).to_s&.strip : nil, profile_completed: true, professional_certification: 1, certification: 1, @@ -205,13 +210,12 @@ namespace :tfxy do else # 系统已有用户,关联sso认证用户 old_user.update( - login: "tfxy#{student_data.cell(r, 1)}", - lastname: student_data.cell(r, 2), - nickname: student_data.cell(r, 2), - certification: true, - professional_certification: true, - authentication: true, - profile_completed: true) + lastname: student_data.cell(r, 2), + nickname: student_data.cell(r, 2), + certification: true, + professional_certification: true, + authentication: true, + profile_completed: true) OpenUsers::Cas.find_or_create_by(uid: student_data.cell(r, 1)) do |u| u.extra = {phone: student_data.cell(r, 8)}