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

courseware
cxt 5 years ago
commit 0b1797c6bd

@ -132,7 +132,6 @@ class CoursesController < ApplicationController
tip_exception(404, "找不到资源") if video.blank?
tip_exception(403, "...") unless (video.user_id == current_user.id || current_user.admin_or_business?)
video.destroy!
AliyunVod::Service.delete_video([video.uuid]) rescue nil
end
render_ok

@ -26,7 +26,6 @@ class Users::VideosController < Users::BaseController
return render_error('该状态下不能删除视频') unless video.pending?
video.destroy!
AliyunVod::Service.delete_video([video.uuid]) rescue nil
render_ok
end
@ -60,8 +59,6 @@ class Users::VideosController < Users::BaseController
video.destroy!
AliyunVod::Service.delete_video([video.uuid]) rescue nil
render_ok
end

@ -1,4 +1,6 @@
class Weapps::CoursesController < Weapps::BaseController
include CustomSortable
before_action :require_login
before_action :set_course, except: [:create, :check_invite_code]
before_action :user_course_identity, except: [:basic_info, :create, :check_invite_code]

@ -35,7 +35,9 @@ module AliyunVod::Service::VideoManage
}.merge(base_params)
result = request(:post, params)
Rails.logger.info("#######:#{result['Mezzanine']['VideoStreamList'][0]['CodecName']}")
result['Mezzanine']['VideoStreamList'][0]['CodecName']
rescue => e
Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}"
end

@ -1,6 +1,13 @@
class Video < ApplicationRecord
include AASM
alias_method :hard_destroy, :destroy
default_scope -> { where(delete_state: nil) }
scope :deleted, -> { unscope(where: :delete_state).where.not(delete_state: nil) }
BEGIN_DELETE = 1 # 标记软删除
FINISH_DELETE = 2 # 视频资源完成删除
# 标准视频转码组
NORMAL_TRANSCODE_GROUP_ID = 'a0277c5c0c7458458e171b0cee6ebf5e'
@ -41,4 +48,17 @@ class Video < ApplicationRecord
def video_play_duration
(play_duration / (60*60.0)).ceil
end
def destroy
run_callbacks(:destroy) do
if persisted?
update_column(:delete_state, Video::BEGIN_DELETE)
AliyunVod::Service.delete_video([self.uuid])
end
@destroyed = true
end
freeze
end
end

@ -32,8 +32,10 @@ class Videos::BatchPublishService < ApplicationService
# 标清转码为h264
if AliyunVod::Service.get_meta_code_info(video.uuid).start_with?('h264', 'h265')
video.transcoded = true
result = AliyunVod::Service.get_play_info(video.uuid)
video.play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL']
#Rails.logger.info("####video.uuid:#{video.uuid}")
#result = AliyunVod::Service.get_play_info(video.uuid)
# Rails.logger.info("####video.result:#{result}")
#video.play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL']
else
AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID)
end

@ -18,11 +18,14 @@ class Videos::DispatchCallbackService < ApplicationService
video.save!
when 'SnapshotComplete' then # 封面截图完成
return if video.cover_url.present?
video.update!(cover_url: params['CoverUrl'])
result = AliyunVod::Service.get_play_info(video.uuid) rescue nil
play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result
video.update!(cover_url: params['CoverUrl'], play_url: play_url)
when 'StreamTranscodeComplete' then # 转码完成
return if video.play_url.present?
#return if video.play_url.present?
video.update!(play_url: params['FileUrl'], transcoded: true)
when 'DeleteMediaComplete' #完成云端视频删除
video.update_column(:delete_state, Video::FINISH_DELETE)
end
rescue => ex

@ -1,4 +1,4 @@
json.count @count
json.videos @videos do |video|
json.partial! 'users/videos/video', locals: { video: video.video }
json.partial! 'users/videos/video', locals: { video: video }
end

@ -0,0 +1,6 @@
class AddDeleteStateToVideo < ActiveRecord::Migration[5.2]
def change
add_column :videos, :delete_state, :integer
add_index :videos, :delete_state
end
end

