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