2015-01-04 14:55:45 +08:00
|
|
|
#coding=utf-8
|
|
|
|
|
|
|
|
module Mobile
|
|
|
|
module Apis
|
|
|
|
class Homeworks < Grape::API
|
|
|
|
|
2015-01-12 17:19:18 +08:00
|
|
|
def self.get_service
|
2015-01-13 16:00:17 +08:00
|
|
|
HomeworkService.new
|
2015-01-04 14:55:45 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
resources :homeworks do
|
|
|
|
desc "作业详情"
|
|
|
|
params do
|
|
|
|
requires :id, type: Integer, desc: "作业ID"
|
|
|
|
end
|
|
|
|
route_param :id do
|
|
|
|
get do
|
2015-01-20 15:17:02 +08:00
|
|
|
homework = Homeworks.get_service.show_homework params
|
|
|
|
present :data, homework, with: Mobile::Entities::Homework
|
|
|
|
present :status, 0
|
2015-01-04 14:55:45 +08:00
|
|
|
end
|
|
|
|
end
|
2015-01-12 17:19:18 +08:00
|
|
|
|
2015-01-21 11:28:09 +08:00
|
|
|
desc "我的作品列表"
|
|
|
|
params do
|
|
|
|
requires :token, type: String
|
|
|
|
end
|
|
|
|
get ':user_id/homework_attachs' do
|
|
|
|
ue = Homeworks.get_service.my_homework_list params,current_user.nil? ? User.find(2):current_user
|
|
|
|
present :data, ue,with: Mobile::Entities::Course
|
|
|
|
present :status, 0
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2015-01-04 14:55:45 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|