This commit is contained in:
Your Name
2026-08-25 09:35:47 +08:00
parent 1f3e580cf8
commit 01c38d8c5b
13 changed files with 855 additions and 92 deletions
@@ -20,13 +20,13 @@ class QywxPromotionPublicController extends BaseApiController
return response('/* promotion pool not found */', 404, ['Content-Type' => 'application/javascript; charset=utf-8']);
}
// 由安装脚本自身的 src 解析 API 域名,避免把请求 Host 写入可公开缓存的 JavaScript。
$goUrl = '/api/qywx-promotion/go/' . $key;
$targetUrl = (string) ($pool['target_url'] ?? '');
$config = QywxPromotionWidgetService::decode($pool['widget_config_json'] ?? null);
$javascript = QywxPromotionWidgetService::renderScript(
$key,
$goUrl,
$targetUrl,
$config,
(int) ($pool['status'] ?? 0) === 1
(int) ($pool['status'] ?? 0) === 1 && $targetUrl !== ''
);
return response($javascript, 200, [