From 7634d075dca27e8bc8457338c64c71ce16025acc Mon Sep 17 00:00:00 2001 From: anke1460 Date: Tue, 10 Mar 2020 21:05:34 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E8=BD=AF=E5=88=A0=E9=99=A4=E8=A7=86?= =?UTF-8?q?=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 1 - app/controllers/users/videos_controller.rb | 3 --- app/models/video.rb | 24 +++++++++++++++++++ .../videos/dispatch_callback_service.rb | 2 ++ ...0200310080919_add_delete_state_to_video.rb | 6 +++++ 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20200310080919_add_delete_state_to_video.rb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d35741c61..d93f0a5bd 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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 diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb index 32f81f6ed..d4f021389 100644 --- a/app/controllers/users/videos_controller.rb +++ b/app/controllers/users/videos_controller.rb @@ -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 @@ -61,8 +60,6 @@ class Users::VideosController < Users::BaseController video.destroy! - AliyunVod::Service.delete_video([video.uuid]) rescue nil - render_ok end diff --git a/app/models/video.rb b/app/models/video.rb index 02cccd8f1..486c64a9e 100644 --- a/app/models/video.rb +++ b/app/models/video.rb @@ -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,21 @@ 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) + + # result = AliyunVod::Service.delete_video([self.uuid]) + # if result && result['RequestId'] + # update_column(:delete_state, Video::FINISH_DELETE) + # end + end + + @destroyed = true + end + freeze + end + end \ No newline at end of file diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 149009c96..6bfb9f70d 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -23,6 +23,8 @@ class Videos::DispatchCallbackService < ApplicationService when 'StreamTranscodeComplete' then # 转码完成 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 diff --git a/db/migrate/20200310080919_add_delete_state_to_video.rb b/db/migrate/20200310080919_add_delete_state_to_video.rb new file mode 100644 index 000000000..a6854620a --- /dev/null +++ b/db/migrate/20200310080919_add_delete_state_to_video.rb @@ -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 From 8f251e4bc6dddec38e67d41b62edf2e110129aa9 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Tue, 10 Mar 2020 21:22:24 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=A4=84=E7=90=86=E3=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/video.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/video.rb b/app/models/video.rb index 486c64a9e..3ecb050cd 100644 --- a/app/models/video.rb +++ b/app/models/video.rb @@ -53,7 +53,7 @@ class Video < ApplicationRecord run_callbacks(:destroy) do if persisted? update_column(:delete_state, Video::BEGIN_DELETE) - + AliyunVod::Service.delete_video([self.uuid]) # result = AliyunVod::Service.delete_video([self.uuid]) # if result && result['RequestId'] # update_column(:delete_state, Video::FINISH_DELETE) From 44e1aeda373041b11e4a9cf2477b6607eb36a447 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Tue, 10 Mar 2020 21:22:56 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/video.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/models/video.rb b/app/models/video.rb index 3ecb050cd..3fbeb676b 100644 --- a/app/models/video.rb +++ b/app/models/video.rb @@ -54,10 +54,6 @@ class Video < ApplicationRecord if persisted? update_column(:delete_state, Video::BEGIN_DELETE) AliyunVod::Service.delete_video([self.uuid]) - # result = AliyunVod::Service.delete_video([self.uuid]) - # if result && result['RequestId'] - # update_column(:delete_state, Video::FINISH_DELETE) - # end end @destroyed = true From 5eccfa52dc39d6a45303916026e27c52d36a4fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 10 Mar 2020 21:56:18 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Video/MoveBox.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/Video/MoveBox.js b/public/react/src/modules/courses/Video/MoveBox.js index 44cf097bd..bb68eff7b 100644 --- a/public/react/src/modules/courses/Video/MoveBox.js +++ b/public/react/src/modules/courses/Video/MoveBox.js @@ -53,12 +53,21 @@ 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); }) @@ -69,7 +78,7 @@ class MoveBox extends Component{ const { data , selectSubId } = this.state; let list = data && data.course_second_categories && data.course_second_categories.length>0?data.course_second_categories:undefined; - + return( Date: Tue, 10 Mar 2020 22:04:15 +0800 Subject: [PATCH 05/13] 1 --- app/controllers/weapps/courses_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/weapps/courses_controller.rb b/app/controllers/weapps/courses_controller.rb index c4dde41e0..2a375a7fb 100644 --- a/app/controllers/weapps/courses_controller.rb +++ b/app/controllers/weapps/courses_controller.rb @@ -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] From 64b1e95a516f1bbfd1f30c9067f72c1f8d78f928 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 22:05:32 +0800 Subject: [PATCH 06/13] 1 --- app/views/weapps/courses/course_videos.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/weapps/courses/course_videos.json.jbuilder b/app/views/weapps/courses/course_videos.json.jbuilder index e14e4f5d8..bca028c47 100644 --- a/app/views/weapps/courses/course_videos.json.jbuilder +++ b/app/views/weapps/courses/course_videos.json.jbuilder @@ -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 \ No newline at end of file From dfe1204992b25ed5ed742e81bfbf966a5355656b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 10 Mar 2020 22:24:28 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/Resource/index.js | 63 ++++++++++--------- .../courses/busyWork/CommonWorkList.js | 6 +- .../courses/coursesDetail/CoursesLeftNav.js | 8 ++- .../courses/shixunHomework/shixunHomework.js | 42 +++++++------ 4 files changed, 68 insertions(+), 51 deletions(-) diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index b35eb4e06..11b81c33d 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -101,36 +101,43 @@ class Fileslists extends Component{ } } componentDidUpdate = (prevProps) => { - if(prevProps.match.params.main_id != this.props.match.params.main_id){ - this.getcourse_groupslists() - this.setState({ - isSpin:true, - checkBoxValues:[], - checkAllValue:false, - }) - if(this.props.match.params.main_id!=undefined){ - this.setState({ - child:false, - sort:"desc" - }) - this.seactall(undefined,"desc"); + + 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, + checkBoxValues:[], + checkAllValue:false, + }) + if(this.props.match.params.main_id!=undefined){ + this.setState({ + child:false, + sort:"desc" + }) + this.seactall(undefined,"desc"); + } } - } - if(prevProps.match.params.Id != this.props.match.params.Id){ - this.getcourse_groupslists() - this.setState({ - isSpin:true, - checkBoxValues:[], - checkAllValue:false, - }) - if(this.props.match.params.Id!=undefined){ - this.setState({ - child:true, - sort:"desc" - }) - this.seactall(parseInt(this.props.match.params.Id),"desc") + + if(this.props.match.params.Id){ + this.getcourse_groupslists() + this.setState({ + isSpin:true, + checkBoxValues:[], + checkAllValue:false, + }) + if(this.props.match.params.Id!=undefined){ + this.setState({ + child:true, + sort:"desc" + }) + this.seactall(parseInt(this.props.match.params.Id),"desc") + } } } + } updadatalist=(id)=>{ @@ -916,7 +923,7 @@ class Fileslists extends Component{ { ` .filesnameslist{ - max-width: 200px; + max-width: 370px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 6125c3e02..e020031fb 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -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) => ( - {record.user_comment_count} + + {record.user_comment_count} + ), }) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 4e8cc5b46..63466646e 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -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() } diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index e32479735..a6fca8e0b 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -146,27 +146,31 @@ class ShixunHomework extends Component{ componentDidUpdate = (prevProps) => { - if(prevProps.match.params.main_id != this.props.match.params.main_id){ - if(this.props.match.params.main_id!=undefined){ - this.setState({ - checkedtype:false, - orders:"8", - order:undefined, - page:1 - }) - this.seactall(); + 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, + orders:"8", + order:undefined, + page:1 + }) + this.seactall(); + } } - } - if(prevProps.match.params.category_id != this.props.match.params.category_id){ - if(this.props.match.params.category_id!=undefined){ - this.setState({ - checkedtype:false, - orders:"8", - order:undefined, - page:1 - }) - this.seactall(parseInt(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, + orders:"8", + order:undefined, + page:1 + }) + this.seactall(parseInt(this.props.match.params.category_id)) + } } + } } From 4eb80462f89dd9cecbf7bfcda1cc125169ab922e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 22:49:37 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E6=89=93=E5=8D=B0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/aliyun_vod/service/video_manage.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/libs/aliyun_vod/service/video_manage.rb b/app/libs/aliyun_vod/service/video_manage.rb index b00d86892..af31f6175 100644 --- a/app/libs/aliyun_vod/service/video_manage.rb +++ b/app/libs/aliyun_vod/service/video_manage.rb @@ -35,6 +35,7 @@ module AliyunVod::Service::VideoManage }.merge(base_params) result = request(:post, params) + Rails.logger.info("#######:#{result}") result['Mezzanine']['VideoStreamList'][0]['CodecName'] rescue => e Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}" From 4b6f6853154aac78c1dba65cad6884adfcb3a1a7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 22:56:39 +0800 Subject: [PATCH 09/13] 1 --- app/libs/aliyun_vod/service/video_manage.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/libs/aliyun_vod/service/video_manage.rb b/app/libs/aliyun_vod/service/video_manage.rb index af31f6175..535f76546 100644 --- a/app/libs/aliyun_vod/service/video_manage.rb +++ b/app/libs/aliyun_vod/service/video_manage.rb @@ -35,8 +35,9 @@ module AliyunVod::Service::VideoManage }.merge(base_params) result = request(:post, params) - Rails.logger.info("#######:#{result}") + Rails.logger.info("#######:#{result['Mezzanine']['VideoStreamList'][0]['CodecName']}") result['Mezzanine']['VideoStreamList'][0]['CodecName'] + rescue => e Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}" end From 27e10e4173cae2c7c5b36a9957776c3874cacba0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 23:00:56 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/videos/batch_publish_service.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 699a55516..8a97f74d1 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -32,7 +32,9 @@ class Videos::BatchPublishService < ApplicationService # 标清转码为h264 if AliyunVod::Service.get_meta_code_info(video.uuid).start_with?('h264', 'h265') video.transcoded = true + 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) From 26721de90d7a6f5c7bbd916493d2943c8b4b0f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 10 Mar 2020 23:03:36 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E3=80=81=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=BA=AB=E4=BB=BD=E6=95=B0=E6=8D=AE=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/scripts/build.js | 3 ++- public/react/src/modules/courses/busyWork/CommonWorkList.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index f8cec6702..560e1082b 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -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 = '' diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index e020031fb..58156beea 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -692,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 @@ -742,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) @@ -775,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( From a6507b50369b05adda6be4659b152c38fe9b9077 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 23:06:52 +0800 Subject: [PATCH 12/13] 1 --- app/services/videos/batch_publish_service.rb | 8 ++++---- app/services/videos/dispatch_callback_service.rb | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 8a97f74d1..19f611b3b 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -32,10 +32,10 @@ class Videos::BatchPublishService < ApplicationService # 标清转码为h264 if AliyunVod::Service.get_meta_code_info(video.uuid).start_with?('h264', 'h265') video.transcoded = true - 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'] + #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 diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 6bfb9f70d..ca59fd4b6 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -18,8 +18,9 @@ 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? video.update!(play_url: params['FileUrl'], transcoded: true) From c2eadb39bcf174c0c7317c501140a5a0a2256086 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 23:26:52 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E8=BD=AC=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/videos/dispatch_callback_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index ca59fd4b6..2e3d85987 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -22,7 +22,7 @@ class Videos::DispatchCallbackService < ApplicationService 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)