Browse Source

save url and title immediately when user add new fav

master
filesite 6 months ago
parent
commit
a9f377ebbc
  1. 12
      themes/tajian/controller/FrontapiController.php
  2. 17
      www/js/tajian.js

12
themes/tajian/controller/FrontapiController.php

@ -129,7 +129,7 @@ Class FrontApiController extends SiteController { @@ -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 { @@ -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);
}

17
www/js/tajian.js

@ -155,7 +155,7 @@ if ($('#add_video_form').get(0)) { @@ -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)) { @@ -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)) { @@ -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)) { @@ -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)) { @@ -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)) { @@ -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)) { @@ -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)) { @@ -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);

Loading…
Cancel
Save