@ -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
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: "资源类型"
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
CnmoocsService.new.source_url(params)
@ -115,11 +115,6 @@ class CnmoocsService
def source_url(params)
shixun = Shixun.find_by_identifier(params[:resouceId])
if shixun.blank?
return { error: -1, messages: '资源不存在' }