From c6f4da31879350a1c58c34a11270b3ee9c0700d4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:07:59 +0800 Subject: [PATCH] 1 --- app/api/mobile/api.rb | 2 +- app/api/mobile/apis/cnmooc.rb | 4 +++- app/controllers/account_controller.rb | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index bce3f24f..0be7d4b2 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -34,7 +34,7 @@ module Mobile version 'v1', using: :path format :json content_type :json, "application/json;charset=UTF-8" - use ActionDispatch::Session::CookieStore, key: '_educoder_session' + use ActionDispatch::Session::CookieStore require 'digest' use Mobile::Middleware::ErrorHandler diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index d67a390d..06467765 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -43,11 +43,13 @@ module Mobile requires :accessType, type: Integer, desc: "资源类型" end get "source_url" do + if session[:third_party_user_id].blank? user = User.find(params[:userId]) session[:third_party_user_id] = user.user_source.id + #self.logged_user = user end - + Rails.logger.info("####session: #{session}") CnmoocsService.new.source_url(params) end diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 60096a22..6409114f 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -293,6 +293,7 @@ class AccountController < ApplicationController UserActions.create(:action_id => User.current.id, :action_type => "Logout", :user_id => User.current.id) logout_user # 记录用户登出行为 + logger.info("#########logout_session: #{session}") redirect_to home_path end # display the logout form