修正搜索用户接口,添加课程动态接口
This commit is contained in:
parent
3c8f851c37
commit
cc83b30fc6
|
@ -209,6 +209,16 @@ module Mobile
|
|||
present :status, 0
|
||||
end
|
||||
|
||||
desc '课程动态'
|
||||
params do
|
||||
requires :token, type: String
|
||||
end
|
||||
get "course_dynamic/:id" do
|
||||
cs = CoursesService.new
|
||||
count = cs.course_dynamic(params,current_user)
|
||||
present :data, count
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,13 +22,15 @@ module Mobile
|
|||
|
||||
desc "显示用户"
|
||||
params do
|
||||
|
||||
requires :id, type: Integer
|
||||
end
|
||||
get ':id' do
|
||||
us = UsersService.new
|
||||
ue = us.show_user params
|
||||
present :data, ue,with: Mobile::Entities::User
|
||||
present :status, 0
|
||||
route_param :id do
|
||||
get do
|
||||
us = UsersService.new
|
||||
ue = us.show_user params
|
||||
present :data, ue,with: Mobile::Entities::User
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
||||
desc "修改用户"
|
||||
|
@ -81,7 +83,7 @@ module Mobile
|
|||
params do
|
||||
requires :name, type: String, desc: '用户名关键字'
|
||||
end
|
||||
get 'search' do
|
||||
get 'search/search_user' do
|
||||
us = UsersService.new
|
||||
user = us.search_user params
|
||||
present :data, user, with: Mobile::Entities::User
|
||||
|
|
|
@ -2,6 +2,7 @@ class CoursesService
|
|||
include ApplicationHelper
|
||||
include CoursesHelper
|
||||
include HomeworkAttachHelper
|
||||
include ApiHelper
|
||||
#TODO:尚未整合权限系统
|
||||
#参数school_id为0或不传时返回所有课程,否则返回对应学校的课程
|
||||
#参数per_page_count分页功能,每页显示的课程数
|
||||
|
@ -326,6 +327,11 @@ class CoursesService
|
|||
end
|
||||
end
|
||||
|
||||
def course_dynamic params,current_user
|
||||
count = get_course_anonymous_evaluation current_user,params[:id]
|
||||
count
|
||||
end
|
||||
|
||||
private
|
||||
def show_homework_info course,bid,current_user,is_course_teacher
|
||||
author = bid.author.lastname + bid.author.firstname
|
||||
|
@ -361,4 +367,6 @@ class CoursesService
|
|||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation}
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
Loading…
Reference in New Issue