toschina课程动态接口

This commit is contained in:
daiao 2018-11-22 23:57:41 -08:00
parent 8b3e4949b9
commit 4dd5e76a05
11 changed files with 233 additions and 0 deletions

View File

@ -21,6 +21,11 @@ module Mobile
present :status, 0
end
desc "获取课程动态"
get 'get_course_activity' do
CoursesService.new.get_course_activity params
end
desc "新建课程"
#current_user当前用户对象不是id
# params[:course][:name]:课程名称

View File

@ -2377,6 +2377,7 @@ class UsersController < ApplicationController
act_type = 'all'
end
end
logger.info("####################{container_type}")
if container_type != '' && container_type != 'all'
if container_type == 'Course'
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"

View File

@ -44,6 +44,22 @@ class CoursesService
}
end
# 获取课程最新动态
def get_course_activity params
page = params[:page] || 1
activities = UserActivity.where(:container_type => 'Course', :act_type => 'HomeworkCommon').order('created_at desc')
activities_count = activities.count
activities_pages = Redmine::Pagination::Paginator.new @activities_count, 4, page
activities = activities.offset(activities_pages.offset).limit(activities_pages.per_page)
course_activites_data = []
activities.each do |a|
Rails.logger.info("###############{a.container.to_json}")
course_name = a.container.name
course_activites_data << {course_name: course_name, content: a.act.name, time: format_time(a.created_at), url: "www.trustie.net/course/#{a.container_id}"}
end
{course_activites_data: course_activites_data}
end
#搜索课程

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>

7
lib/grack/.rakeTasks Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>

View File

@ -0,0 +1,40 @@
PATH
remote: .
specs:
rails_kindeditor (0.4.5)
carrierwave
mini_magick
GEM
remote: https://gems.ruby-china.com/
specs:
activemodel (3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
activesupport (3.2.22.5)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
builder (3.0.0)
carrierwave (0.11.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
mimemagic (>= 0.3.0)
i18n (0.6.11)
json (1.8.6)
mime-types (1.25.1)
mimemagic (0.3.2)
mini_magick (4.8.0)
multi_json (1.13.1)
PLATFORMS
ruby
DEPENDENCIES
carrierwave
mini_magick
rails_kindeditor!
BUNDLED WITH
1.16.1

7
lib/wechat/.rakeTasks Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>

View File

@ -0,0 +1,129 @@
GEM
remote: https://gems.ruby-china.com/
specs:
actionmailer (3.2.22.5)
actionpack (= 3.2.22.5)
mail (~> 2.5.4)
actionpack (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
activerecord (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
activesupport (3.2.22.5)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
arel (3.0.3)
builder (3.0.0)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
erubis (2.7.0)
ffi (1.9.21)
hike (1.2.3)
htmlentities (4.3.4)
i18n (0.6.11)
journey (1.0.4)
jquery-rails (2.0.3)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.8.6)
kaminari (0.17.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
mail (2.5.5)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
multi_json (1.13.1)
paperclip (3.5.4)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.5)
rack (1.4.7)
rack-cache (1.7.1)
rack (>= 0.4)
rack-raw-upload (1.1.1)
multi_json
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.22.5)
actionmailer (= 3.2.22.5)
actionpack (= 3.2.22.5)
activerecord (= 3.2.22.5)
activeresource (= 3.2.22.5)
activesupport (= 3.2.22.5)
bundler (~> 1.0)
railties (= 3.2.22.5)
railties (3.2.22.5)
actionpack (= 3.2.22.5)
activesupport (= 3.2.22.5)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (12.3.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rdoc (3.12.2)
json (~> 1.4)
rich (1.4.6)
jquery-rails
kaminari
mime-types
paperclip
rack-raw-upload
rails (>= 3.2.0)
sass-rails
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.20.0)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.53)
PLATFORMS
ruby
DEPENDENCIES
htmlentities
kaminari
paperclip (~> 3.5.4)
rich (= 1.4.6)
BUNDLED WITH
1.16.1