From 2d59bf67662c885de3c7516781848bee6ace339e Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 17 Aug 2019 15:57:18 +0800 Subject: [PATCH 1/3] modify --- app/controllers/users/video_auths_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/users/video_auths_controller.rb b/app/controllers/users/video_auths_controller.rb index 2231dcfdf..a7d41bce5 100644 --- a/app/controllers/users/video_auths_controller.rb +++ b/app/controllers/users/video_auths_controller.rb @@ -10,9 +10,7 @@ class Users::VideoAuthsController < Users::BaseController def update video = observed_user.videos.find_by(uuid: params[:video_id]) - if video.blank? - video = observed_user.videos.create!(uuid: params[:video_id], title: params[:title], cover_url: params[:cover_url]) - end + return render_error('该视频凭证不存在') if video.blank? result = AliyunVod::Service.refresh_upload_video(video.uuid) render_ok(data: result) From 5d46519867b49f6cb6333ebebf70d50a85d07c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 17 Aug 2019 16:06:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=B0=81=E8=A3=85open=20pdf=20=E6=96=B0?= =?UTF-8?q?=E5=BC=80=E9=A1=B5=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 682e8f866..795e01a31 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -345,6 +345,10 @@ export function TPMIndexHOC(WrappedComponent) { link.dispatchEvent(evt); document.body.removeChild(link); } + + DownloadOpenPdf=(type,url)=>{ + type===true?window.open(url):window.location.href=url; + } render() { let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state; const common = { @@ -364,6 +368,7 @@ export function TPMIndexHOC(WrappedComponent) { checkIfProfileCompleted: this.checkIfProfileCompleted, ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url), DownloadFileA:(title,url)=>this.DownloadFileA(title,url), + DownloadOpenPdf:(type,url)=>this.DownloadOpenPdf(type,url) } return (
From 3af57e97ce8335d66eae53fed8806d88f66ccae2 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 17 Aug 2019 16:19:36 +0800 Subject: [PATCH 3/3] video feature: modify --- app/libs/aliyun_vod/service/base.rb | 10 +++++++++- app/libs/aliyun_vod/service/video_upload.rb | 9 --------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index 85f74fc6f..e100eadcc 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -10,7 +10,15 @@ module AliyunVod::Service::Base Rails.logger.info("[AliyunVod] response => status: #{response.status}, result: #{result}") - raise AliyunVod::Error, result['Code'] if response.status != 200 + if response.status != 200 + message = + case result['Code'] + when 'InvalidFileName.Extension' then '不支持的文件格式' + when 'IllegalCharacters' then '文件名称包含非法字符' + else raise AliyunVod::Error, result['Message'] + end + raise AliyunVod::Error, message if message.present? + end result rescue => ex diff --git a/app/libs/aliyun_vod/service/video_upload.rb b/app/libs/aliyun_vod/service/video_upload.rb index a5ade72f9..97ecd970b 100644 --- a/app/libs/aliyun_vod/service/video_upload.rb +++ b/app/libs/aliyun_vod/service/video_upload.rb @@ -16,15 +16,6 @@ module AliyunVod::Service::VideoUpload result = request(:post, params) - if result['Code'].present? - message = - case result['Code'] - when 'InvalidFileName.Extension' then '不支持的文件格式' - when 'IllegalCharacters' then '文件名称包含非法字符' - end - raise AliyunVod::Error, message if message.present? - end - raise AliyunVod::Error, '获取上传凭证失败' if result['UploadAddress'].blank? result