pre_develop
daiao 6 years ago
parent c6f4da3187
commit c3c0b8db98

@ -43,13 +43,6 @@ module Mobile
requires :accessType, type: Integer, desc: "资源类型" requires :accessType, type: Integer, desc: "资源类型"
end end
get "source_url" do 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) CnmoocsService.new.source_url(params)
end end

@ -115,6 +115,9 @@ class CnmoocsService
end end
def source_url(params) def source_url(params)
user_source = UserSource.find_by_user_id(params[:userId])
return {error: -1, messages: "用户不存在,请先创建用户"} if user_source
self.logged_user = user_source.user
shixun = Shixun.find_by_id(params[:resouceId]) shixun = Shixun.find_by_id(params[:resouceId])
if shixun.blank? if shixun.blank?
return { error: -1, messages: '资源不存在' } return { error: -1, messages: '资源不存在' }

Loading…
Cancel
Save