1、修复课程img_url为空问题。2、补上用户课程接口
This commit is contained in:
parent
1686ed4fbd
commit
d407f8656d
|
@ -49,6 +49,18 @@ module Mobile
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc '获取用户课程'
|
||||||
|
params do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
get ':id/courses' do
|
||||||
|
us = UsersService.new
|
||||||
|
ue = us.user_courses_list params,current_user.nil? ? User.find(2):current_user
|
||||||
|
present :data, ue,with: Mobile::Entities::Course
|
||||||
|
present :status, 0
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
desc '修改密码'
|
desc '修改密码'
|
||||||
params do
|
params do
|
||||||
|
|
|
@ -10,7 +10,8 @@ module Mobile
|
||||||
c = f[:course]
|
c = f[:course]
|
||||||
end
|
end
|
||||||
if field == :img_url
|
if field == :img_url
|
||||||
f.img_url if f.respond_to?(:img_url)
|
f[field] if f.is_a?(Hash) && f.key?(field)
|
||||||
|
#f.img_url if f.respond_to?(:img_url)
|
||||||
else
|
else
|
||||||
(c[field] if (c.is_a?(Hash) && c.key?(field))) || (c.send(field) if c.respond_to?(field))
|
(c[field] if (c.is_a?(Hash) && c.key?(field))) || (c.send(field) if c.respond_to?(field))
|
||||||
end
|
end
|
||||||
|
|
|
@ -146,7 +146,11 @@ class UsersService
|
||||||
membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
||||||
end
|
end
|
||||||
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
|
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
|
||||||
membership
|
course_list = []
|
||||||
|
membership.each do |mp|
|
||||||
|
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course)}
|
||||||
|
end
|
||||||
|
course_list
|
||||||
end
|
end
|
||||||
|
|
||||||
#修改密码
|
#修改密码
|
||||||
|
|
Loading…
Reference in New Issue