2014-12-10 18:26:38 +08:00
|
|
|
|
#coding=utf-8
|
2014-11-27 19:43:04 +08:00
|
|
|
|
module Mobile
|
2014-12-09 15:16:47 +08:00
|
|
|
|
module Apis
|
2014-12-09 16:36:43 +08:00
|
|
|
|
class Courses < Grape::API
|
|
|
|
|
resource :courses do
|
2015-07-16 17:56:35 +08:00
|
|
|
|
def self.get_service
|
|
|
|
|
CoursesService.new
|
|
|
|
|
end
|
2014-12-10 16:23:56 +08:00
|
|
|
|
desc "获取所有课程"
|
2014-12-09 16:36:43 +08:00
|
|
|
|
params do
|
2014-12-10 16:23:56 +08:00
|
|
|
|
optional :school_id, type: Integer, desc: '传入学校id,返回该学校课程列表'
|
|
|
|
|
requires :per_page_count, type: Integer, desc: '每页总数'
|
|
|
|
|
requires :page, type: Integer, desc: '当前页码'
|
2015-02-10 17:03:59 +08:00
|
|
|
|
optional :token, type: String
|
2014-12-08 16:51:21 +08:00
|
|
|
|
end
|
2014-11-27 19:43:04 +08:00
|
|
|
|
get do
|
2016-06-27 11:09:25 +08:00
|
|
|
|
authenticate!
|
2014-12-09 16:36:43 +08:00
|
|
|
|
cs = CoursesService.new
|
2016-06-27 16:03:07 +08:00
|
|
|
|
courses = cs.user_courses_list(current_user)
|
2014-12-09 16:36:43 +08:00
|
|
|
|
present :data, courses, with: Mobile::Entities::Course
|
|
|
|
|
present :status, 0
|
2014-11-27 19:43:04 +08:00
|
|
|
|
end
|
|
|
|
|
|
2015-01-20 15:17:02 +08:00
|
|
|
|
desc "新建课程"
|
2015-01-04 11:53:16 +08:00
|
|
|
|
#current_user当前用户对象(不是id)
|
|
|
|
|
# params[:course][:name]:课程名称
|
|
|
|
|
#params[:course][:password]:密码
|
|
|
|
|
#params[:course][:description]:描述
|
|
|
|
|
#params[:course][:is_public]:是否公开1公开,0私有
|
|
|
|
|
#params[:course][:open_student]:是否公开学生列表1公开,0不公开,不公开时非课程成员无法看到学生列表
|
|
|
|
|
#params[:course][:course_type]:暂时默认给1值。
|
|
|
|
|
#params[:term]:学期(秋季学期或春季学期)
|
|
|
|
|
#params[:time]: 年份(例:2014)
|
|
|
|
|
#params[:setup_time]:暂不传(貌似已经没用了)
|
|
|
|
|
#params[:endup_time]: 暂不传(貌似已经没用了)
|
|
|
|
|
#params[:class_period]:学时总数
|
2014-12-13 21:52:26 +08:00
|
|
|
|
params do
|
2015-01-04 11:53:16 +08:00
|
|
|
|
requires :token, type: String
|
|
|
|
|
requires :name, type: String, desc: '课程名称'
|
|
|
|
|
requires :password, type: String, desc: '密码'
|
|
|
|
|
requires :description, type: String, desc: '描述'
|
|
|
|
|
requires :is_public, type: Integer, desc: '是否公开 1公开 0私有'
|
|
|
|
|
requires :open_student, type: Integer, desc: '是否公开学生列表1公开,0不公开,不公开时非课程成员无法看到学生列表'
|
|
|
|
|
requires :course_type, type:Integer, desc: '暂时传1'
|
2015-01-05 10:15:14 +08:00
|
|
|
|
requires :term, type: String, desc: '学期(秋季学期或春季学期)'
|
2015-01-04 11:53:16 +08:00
|
|
|
|
requires :time, type: String, desc: '年份'
|
|
|
|
|
requires :class_period, type: String, desc: '学时总数'
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
|
|
|
|
post do
|
2015-01-04 11:53:16 +08:00
|
|
|
|
authenticate!
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
cs_params = {
|
|
|
|
|
course: params.reject{|k,v| [:term,:time,:class_period].include?(k)},
|
|
|
|
|
term: params[:term],
|
|
|
|
|
time: params[:time],
|
|
|
|
|
class_period: params[:class_period]
|
|
|
|
|
}
|
|
|
|
|
courses = cs.create_course(cs_params, current_user)
|
|
|
|
|
present :data, courses, with: Mobile::Entities::Course
|
|
|
|
|
present :status, 0
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
|
|
|
|
|
2015-01-20 15:17:02 +08:00
|
|
|
|
desc "编辑课程"
|
2014-12-13 21:52:26 +08:00
|
|
|
|
params do
|
2015-01-04 11:53:16 +08:00
|
|
|
|
requires :token, type: String
|
|
|
|
|
requires :course_id, type: Integer, desc: '课程id'
|
|
|
|
|
requires :name, type: String, desc: '课程名称'
|
|
|
|
|
requires :password, type: String, desc: '密码'
|
|
|
|
|
requires :description, type: String, desc: '描述'
|
|
|
|
|
requires :is_public, type: Integer, desc: '是否公开 1公开 0私有'
|
|
|
|
|
requires :open_student, type: Integer, desc: '是否公开学生列表1公开,0不公开,不公开时非课程成员无法看到学生列表'
|
|
|
|
|
requires :course_type, type:Integer, desc: '暂时传1'
|
2015-01-05 17:47:04 +08:00
|
|
|
|
requires :term, type: String, desc: '学期(秋季学期或春季学期)'
|
2015-01-04 11:53:16 +08:00
|
|
|
|
requires :time, type: String, desc: '年份'
|
|
|
|
|
requires :class_period, type: String, desc: '学时总数'
|
|
|
|
|
end
|
2015-01-05 17:45:47 +08:00
|
|
|
|
put do
|
2015-01-04 11:53:16 +08:00
|
|
|
|
authenticate!
|
2015-01-05 17:47:04 +08:00
|
|
|
|
cs = CoursesService.new
|
2015-01-04 11:53:16 +08:00
|
|
|
|
cs_params = {
|
|
|
|
|
course: params.reject{|k,v| [:term,:time,:class_period].include?(k)},
|
|
|
|
|
term: params[:term],
|
|
|
|
|
time: params[:time],
|
|
|
|
|
class_period: params[:class_period]
|
|
|
|
|
}
|
|
|
|
|
course = ::Course.find(params[:course_id])
|
2015-04-09 16:05:51 +08:00
|
|
|
|
# 如果没有传密码过来,那就把原来的密码给上,不然会不更新
|
|
|
|
|
if params[:password].nil? || params[:password].blank?
|
|
|
|
|
cs_params[:course][:password] = course[:password]
|
|
|
|
|
end
|
2015-01-04 11:53:16 +08:00
|
|
|
|
cs.edit_course_authorize(current_user,course)
|
2015-01-05 17:47:04 +08:00
|
|
|
|
course = cs.edit_course(cs_params, course,current_user)
|
2015-01-04 11:53:16 +08:00
|
|
|
|
present :data, course, with: Mobile::Entities::Course
|
|
|
|
|
present :status, 0
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
|
|
|
|
post do
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "加入课程"
|
|
|
|
|
params do
|
2016-06-22 16:42:20 +08:00
|
|
|
|
requires :token, type: String
|
2016-06-15 13:44:28 +08:00
|
|
|
|
requires :invite_code, type: String, desc: '邀请码'
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
2016-06-15 13:44:28 +08:00
|
|
|
|
post "join" do
|
2014-12-13 21:52:26 +08:00
|
|
|
|
authenticate!
|
|
|
|
|
cs = CoursesService.new
|
2016-06-24 17:35:55 +08:00
|
|
|
|
status = cs.join_course({role: "10", openid: params[:openid], invite_code: params[:invite_code]}, current_user)
|
2016-06-15 13:44:28 +08:00
|
|
|
|
{
|
|
|
|
|
status: status[:state],
|
|
|
|
|
messsge:CoursesService::JoinCourseError.message(status[:state])
|
|
|
|
|
}
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
|
|
|
|
|
2016-06-15 13:44:28 +08:00
|
|
|
|
|
2014-12-13 21:52:26 +08:00
|
|
|
|
desc "退出课程"
|
|
|
|
|
params do
|
2015-01-04 11:53:16 +08:00
|
|
|
|
requires :token, type: String
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
|
|
|
|
delete ":id" do
|
|
|
|
|
authenticate!
|
|
|
|
|
cs = CoursesService.new
|
2015-01-07 11:37:48 +08:00
|
|
|
|
status = cs.exit_course({:object_id => params[:id]}, current_user)
|
|
|
|
|
out = {status: status}
|
|
|
|
|
message = case status
|
|
|
|
|
when 0; "退出成功"
|
|
|
|
|
when 1; "您不在课程中"
|
|
|
|
|
when 2; "您还未登录"
|
|
|
|
|
else; "未知错误,请稍后再试"
|
|
|
|
|
end
|
|
|
|
|
out.merge(message: message)
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "搜索课程"
|
|
|
|
|
params do
|
|
|
|
|
requires :name, type: String, desc: "课程名"
|
2015-02-10 16:36:29 +08:00
|
|
|
|
optional :token, type: String
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
|
|
|
|
get 'search' do
|
|
|
|
|
cs = CoursesService.new
|
2015-02-10 16:36:29 +08:00
|
|
|
|
courses = cs.search_course(params,current_user.nil? ? User.find(2):current_user)
|
2014-12-13 21:52:26 +08:00
|
|
|
|
present :data, courses, with: Mobile::Entities::Course
|
|
|
|
|
present :status, 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "课程老师列表"
|
|
|
|
|
params do
|
2015-01-07 15:24:43 +08:00
|
|
|
|
requires :token, type: String
|
2014-12-13 21:52:26 +08:00
|
|
|
|
requires :course_id, type: Integer, desc: "课程id"
|
|
|
|
|
end
|
|
|
|
|
get 'teachers' do
|
|
|
|
|
cs = CoursesService.new
|
2015-01-07 15:24:43 +08:00
|
|
|
|
teachers = cs.course_teacher_or_student_list({role: '1'}, params[:course_id],current_user)
|
|
|
|
|
present :data, teachers, with: Mobile::Entities::User
|
|
|
|
|
present :status, 0
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "课程学生列表"
|
|
|
|
|
params do
|
2015-01-07 15:24:43 +08:00
|
|
|
|
requires :token, type: String
|
2014-12-13 21:52:26 +08:00
|
|
|
|
requires :course_id, type: Integer, desc: "课程id"
|
|
|
|
|
end
|
2015-01-07 15:24:43 +08:00
|
|
|
|
get 'students' do
|
2014-12-13 21:52:26 +08:00
|
|
|
|
cs = CoursesService.new
|
2015-01-07 15:24:43 +08:00
|
|
|
|
students = cs.course_teacher_or_student_list({role: '2'}, params[:course_id],current_user)
|
|
|
|
|
present :data, students, with: Mobile::Entities::User
|
|
|
|
|
present :status, 0
|
2014-12-13 21:52:26 +08:00
|
|
|
|
end
|
|
|
|
|
|
2015-05-13 09:56:34 +08:00
|
|
|
|
desc "设置教辅"
|
|
|
|
|
params do
|
2015-05-15 09:06:36 +08:00
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :user_id,type:Integer,desc: '用户id'
|
|
|
|
|
requires :course_id,type:Integer,desc:'课程id'
|
|
|
|
|
end
|
|
|
|
|
get 'set_user_as_assitant' do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
cs.set_as_assitant_teacher params
|
|
|
|
|
present :status, 0
|
2015-05-13 09:56:34 +08:00
|
|
|
|
end
|
|
|
|
|
|
2015-05-15 09:06:36 +08:00
|
|
|
|
desc "删除教辅"
|
|
|
|
|
params do
|
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :user_id,type:Integer,desc: '用户id'
|
|
|
|
|
requires :course_id,type:Integer,desc:'课程id'
|
|
|
|
|
end
|
|
|
|
|
get 'del_user_as_assitant' do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
cs.del_assitant_teacher params
|
|
|
|
|
present :status, 0
|
2015-05-13 09:56:34 +08:00
|
|
|
|
end
|
|
|
|
|
|
2014-12-10 16:23:56 +08:00
|
|
|
|
desc "返回单个课程"
|
2014-12-09 16:36:43 +08:00
|
|
|
|
params do
|
|
|
|
|
requires :id, type: Integer
|
2015-02-10 17:03:59 +08:00
|
|
|
|
optional :token, type: String
|
2014-12-09 16:36:43 +08:00
|
|
|
|
end
|
|
|
|
|
route_param :id do
|
|
|
|
|
get do
|
2016-06-24 09:01:12 +08:00
|
|
|
|
authenticate!
|
2014-12-15 16:53:20 +08:00
|
|
|
|
cs = CoursesService.new
|
2015-01-20 17:42:18 +08:00
|
|
|
|
course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user))
|
2014-12-15 16:53:20 +08:00
|
|
|
|
#course = Course.find(params[:id])
|
2015-02-10 17:03:59 +08:00
|
|
|
|
present :data, course, with: Mobile::Entities::Course
|
2015-05-15 09:06:36 +08:00
|
|
|
|
{ status: 0}
|
2014-12-09 16:36:43 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2015-01-20 15:17:02 +08:00
|
|
|
|
desc "课程作业列表"
|
|
|
|
|
params do
|
|
|
|
|
requires :token, type: String
|
|
|
|
|
end
|
|
|
|
|
get "homeworks/:id" do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
homeworks = cs.homework_list params,current_user
|
|
|
|
|
present :data, homeworks, with: Mobile::Entities::Homework
|
|
|
|
|
present :status, 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "课程通知列表"
|
|
|
|
|
params do
|
2015-02-04 11:57:37 +08:00
|
|
|
|
optional :token, type: String
|
2015-01-20 15:17:02 +08:00
|
|
|
|
end
|
|
|
|
|
get ":course_id/news" do
|
|
|
|
|
cs = CoursesService.new
|
2015-02-04 11:57:37 +08:00
|
|
|
|
news = cs.course_news_list params,current_user.nil? ? User.find(2):current_user
|
2015-01-20 15:17:02 +08:00
|
|
|
|
present :data, news, with: Mobile::Entities::News
|
|
|
|
|
present :status, 0
|
|
|
|
|
end
|
|
|
|
|
|
2015-01-20 17:42:18 +08:00
|
|
|
|
desc "显示课程通知"
|
|
|
|
|
params do
|
2015-02-04 14:07:00 +08:00
|
|
|
|
optional :token, type: String
|
2015-01-20 17:42:18 +08:00
|
|
|
|
end
|
|
|
|
|
get "news/:id" do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
cs.show_course_news_authorize(current_user.nil? ? User.find(2):current_user)
|
|
|
|
|
news = cs.show_course_news params,current_user.nil? ? User.find(2):current_user
|
|
|
|
|
present :data, news, with: Mobile::Entities::News
|
|
|
|
|
present :status, 0
|
|
|
|
|
end
|
|
|
|
|
|
2015-03-03 09:11:47 +08:00
|
|
|
|
desc '用户课程动态'
|
2015-02-06 14:29:42 +08:00
|
|
|
|
params do
|
|
|
|
|
requires :token, type: String
|
|
|
|
|
end
|
|
|
|
|
get "course_dynamic/:id" do
|
|
|
|
|
cs = CoursesService.new
|
2015-06-19 15:05:25 +08:00
|
|
|
|
count = cs.all_course_dynamics(params,current_user)
|
2015-02-06 15:52:34 +08:00
|
|
|
|
present :data, count, with: Mobile::Entities::CourseDynamic
|
2015-02-06 14:29:42 +08:00
|
|
|
|
present :status, 0
|
|
|
|
|
end
|
2015-01-20 15:17:02 +08:00
|
|
|
|
|
2015-04-29 17:46:39 +08:00
|
|
|
|
desc '课程课件'
|
|
|
|
|
params do
|
|
|
|
|
requires :token, type: String
|
|
|
|
|
requires :course_id,type: Integer,desc: '课程id'
|
2015-05-05 17:19:31 +08:00
|
|
|
|
optional :name,type:String,desc:'课件名称可能包含的字符'
|
2015-04-29 17:46:39 +08:00
|
|
|
|
end
|
2015-05-20 17:27:17 +08:00
|
|
|
|
post ":course_id/attachments" do
|
2015-04-29 17:46:39 +08:00
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
count = cs.course_attachments params
|
|
|
|
|
present :data, count, with: Mobile::Entities::Attachment
|
|
|
|
|
present :status, 0
|
|
|
|
|
end
|
|
|
|
|
|
2015-05-04 17:36:48 +08:00
|
|
|
|
desc '课程学生'
|
|
|
|
|
params do
|
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :course_id,type:Integer,desc: '课程id'
|
2016-01-22 17:27:21 +08:00
|
|
|
|
optional :name,type:String,desc:'学生的姓名或者登录名或者学号可能包含的字符'
|
2015-05-04 17:36:48 +08:00
|
|
|
|
end
|
|
|
|
|
get ":course_id/members" do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
count = cs.course_members params
|
2015-05-15 14:02:41 +08:00
|
|
|
|
# 我如果在学生当中,那么我将放在第一位
|
|
|
|
|
count.each do |m|
|
|
|
|
|
if m.user.id == current_user.id
|
|
|
|
|
count.delete m
|
|
|
|
|
count.unshift m
|
|
|
|
|
end
|
|
|
|
|
end
|
2015-05-04 17:36:48 +08:00
|
|
|
|
present :data, count, with: Mobile::Entities::Member
|
|
|
|
|
present :status, 0
|
|
|
|
|
end
|
|
|
|
|
|
2015-05-13 09:56:34 +08:00
|
|
|
|
desc '查看用户历次作业成绩'
|
|
|
|
|
params do
|
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :member_id,type:Integer,desc:'课程member_id'
|
|
|
|
|
optional :homeworkName,type:String,desc:'作业名称以及作业名称可能包含的字符'
|
|
|
|
|
end
|
|
|
|
|
get '/show_member_score/:member_id' do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
homeworkscore = cs.show_member_score params
|
|
|
|
|
present :data,homeworkscore,with: Mobile::Entities::Homeworkscore
|
|
|
|
|
present :status,0
|
|
|
|
|
end
|
2015-05-15 16:13:32 +08:00
|
|
|
|
|
|
|
|
|
desc '发布课程通知'
|
|
|
|
|
params do
|
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :course_id,type:Integer,desc:'课程id'
|
|
|
|
|
requires :title,type:String,desc:'通知标题'
|
|
|
|
|
requires :desc,type:String,desc:'通知描述'
|
|
|
|
|
end
|
|
|
|
|
post ':course_id/create_course_notice' do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
news = cs.create_course_notice params,current_user
|
|
|
|
|
present :data,news,with:Mobile::Entities::News
|
|
|
|
|
present :status,0
|
|
|
|
|
end
|
2015-07-01 16:56:03 +08:00
|
|
|
|
|
2015-07-08 17:36:17 +08:00
|
|
|
|
desc '总成绩 or 活跃度列表'
|
2015-07-01 16:56:03 +08:00
|
|
|
|
params do
|
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :course_id,type:Integer,desc:'课程id'
|
|
|
|
|
optional :page,type:Integer,desc:'页码'
|
2015-07-08 17:36:17 +08:00
|
|
|
|
optional :type,type:Integer,desc:'0是活跃度,1是成绩'
|
2015-07-01 16:56:03 +08:00
|
|
|
|
end
|
|
|
|
|
get ':course_id/students_score_list' do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
news = cs.students_score_list params,current_user
|
2015-07-09 14:32:10 +08:00
|
|
|
|
present :data,news[:user_list],with:Mobile::Entities::User
|
|
|
|
|
present :maxSize,news[:max_size]
|
|
|
|
|
present :status,0
|
2015-07-01 16:56:03 +08:00
|
|
|
|
end
|
2015-07-02 17:31:30 +08:00
|
|
|
|
|
|
|
|
|
desc '课程某次作业提交列表 并显示成绩'
|
|
|
|
|
params do
|
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :course_id,type:Integer,desc:'课程id'
|
|
|
|
|
requires :homework_id,type:Integer,desc:'作业id'
|
|
|
|
|
optional :page,type:Integer,desc:'页码'
|
|
|
|
|
end
|
|
|
|
|
get ':course_id/student_works_list' do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
student_works = cs.student_work_list params,current_user
|
2015-07-17 15:19:28 +08:00
|
|
|
|
present :data,student_works,with:Mobile::Entities::StudentWork
|
2015-07-16 17:56:35 +08:00
|
|
|
|
present :status,0
|
2015-07-02 17:31:30 +08:00
|
|
|
|
end
|
2015-07-03 12:22:33 +08:00
|
|
|
|
|
2015-07-16 17:56:35 +08:00
|
|
|
|
desc '讨论区信息'
|
|
|
|
|
params do
|
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :course_id,type:Integer,desc:'课程id'
|
|
|
|
|
optional :page,type:Integer,desc:'页码'
|
|
|
|
|
end
|
|
|
|
|
get ':course_id/board_message_list' do
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
board_messages_list = cs.board_message_list params,current_user
|
|
|
|
|
present :data,board_messages_list.all,with:Mobile::Entities::Message
|
|
|
|
|
present :status,0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc '讨论区某主题的回复列表'
|
|
|
|
|
params do
|
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :board_id,type:Integer,desc:'讨论区id'
|
|
|
|
|
requires :msg_id,type:Integer,desc:'讨论主题id'
|
|
|
|
|
optional :page,type:Integer,desc:'页码'
|
|
|
|
|
end
|
|
|
|
|
get ':board_id/board_message_reply_list' do
|
|
|
|
|
cs = Courses.get_service
|
|
|
|
|
board_messages_list = cs.board_message_reply_list params,current_user
|
|
|
|
|
present :data,board_messages_list.all,with:Mobile::Entities::Message
|
|
|
|
|
present :status,0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc '讨论区回复'
|
|
|
|
|
params do
|
|
|
|
|
requires :token,type:String
|
|
|
|
|
requires :board_id,type:Integer,desc:'讨论区id'
|
|
|
|
|
requires :parent_id,type:Integer,desc:'本回复父id'
|
|
|
|
|
requires :subject,type:String,desc:'本回复主题'
|
|
|
|
|
requires :content,type:String,desc:'本回复内容'
|
|
|
|
|
requires :root_id,type:Integer,desc:'本回复根id'
|
|
|
|
|
requires :quote,type:String,desc:'本回复引用内容'
|
|
|
|
|
end
|
|
|
|
|
post ':board_id/board_message_reply' do
|
|
|
|
|
cs = Courses.get_service
|
|
|
|
|
board_messages = cs.board_message_reply params,current_user
|
|
|
|
|
present :data,board_messages,with:Mobile::Entities::Message
|
|
|
|
|
present :status,0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2016-06-27 16:03:07 +08:00
|
|
|
|
desc '获取测验列表'
|
|
|
|
|
params do
|
|
|
|
|
requires :token, type:String
|
|
|
|
|
end
|
|
|
|
|
get ':course_id/exercises' do
|
|
|
|
|
authenticate!
|
|
|
|
|
exercises = Course.find(params[:course_id]).exercises
|
|
|
|
|
present :data,exercises,with:Mobile::Entities::Exercise
|
|
|
|
|
present :status,0
|
|
|
|
|
end
|
2015-07-04 15:53:01 +08:00
|
|
|
|
|
2014-12-09 16:36:43 +08:00
|
|
|
|
end
|
2014-11-27 19:43:04 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|