From a835f5483dac8fe0a07b9cecfa5e3d36daabffe8 Mon Sep 17 00:00:00 2001 From: filesite Date: Sat, 13 Apr 2024 22:33:13 +0800 Subject: [PATCH] bug fix for HeroUnion parameter sign --- conf/app.php | 7 +++++++ themes/tajian/controller/FrontapiController.php | 8 +++++--- www/js/tajian.js | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/conf/app.php b/conf/app.php index 1947e04..8426880 100644 --- a/conf/app.php +++ b/conf/app.php @@ -100,6 +100,13 @@ $configs = array( 'lang' => 'zh', 'data_mode' => 'json', 'notify_url' => 'https://tajian.tv/frontapi/hunotify', + + 'supportedPlatforms' => array( + '抖音' => 'douyin', + '快手' => 'kuaishou', + '西瓜视频' => 'xigua', + 'B站' => 'bilibili', + ), ), ); diff --git a/themes/tajian/controller/FrontapiController.php b/themes/tajian/controller/FrontapiController.php index 489f96e..f65f70c 100644 --- a/themes/tajian/controller/FrontapiController.php +++ b/themes/tajian/controller/FrontapiController.php @@ -140,8 +140,9 @@ Class FrontApiController extends SiteController { } //调用HeroUnion联盟接口,提交新的数据抓取任务 - $platform = Html::getShareVideosPlatform($shareUrl); - $this->addHeroUnionTask($shareUrl, $platform); + $platformName = Html::getShareVideosPlatform($shareUrl); + $heroUnionConfig = FSC::$app['config']['heroUnion']; + $this->addHeroUnionTask($shareUrl, $heroUnionConfig['supportedPlatforms'][$platformName]); } return $done; @@ -191,7 +192,8 @@ Class FrontApiController extends SiteController { } protected function sign($params, $token) { //对参数做MD5签名 - return md5( json_encode(ksort($params)) . $token ); + ksort($params); + return md5( json_encode($params, JSON_UNESCAPED_SLASHES) . $token ); } //提交视频抓取任务到HeroUnion英雄联盟 diff --git a/www/js/tajian.js b/www/js/tajian.js index 1f8193b..81c6c0e 100644 --- a/www/js/tajian.js +++ b/www/js/tajian.js @@ -99,8 +99,6 @@ if ($('#add_video_form').get(0)) { // 添加视频表单处理 $('#add_video_form .jsbtn').click(function (e) { - console.log('btn clicked'); - e.preventDefault(); let inputList = $('#add_video_form input'); if (!inputList[0].value) { @@ -126,6 +124,7 @@ if ($('#add_video_form').get(0)) { // console.log(apiUrl); publicAjax(apiUrl, 'POST', datas, function (data) { bt.prop('disabled', false); + btText.text('提交'); btLoading.addClass('elementNone'); if (data.code == 1) { $(inputList[0]).val(''); @@ -135,6 +134,7 @@ if ($('#add_video_form').get(0)) { } }, function (jqXHR, textStatus, errorThrown) { bt.prop('disabled', false); + btText.text('提交'); btLoading.removeClass('elementNone'); console.log(jqXHR);