fix session

pre_develop
p31729568 6 years ago
parent b4ec3363ef
commit 1fb7c35c30

@ -109,6 +109,12 @@ module Mobile
return uw.user if uw
end
third_party_user_id = session[:third_party_user_id]
if third_party_user_id
c_user = UserSource.find_by_id(session[:third_party_user_id])
return c_user.user if c_user
end
token = ApiKey.where(access_token: params[:token]).first
if token && !token.expired?
return User.find(token.user_id)

@ -43,6 +43,11 @@ 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
end
CnmoocsService.new.source_url(params)
end

@ -115,11 +115,6 @@ class CnmoocsService
end
def source_url(params)
if session[:third_party_user_id].blank?
user = User.find(params[:userId])
session[:third_party_user_id] = user.user_source.id
end
shixun = Shixun.find_by_identifier(params[:resouceId])
if shixun.blank?
return { error: -1, messages: '资源不存在' }

Loading…
Cancel
Save