From af59295d6ca58b6b7d09a6734b47347578879337 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 13 Jul 2019 14:41:41 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 55 ++++++----------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e6c0116fc..c9c2d90e8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -147,20 +147,7 @@ class ApplicationController < ActionController::Base # 前端会捕捉401,弹登录弹框 # 未授权的捕捉407,弹试用申请弹框 def require_login - #6.13 -hs - if User.current.logged? - if !current_user.profile_completed? - info_url = "#{edu_setting('old_edu_host')}/account/user_info" - tip_exception(402, info_url) - # render :json => { status: 402, url: info_url } - elsif current_user.certification != 1 - day_cer = UserDayCertification.where(user_id: current_user.id).last - tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 - end - else - tip_exception(401, "..") - end - + tip_exception(401, "..") unless User.current.logged? end # 异常提醒 @@ -190,33 +177,19 @@ class ApplicationController < ActionController::Base # 系统全局认证 # def check_auth - # old_edu_host = edu_setting('old_edu_host') - # ue = current_user.user_extension - # - # if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank? - # info_url = old_edu_host + '/account/user_info' - # render :json => { status: 402, url: info_url } - # elsif current_user.certification != 1 - # day_cer = UserDayCertification.where(user_id: current_user.id).last - # unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 - # account_url = old_edu_host + "/my/account" - # render :json => { status: 402, url: account_url } - # end - # end - true - end - - # 身份资料的认证: - # 如果试用过期则弹框提示认证,先跳入个人资料页面完善资料,资料完成后,弹框提醒用户试用申请 - def check_account - # # todo user_extension - # if User.current.logged? - # ue = current_user.user_extension - # if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank? - # info_url = "#{edu_setting('old_edu_host')}/account/user_info" - # render :json => { status: 402, url: info_url } - # end - # end + if User.current.logged? + if !current_user.profile_completed? + info_url = '/account/user_info' + tip_exception(402, info_url) + elsif current_user.certification != 1 + day_cer = UserDayCertification.where(user_id: current_user.id).last + unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 + tip_exception(407, "系统未授权") + end + end + else + tip_exception(401, "..") + end end def start_user_session(user) From 0061eff0f2a9511fd68322918cc77ce5b39bf63e Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 13 Jul 2019 14:53:18 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E6=88=96?= =?UTF-8?q?=E8=80=85=E6=9C=AA=E6=B3=A8=E5=86=8C=E5=85=81=E8=AE=B8=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E5=AE=9E=E8=AE=AD=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index e4d18316e..3b3e0478a 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -1,6 +1,6 @@ class ShixunsController < ApplicationController before_action :require_login, except: [:download_file, :index, :menus] - before_action :check_auth, except: [:download_file, :index] + before_action :check_auth, except: [:download_file, :index, :menus] before_action :find_shixun, :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics, :departments, :apply_shixun_mirror, From fbdd7b0a718aa0d808d4ae5849e8b62d7f6398b3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 13 Jul 2019 14:59:23 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=8F=91=E9=80=81=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/educoder/sms.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/educoder/sms.rb b/lib/educoder/sms.rb index 237b270d5..5ba273aa8 100644 --- a/lib/educoder/sms.rb +++ b/lib/educoder/sms.rb @@ -28,6 +28,8 @@ module Educoder def self.sendYunpian(mobile, code, send_type, name, user_name, result) #修改为您的apikey.可在官网(http://www.yunpian.com)登录后用户中心首页看到 apikey = EduSetting.get('sms_apikey') + Rails.logger.info("#####apikey: #{apikey}") + Rails.logger.info("#####mobile: #{mobile}") #指定模板发送接口HTTP地址 send_tpl_sms_uri = URI.parse('https://sms.yunpian.com/v2/sms/single_send.json') @@ -70,6 +72,7 @@ module Educoder response = http.start { |http| http.request(request) } ActiveSupport::JSON.decode(response.body) rescue =>err + Rails.logger.error("#############sendYunpian_error: #{err.message}") return nil end end From cb0ce291a13ac614530bddc70f6403a8770e3f19 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 13 Jul 2019 15:15:31 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/educoder/sms.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/educoder/sms.rb b/lib/educoder/sms.rb index 5ba273aa8..cadce7465 100644 --- a/lib/educoder/sms.rb +++ b/lib/educoder/sms.rb @@ -28,8 +28,6 @@ module Educoder def self.sendYunpian(mobile, code, send_type, name, user_name, result) #修改为您的apikey.可在官网(http://www.yunpian.com)登录后用户中心首页看到 apikey = EduSetting.get('sms_apikey') - Rails.logger.info("#####apikey: #{apikey}") - Rails.logger.info("#####mobile: #{mobile}") #指定模板发送接口HTTP地址 send_tpl_sms_uri = URI.parse('https://sms.yunpian.com/v2/sms/single_send.json') From d6bf075d49af1b61b04cdb83b58763063e00674a Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 13 Jul 2019 15:28:17 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=AE=A4=E8=AF=81url?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E5=8F=8A=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c9c2d90e8..b8fe7d723 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -179,7 +179,7 @@ class ApplicationController < ActionController::Base def check_auth if User.current.logged? if !current_user.profile_completed? - info_url = '/account/user_info' + info_url = '/account/profile' tip_exception(402, info_url) elsif current_user.certification != 1 day_cer = UserDayCertification.where(user_id: current_user.id).last