@ -191,7 +191,8 @@ function generateNewIndexJsp() {
if (err) {
return console.log(err);
}
const newVersion = '1.1.1'
const newVersion = Date.parse(new Date());
let cdnHost = 'https://shixun.educoder.net'
cdnHost = 'https://ali-cdn.educoder.net'
cdnHost = ''

@ -101,7 +101,11 @@ class Fileslists extends Component{
}
}
componentDidUpdate = (prevProps) => {
if(prevProps.match.params.main_id != this.props.match.params.main_id){
if(prevProps.coursesidtype!=this.props.coursesidtype||prevProps.match.params.main_id!=this.props.match.params.main_id||prevProps.match.params.Id!=this.props.match.params.Id){
if(this.props.match.params.main_id){
this.getcourse_groupslists()
this.setState({
isSpin:true,
@ -116,7 +120,8 @@ class Fileslists extends Component{
this.seactall(undefined,"desc");
}
}
if(prevProps.match.params.Id != this.props.match.params.Id){
if(this.props.match.params.Id){
this.getcourse_groupslists()
this.setState({
isSpin:true,
@ -133,6 +138,8 @@ class Fileslists extends Component{
}
}
}
updadatalist=(id)=>{
// this.seactall(id)
if(this.props.user&&this.props.user.login=== ""||this.props.user&&this.props.user.login=== null||this.props.user&&this.props.user.login=== undefined){
@ -916,7 +923,7 @@ class Fileslists extends Component{
{
`
.filesnameslist{
max-width: 200px;
max-width: 370px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

@ -53,11 +53,20 @@ class MoveBox extends Component{
video_ids:[id],
new_category_id:selectSubId
}).then(result=>{
if(result){
const { setMoveVisible , successFunc , updataleftNavfun} = this.props;
updataleftNavfun && updataleftNavfun();
setMoveVisible && setMoveVisible(false);
successFunc && successFunc();
try {
this.props.showNotification(result.data.message);
}catch (e) {
}
}
}).catch(error=>{
console.log(error);

@ -295,9 +295,11 @@ function buildColumns(that, student_works, studentData) {
key: 'user_comment_count',
dataIndex: 'user_comment_count',
render: (student_score, record) => (
render: (user_comment_count, record) => (
<span style={{color:'#989898', cursor: 'default'}}>
<Tooltip title={"在匿评期间评阅的作品数量"}>
{record.user_comment_count}
</Tooltip>
</span>
),
})
@ -690,7 +692,7 @@ class CommonWorkList extends Component{
id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score,
ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count,
late_penalty, absence_penalty, appeal_penalty
late_penalty, absence_penalty, appeal_penalty,user_comment_count
, end_immediately, publish_immediately
, homework_id, visible, work_group, project_info, is_leader
@ -740,7 +742,7 @@ class CommonWorkList extends Component{
}else{
StudentData=isStudent ? [{ id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score,
ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count,
late_penalty, absence_penalty, appeal_penalty, project_info, is_leader,
late_penalty, absence_penalty, appeal_penalty, project_info, is_leader,user_comment_count,
work_group, isMine: true }] : []
}
const columns = buildColumns(this, student_works, StudentData)
@ -773,7 +775,7 @@ class CommonWorkList extends Component{
const hasData = this.state.homework_status && this.state.homework_status.indexOf("未发布") == -1 // student_works && !!student_works.length && page == 1 &&
// console.log(StudentData)
console.log(StudentData)
// console.log(student_works)
return(
<React.Fragment>

@ -548,7 +548,11 @@ class Coursesleftnav extends Component{
description:result.data.message
});
if(positiontype==="shixun_homeworks"){
this.updasaveNavmoda()
trigger('updateNavSuccess')
this.props.history.push(`/classrooms/${coursesId}/shixun_homework/${result.data.category_id}`);
}
if(positiontype==="files"){
this.updasaveNavmoda()
trigger('updateNavSuccess')
@ -561,7 +565,7 @@ class Coursesleftnav extends Component{
this.props.history.push(`/classrooms/${coursesId}/boards/${result.data.category_id}`);
}
if(positiontype!="course_groups"){
if(positiontype!="course_groups"&&positiontype!="shixun_homeworks"){
this.updasaveNavmoda()
}

@ -146,7 +146,9 @@ class ShixunHomework extends Component{
componentDidUpdate = (prevProps) => {
if(prevProps.match.params.main_id != this.props.match.params.main_id){
if(prevProps.coursesidtype!=this.props.coursesidtype||prevProps.match.params.main_id!=this.props.match.params.main_id||prevProps.match.params.category_id!=this.props.match.params.category_id) {
if(this.props.match.params.main_id){
if(this.props.match.params.main_id!=undefined){
this.setState({
checkedtype:false,
@ -157,7 +159,7 @@ class ShixunHomework extends Component{
this.seactall();
}
}
if(prevProps.match.params.category_id != this.props.match.params.category_id){
if(this.props.match.params.category_id){
if(this.props.match.params.category_id!=undefined){
this.setState({
checkedtype:false,
@ -171,6 +173,8 @@ class ShixunHomework extends Component{
}
}
homeworkupdatalist=(search,page,order)=>{
let {datas}=this.state;
// let newhomework_idsval=checkBoxValues;

Loading…
Cancel
Save