Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_video
杨树林 5 years ago
commit ad96bf5784

@ -227,8 +227,10 @@ class ChallengesController < ApplicationController
@challenge.update_attributes(picture_path: nil, web_route: nil, expect_picture_path: nil, original_picture_path: nil)
end
# 关卡评测执行文件如果被修改,需要修改脚本内容
script = modify_shixun_script @shixun, @shixun.evaluate_script
@shixun.shixun_info.update_column(:evaluate_script, script)
unless @shixun.published
script = modify_shixun_script @shixun, @shixun.evaluate_script
@shixun.shixun_info.update_column(:evaluate_script, script)
end
# TODO:
# if path != params[:challenge][:path]
# shixun_modify_status_without_publish(@shixun, 1)

@ -13,7 +13,7 @@ class Users::VideosController < Users::BaseController
end
def update
return render_error('该状态下不能编辑视频信息') unless current_video.published?
return render_error('该状态下不能编辑视频信息') unless (current_video.published? || current_video.course_videos.present?)
current_video.update!(title: params[:title])
@ -57,6 +57,14 @@ class Users::VideosController < Users::BaseController
def current_video
@_current_video ||= observed_user.videos.find_by(id: params[:id])
if @_current_video.nil?
video = Video.find_by(id: params[:id])
if video.course_videos.present?
video
end
else
@_current_video
end
end
def search_params

@ -11,26 +11,35 @@ class Videos::BatchPublishService < ApplicationService
def call
video_params = Array.wrap(params[:videos]).compact
return if video_params.blank?
Rails.logger.info("#####video_course: #{video_params}")
video_ids = []
ActiveRecord::Base.transaction do
video_params.each do |param|
video = user.videos.find_by(uuid: param[:video_id])
Rails.logger.info("video.processing_video_apply:#{video}")
Rails.logger.info("video.processing_video_apply:#{video.blank? || video.processing_video_apply}")
next if video.blank? || video.processing_video_apply.present?
raise Error, '视频还未上传完成' if video.vod_uploading?
video.title = param[:title].to_s.strip.presence || video.title
video.apply_publish
video.save!
video.video_applies.create!
if param[:course_id].present?
video.video_applies.create!(status: "agreed")
else
video.video_applies.create!
end
video_ids << video.id
# 如果是课堂上传则创建课堂记录
if params[:course_id].present?
video.course_videos.create!(course_id: params[:course_id])
Rails.logger.info("#####param: #{ param[:course_id]}")
if param[:course_id].present?
video.course_videos.create!(course_id: param[:course_id])
end
end
end

Loading…
Cancel
Save