From e19cb3b937e251067165e8e63be4a579941071c8 Mon Sep 17 00:00:00 2001 From: filesite Date: Sat, 13 Apr 2024 20:24:41 +0800 Subject: [PATCH] add data save notify handler --- .../tajian/controller/FrontapiController.php | 74 +++++++++++++++---- 1 file changed, 60 insertions(+), 14 deletions(-) diff --git a/themes/tajian/controller/FrontapiController.php b/themes/tajian/controller/FrontapiController.php index 9f05000..35cc275 100644 --- a/themes/tajian/controller/FrontapiController.php +++ b/themes/tajian/controller/FrontapiController.php @@ -148,7 +148,8 @@ Class FrontApiController extends SiteController { //保存分享视频到任务文件 protected function saveBotTask($url) { - $task_dir = __DIR__ . '/../../../runtime/' . FSC::$app['config']['tajian']['task_dir']; + $task_dir = realpath(__DIR__ . '/../../../runtime/' + . FSC::$app['config']['tajian']['task_dir']); if (!is_dir($task_dir)) { mkdir($task_dir, 0755, true); } @@ -161,9 +162,9 @@ Class FrontApiController extends SiteController { //保存分享视频到tag分类 //TODO: 如果高并发,需要避免数据被覆盖的问题 protected function saveVideoToTag($url, $tagName) { - $tag_dir = __DIR__ . '/../../../www/' - . FSC::$app['config']['content_directory'] - . '/' . FSC::$app['config']['tajian']['tag_dir']; + $tag_dir = realpath(__DIR__ . '/../../../www/' + . FSC::$app['config']['content_directory'] + . '/' . FSC::$app['config']['tajian']['tag_dir']); if (!is_dir($tag_dir)) { mkdir($tag_dir, 0755, true); } @@ -213,23 +214,66 @@ Class FrontApiController extends SiteController { return !empty($res) && $res['status'] == 200 ? $res['result'] : false; } - //TODO: 保存快捷方式 + //保存快捷方式 protected function saveUrlShortCut($task_id, $task_url) { + $data_dir = realpath(__DIR__ . '/../../../runtime/' + . FSC::$app['config']['tajian']['data_dir']); + if (!is_dir($data_dir)) { + mkdir($data_dir, 0755, true); + } + + $shortUrlContent = <<post('task_id', ''); @@ -261,6 +305,8 @@ Class FrontApiController extends SiteController { if (strtolower($mySign) != strtolower($sign)) { $code = 0; $err = '签名验证不通过!'; + }else { + } }