Browse Source

bug fix for HeroUnion parameter sign

master
filesite 8 months ago
parent
commit
a835f5483d
  1. 7
      conf/app.php
  2. 8
      themes/tajian/controller/FrontapiController.php
  3. 4
      www/js/tajian.js

7
conf/app.php

@ -100,6 +100,13 @@ $configs = array(
'lang' => 'zh', 'lang' => 'zh',
'data_mode' => 'json', 'data_mode' => 'json',
'notify_url' => 'https://tajian.tv/frontapi/hunotify', 'notify_url' => 'https://tajian.tv/frontapi/hunotify',
'supportedPlatforms' => array(
'抖音' => 'douyin',
'快手' => 'kuaishou',
'西瓜视频' => 'xigua',
'B站' => 'bilibili',
),
), ),
); );

8
themes/tajian/controller/FrontapiController.php

@ -140,8 +140,9 @@ Class FrontApiController extends SiteController {
} }
//调用HeroUnion联盟接口,提交新的数据抓取任务 //调用HeroUnion联盟接口,提交新的数据抓取任务
$platform = Html::getShareVideosPlatform($shareUrl); $platformName = Html::getShareVideosPlatform($shareUrl);
$this->addHeroUnionTask($shareUrl, $platform); $heroUnionConfig = FSC::$app['config']['heroUnion'];
$this->addHeroUnionTask($shareUrl, $heroUnionConfig['supportedPlatforms'][$platformName]);
} }
return $done; return $done;
@ -191,7 +192,8 @@ Class FrontApiController extends SiteController {
} }
protected function sign($params, $token) { //对参数做MD5签名 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英雄联盟 //提交视频抓取任务到HeroUnion英雄联盟

4
www/js/tajian.js

@ -99,8 +99,6 @@ if ($('#add_video_form').get(0)) {
// 添加视频表单处理 // 添加视频表单处理
$('#add_video_form .jsbtn').click(function (e) { $('#add_video_form .jsbtn').click(function (e) {
console.log('btn clicked');
e.preventDefault(); e.preventDefault();
let inputList = $('#add_video_form input'); let inputList = $('#add_video_form input');
if (!inputList[0].value) { if (!inputList[0].value) {
@ -126,6 +124,7 @@ if ($('#add_video_form').get(0)) {
// console.log(apiUrl); // console.log(apiUrl);
publicAjax(apiUrl, 'POST', datas, function (data) { publicAjax(apiUrl, 'POST', datas, function (data) {
bt.prop('disabled', false); bt.prop('disabled', false);
btText.text('提交');
btLoading.addClass('elementNone'); btLoading.addClass('elementNone');
if (data.code == 1) { if (data.code == 1) {
$(inputList[0]).val(''); $(inputList[0]).val('');
@ -135,6 +134,7 @@ if ($('#add_video_form').get(0)) {
} }
}, function (jqXHR, textStatus, errorThrown) { }, function (jqXHR, textStatus, errorThrown) {
bt.prop('disabled', false); bt.prop('disabled', false);
btText.text('提交');
btLoading.removeClass('elementNone'); btLoading.removeClass('elementNone');
console.log(jqXHR); console.log(jqXHR);

Loading…
Cancel
Save