From a9f377ebbce1e2b084769053c0b773952b38d474 Mon Sep 17 00:00:00 2001 From: filesite Date: Thu, 16 May 2024 00:37:22 +0800 Subject: [PATCH] save url and title immediately when user add new fav --- themes/tajian/controller/FrontapiController.php | 12 ++++++++---- www/js/tajian.js | 17 +++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/themes/tajian/controller/FrontapiController.php b/themes/tajian/controller/FrontapiController.php index 551d4f9..ec58962 100644 --- a/themes/tajian/controller/FrontapiController.php +++ b/themes/tajian/controller/FrontapiController.php @@ -129,7 +129,7 @@ Class FrontApiController extends SiteController { } if ($code == 1) { //保存视频 - $done = $this->saveShareVideo($content, $title, $tagName); + $done = $this->saveShareVideo($shareUrl, $title, $tagName); $msg = $done ? '视频保存完成,系统开始自动处理,1 - 3 分钟后刷新就能看到新添加的视频了。' : '视频保存失败,请稍后重试!'; //更新统计数据 @@ -159,18 +159,22 @@ Class FrontApiController extends SiteController { } //保存分享视频 - protected function saveShareVideo($content, $title, $tagName) { + protected function saveShareVideo($shareUrl, $title, $tagName) { $done = true; - $shareUrl = $this->getShareUrlFromContent($content); if (!empty($shareUrl)) { + $video_id = $this->getVideoId($shareUrl); + + //保存url文件以及标题 + $saveUrlRes = $this->saveUrlShortCut($video_id, $shareUrl); + $saveDescRes = $this->saveDescriptionFiles($video_id, array('title' => '处理中,请稍后刷新...')) + //如果没有对接HeroUnion则保存本地任务文件 if (empty(FSC::$app['config']['heroUnionEnable'])) { $done = $done && $this->saveBotTask($shareUrl); } if (!empty($tagName)) { - $video_id = $this->getVideoId($shareUrl); $done = $done && $this->saveVideoToTag($video_id, $tagName); } diff --git a/www/js/tajian.js b/www/js/tajian.js index 47fe022..b6a2a46 100644 --- a/www/js/tajian.js +++ b/www/js/tajian.js @@ -155,7 +155,7 @@ if ($('#add_video_form').get(0)) { btLoading.addClass('elementNone'); if (data.code == 1) { $(inputList[0]).val(''); - alert(data.msg || data.err); + //alert(data.msg || data.err); } else { alert(data.err); } @@ -170,9 +170,7 @@ if ($('#add_video_form').get(0)) { // form表单 if ($('.g_form_js').get(0)) { - $('.g_form_js .jsbtn').click(function (e) { - e.preventDefault(); let inputList = $('.g_form_js input'); @@ -189,8 +187,6 @@ if ($('.g_form_js').get(0)) { btLoading.removeClass('elementNone'); bt.prop('disabled', true); btText.text('请求中...'); - - }); } @@ -294,7 +290,7 @@ if ($('#register_form').get(0)) { btLoading.addClass('elementNone'); if (data.code == 1 && data.shareUrl) { btText.text('完成'); - alert(data.msg); + //alert(data.msg); setTimeout(function() { location.href = data.shareUrl; }, 100); @@ -344,7 +340,7 @@ if ($('#login_form').get(0)) { btLoading.addClass('elementNone'); if (data.code == 1 && data.shareUrl) { btText.text('完成'); - alert(data.msg); + //alert(data.msg); setTimeout(function() { location.href = data.shareUrl; }, 100); @@ -388,7 +384,8 @@ if ($('#nickname_form').get(0)) { bt.prop('disabled', false); btText.text('保存'); if (data.code == 1) { - alert(data.msg); + //alert(data.msg); + location.reload(); } else { alert(data.err); } @@ -487,7 +484,7 @@ if ($('#tags_form').get(0)) { bt.prop('disabled', false); btText.text('保存'); if (data.code == 1) { - alert(data.msg); + //alert(data.msg); location.reload(); } else { alert(data.err); @@ -526,7 +523,7 @@ if ($('#tag_new_form').get(0)) { bt.prop('disabled', false); btText.text('保存'); if (data.code == 1) { - alert(data.msg); + //alert(data.msg); location.reload(); } else { alert(data.err);