diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb
index 9ffac4e10..c555eb633 100644
--- a/app/api/mobile/api.rb
+++ b/app/api/mobile/api.rb
@@ -18,6 +18,7 @@ module Mobile
require_relative 'apis/blog_comments'
require_relative 'apis/new_comment'
require_relative 'apis/praise'
+ require_relative 'apis/resources'
class API < Grape::API
version 'v1', using: :path
@@ -71,6 +72,7 @@ module Mobile
mount Apis::BlogComments
mount Apis::NewComment
mount Apis::Praise
+ mount Apis::Resources
add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
diff --git a/app/api/mobile/apis/resources.rb b/app/api/mobile/apis/resources.rb
new file mode 100644
index 000000000..fca94a642
--- /dev/null
+++ b/app/api/mobile/apis/resources.rb
@@ -0,0 +1,55 @@
+#coding=utf-8
+module Mobile
+ module Apis
+ class Resources < Grape::API
+
+ resource :resources do
+
+ desc '获取所有课件'
+ params do
+ requires :token, type: String
+ end
+ get do
+ authenticate!
+ data = current_user.course_attachments
+ present :data, data, with: Mobile::Entities::Attachment
+ present :status, 0
+
+ end
+
+
+
+ desc '获取所有作业'
+ params do
+ requires :token, type: String
+ end
+ get 'homeworks' do
+ authenticate!
+
+ homeworks = current_user.homework_commons
+
+ present :data, homeworks, with: Mobile::Entities::Homework
+ present :status, 0
+
+ end
+
+ desc '获取所有测验'
+ params do
+ requires :token, type: String
+ end
+ get 'exercies' do
+ authenticate!
+
+ exercises = current_user.exercises
+ present :data, exercises, with: Mobile::Entities::Exercise
+ present :status, 0
+ end
+
+
+ end
+
+
+
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/models/user.rb b/app/models/user.rb
index 3d491c8ab..daf1237cf 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -145,6 +145,7 @@ class User < Principal
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
has_many :principal_acts, :class_name => 'PrincipalActivity',:as =>:principal_act ,:dependent => :destroy
has_many :file_commit, :class_name => 'Attachment', :foreign_key => 'author_id', :conditions => "container_type = 'Project' or container_type = 'Version'"
+ has_many :course_attachments , :class_name => 'Attachment', :foreign_key => 'author_id', :conditions => "container_type = 'Course'"
####
# added by bai
has_many :join_in_contests, :dependent => :destroy
diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb
index e21f5d6c7..08221d00d 100644
--- a/app/views/wechats/user_activities.html.erb
+++ b/app/views/wechats/user_activities.html.erb
@@ -40,7 +40,7 @@
-
+
@@ -49,6 +49,7 @@
+