diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb
index 738b5c6da..03acd76cc 100644
--- a/app/controllers/users/videos_controller.rb
+++ b/app/controllers/users/videos_controller.rb
@@ -53,6 +53,6 @@ class Users::VideosController < Users::BaseController
end
def batch_publish_params
- params.permit(videos: [])
+ params.permit(videos: %i[video_id title])
end
end
\ No newline at end of file
diff --git a/app/jobs/apply_teacher_role_join_course_notify_job.rb b/app/jobs/apply_teacher_role_join_course_notify_job.rb
index c2495c036..3ae5e32db 100644
--- a/app/jobs/apply_teacher_role_join_course_notify_job.rb
+++ b/app/jobs/apply_teacher_role_join_course_notify_job.rb
@@ -11,7 +11,7 @@ class ApplyTeacherRoleJoinCourseNotifyJob < ApplicationJob
belong_container_type tiding_type extra created_at updated_at]
same_attrs = {
- trigger_user_id: user.id, container_id: course.id, container_type: 'JoinCourse',
+ trigger_user_id: user.id, container_id: course.id, container_type: 'JoinCourse', status: 0,
belong_container_id: course.id, belong_container_type: 'Course', tiding_type: 'Apply', extra: role
}
Tiding.bulk_insert(*attrs) do |worker|
diff --git a/app/libs/aliyun_vod.rb b/app/libs/aliyun_vod.rb
index 9ce44a87f..0ce159fb6 100644
--- a/app/libs/aliyun_vod.rb
+++ b/app/libs/aliyun_vod.rb
@@ -1,5 +1,5 @@
module AliyunVod
class << self
- attr_accessor :access_key_id, :access_key_secret, :base_url, :callback_url, :signature_key
+ attr_accessor :access_key_id, :access_key_secret, :base_url, :cate_id, :callback_url, :signature_key
end
end
\ No newline at end of file
diff --git a/app/libs/aliyun_vod/service/video_upload.rb b/app/libs/aliyun_vod/service/video_upload.rb
index a16c87c3f..97ecd970b 100644
--- a/app/libs/aliyun_vod/service/video_upload.rb
+++ b/app/libs/aliyun_vod/service/video_upload.rb
@@ -8,6 +8,10 @@ module AliyunVod::Service::VideoUpload
FileName: filename
}.merge(base_params)
+ # 分类
+ cate_id = AliyunVod.cate_id
+ params[:CateId] = cate_id if cate_id.present?
+
params = opts.merge(params)
result = request(:post, params)
diff --git a/app/models/course.rb b/app/models/course.rb
index 1f38827ae..25a017faa 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -327,7 +327,7 @@ class Course < ApplicationRecord
#创建课程后,给该用户发送消息
def send_tiding
- self.tidings << Tiding.new(user_id: tea_id, trigger_user_id: tea_id, belong_container_id: id,
+ self.tidings << Tiding.new(user_id: tea_id, trigger_user_id: 1, belong_container_id: id,
belong_container_type: 'Course', tiding_type: 'System')
end
diff --git a/app/models/course_message.rb b/app/models/course_message.rb
index 42cbe00c8..016479425 100644
--- a/app/models/course_message.rb
+++ b/app/models/course_message.rb
@@ -28,7 +28,7 @@ class CourseMessage < ApplicationRecord
def send_deal_tiding deal_status
# 发送申请处理结果消息
Tiding.create!(
- user_id: course_message_id, trigger_user: User.current, container_id: course_id, container_type: 'DealCourse',
+ user_id: course_message_id, trigger_user: 1, container_id: course_id, container_type: 'DealCourse',
belong_container: course, extra: content.to_i == 2 ? '9' : '7', tiding_type: 'System', status: deal_status
)
# 将申请消息置为已处理
diff --git a/app/models/user.rb b/app/models/user.rb
index eda7d296d..7f724d081 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -60,8 +60,8 @@ class User < ApplicationRecord
has_many :games, :dependent => :destroy
has_many :created_subjects, foreign_key: :user_id, class_name: 'Subject'
- has_many :subjects, :through => :subject_members
has_many :subject_members, :dependent => :destroy
+ has_many :subjects, :through => :subject_members
has_many :grades, :dependent => :destroy
has_many :experiences, :dependent => :destroy
has_many :student_works, :dependent => :destroy
diff --git a/app/queries/users/video_query.rb b/app/queries/users/video_query.rb
index e692cb1e5..cfaa314cc 100644
--- a/app/queries/users/video_query.rb
+++ b/app/queries/users/video_query.rb
@@ -11,7 +11,7 @@ class Users::VideoQuery < ApplicationQuery
end
def call
- videos = user.videos.published
+ videos = user.videos
videos =
case params[:status]
diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb
index 6121989c8..3bdabd91a 100644
--- a/app/services/videos/dispatch_callback_service.rb
+++ b/app/services/videos/dispatch_callback_service.rb
@@ -11,12 +11,14 @@ class Videos::DispatchCallbackService < ApplicationService
# TODO:: 拆分事件分发
case params['EventType']
- when 'FileUploadComplete' then
+ when 'FileUploadComplete' then # 视频上传完成
video.file_url = params['FileUrl']
video.upload_success
video.save!
+ when 'SnapshotComplete' then # 封面截图完成
+ return if video.cover_url.present?
- GetAliyunVideoInfoJob.perform_later(video.uuid)
+ video.update!(cover_url: params['CoverUrl'])
end
rescue => ex
diff --git a/app/views/users/videos/review.json.jbuilder b/app/views/users/videos/review.json.jbuilder
index f6e159c41..3e0fe8b93 100644
--- a/app/views/users/videos/review.json.jbuilder
+++ b/app/views/users/videos/review.json.jbuilder
@@ -1,6 +1,6 @@
json.count @count
json.videos do
- json.array! @video.each do |video|
+ json.array! @videos.each do |video|
json.partial! 'video', video: video
json.file_url nil
end
diff --git a/config/aliyun_vod.yml.example b/config/aliyun_vod.yml.example
index ec858982b..aa6547a62 100644
--- a/config/aliyun_vod.yml.example
+++ b/config/aliyun_vod.yml.example
@@ -2,6 +2,7 @@ defaults: &defaults
access_key_id: 'test'
access_key_secret: 'test'
base_url: 'http://vod.cn-shanghai.aliyuncs.com'
+ cate_id: '-1'
callback_url: 'http://47.96.87.25:48080/api/callbacks/aliyun_vod.json'
signature_key: 'test12345678'
diff --git a/config/initializers/aliyun_vod_init.rb b/config/initializers/aliyun_vod_init.rb
index 655ce3df6..d133fffbf 100644
--- a/config/initializers/aliyun_vod_init.rb
+++ b/config/initializers/aliyun_vod_init.rb
@@ -2,5 +2,6 @@ config = Rails.application.config_for(:aliyun_vod)
AliyunVod.access_key_id = config['access_key_id']
AliyunVod.access_key_secret = config['access_key_secret']
AliyunVod.base_url = config['base_url'] || 'http://vod.cn-shanghai.aliyuncs.com'.freeze
+AliyunVod.cate_id = config['cate_id']
AliyunVod.callback_url = config['callback_url']
AliyunVod.signature_key = config['signature_key']
diff --git a/public/react/src/modules/courses/ListPageIndex.js b/public/react/src/modules/courses/ListPageIndex.js
index 8c87c8731..a6c9d6975 100644
--- a/public/react/src/modules/courses/ListPageIndex.js
+++ b/public/react/src/modules/courses/ListPageIndex.js
@@ -104,17 +104,17 @@ class ListPageIndex extends Component{
{/*头部banner*/}