Browse Source

improve task add, handle failed task

master
filesite 6 months ago
parent
commit
4b0a75560e
  1. 13
      themes/tajian/controller/FrontapiController.php
  2. 4
      www/js/tajian.js

13
themes/tajian/controller/FrontapiController.php

@ -130,10 +130,14 @@ Class FrontApiController extends SiteController {
if ($code == 1) { //保存视频 if ($code == 1) { //保存视频
$done = $this->saveShareVideo($shareUrl, $title, $tagName); $done = $this->saveShareVideo($shareUrl, $title, $tagName);
$msg = $done ? '视频保存完成,系统开始自动处理,1 - 3 分钟后刷新就能看到新添加的视频了。' : '视频保存失败,请稍后重试!'; $msg = '保存完成,系统开始自动处理,1 - 3 分钟后刷新就能看到新添加的收藏了。';
if (!$done) {
$msg = '';
$err = '收藏保存失败,请确认分享网址格式正确并稍后重试!';
$code = 0;
}else {
//更新统计数据 //更新统计数据
if ($done) {
$stats = TajianStats::init(); $stats = TajianStats::init();
TajianStats::increase('video'); TajianStats::increase('video');
$saved = TajianStats::save(); $saved = TajianStats::save();
@ -174,7 +178,10 @@ Class FrontApiController extends SiteController {
if (!empty(FSC::$app['config']['heroUnionEnable'])) { if (!empty(FSC::$app['config']['heroUnionEnable'])) {
$platformName = Html::getShareVideosPlatform($shareUrl); $platformName = Html::getShareVideosPlatform($shareUrl);
$heroUnionConfig = FSC::$app['config']['heroUnion']; $heroUnionConfig = FSC::$app['config']['heroUnion'];
$this->addHeroUnionTask($shareUrl, $heroUnionConfig['supportedPlatforms'][$platformName]); $addTaskRes = $this->addHeroUnionTask($shareUrl, $heroUnionConfig['supportedPlatforms'][$platformName]);
if (empty($addTaskRes['code'])) {
$done = false;
}
} }
} }

4
www/js/tajian.js

@ -151,7 +151,11 @@ if ($('#add_video_form').get(0)) {
btText.text('提交'); btText.text('提交');
btLoading.addClass('elementNone'); btLoading.addClass('elementNone');
if (data.code == 1) { if (data.code == 1) {
if (data.err) {
alert(data.err);
}else {
$(inputList[0]).val(''); $(inputList[0]).val('');
}
//alert(data.msg || data.err); //alert(data.msg || data.err);
} else { } else {
alert(data.err); alert(data.err);

Loading…
Cancel
Save