增加特色服务

This commit is contained in:
2026-03-20 09:12:57 +08:00
parent a7908e0677
commit 14c305f518
13 changed files with 896 additions and 333 deletions
+10 -10
View File
@@ -15,10 +15,10 @@ $app = new App(__DIR__ . '/../../../');
$app->initialize();
// 获取当前域名
$host = $_SERVER['HTTP_HOST'] ?? '';
$baseUrl = $_SERVER['HTTP_HOST'];
// 查询域名对应的租户ID
$tenantDomain = TenantDomain::where('full_domain', $host)
$tenantDomain = TenantDomain::where('full_domain', $baseUrl)
->where('status', 1)
->whereNull('delete_time')
->find();
@@ -40,7 +40,7 @@ if ($tid > 0) {
if (!empty($banner['image'])) {
if (!preg_match('/^https?:\/\//', $banner['image'])) {
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
$banner['image'] = $scheme . '://' . $host .
$banner['image'] = $scheme . '://' . $baseUrl .
(strpos($banner['image'], '/') === 0 ? '' : '/') . $banner['image'];
}
}
@@ -71,12 +71,12 @@ if ($tid > 0) {
// 处理图片路径
if (!empty($article['image']) && !preg_match('/^https?:\/\//', $article['image'])) {
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
$article['image'] = $scheme . '://' . $host .
$article['image'] = $scheme . '://' . $baseUrl .
(strpos($article['image'], '/') === 0 ? '' : '/') . $article['image'];
}
if (!empty($article['thumb']) && !preg_match('/^https?:\/\//', $article['thumb'])) {
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
$article['thumb'] = $scheme . '://' . $host .
$article['thumb'] = $scheme . '://' . $baseUrl .
(strpos($article['thumb'], '/') === 0 ? '' : '/') . $article['thumb'];
}
}
@@ -117,17 +117,17 @@ if ($tid > 0) {
// 处理图片路径
if (!empty($companyInfo['logo']) && !preg_match('/^https?:\/\//', $companyInfo['logo'])) {
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
$companyInfo['logo'] = $scheme . '://' . $host .
$companyInfo['logo'] = $scheme . '://' . $baseUrl .
(strpos($companyInfo['logo'], '/') === 0 ? '' : '/') . $companyInfo['logo'];
}
if (!empty($companyInfo['logow']) && !preg_match('/^https?:\/\//', $companyInfo['logow'])) {
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
$companyInfo['logow'] = $scheme . '://' . $host .
$companyInfo['logow'] = $scheme . '://' . $baseUrl .
(strpos($companyInfo['logow'], '/') === 0 ? '' : '/') . $companyInfo['logow'];
}
if (!empty($companyInfo['ico']) && !preg_match('/^https?:\/\//', $companyInfo['ico'])) {
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
$companyInfo['ico'] = $scheme . '://' . $host .
$companyInfo['ico'] = $scheme . '://' . $baseUrl .
(strpos($companyInfo['ico'], '/') === 0 ? '' : '/') . $companyInfo['ico'];
}
@@ -615,7 +615,7 @@ function stripHtml($html)
const bannerContainer = document.getElementById('banner-container');
if (!bannerContainer) return;
fetch(API_BASE_URL + '/getBanners')
fetch(API_BASE_URL + '/getBanners?baseUrl=' + window.location.hostname)
.then(res => res.json())
.then(result => {
if (result.code !== 200 || !result.list || result.list.length === 0) {
@@ -710,7 +710,7 @@ function stripHtml($html)
const container = document.getElementById('friendlink-container');
if (!container) return;
fetch(API_BASE_URL + '/homeData')
fetch(API_BASE_URL + '/homeData?baseUrl=' + window.location.hostname)
.then(res => res.json())
.then(result => {
if (result.code !== 200 || !result.data || !result.data.links || result.data.links.length === 0) {