initialize(); // 获取当前域名 $host = $_SERVER['HTTP_HOST'] ?? ''; // 查询域名对应的租户ID $tenantDomain = TenantDomain::where('full_domain', $host) ->where('status', 1) ->whereNull('delete_time') ->find(); $tid = $tenantDomain ? (int) $tenantDomain['tid'] : 0; // 获取 Banner 数据 $banners = []; if ($tid > 0) { $banners = Banner::where('tid', $tid) ->whereNull('delete_time') ->order('sort', 'asc') ->order('id', 'desc') ->select() ->toArray(); // 处理图片路径 foreach ($banners as &$banner) { if (!empty($banner['image'])) { if (!preg_match('/^https?:\/\//', $banner['image'])) { $scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http'; $banner['image'] = $scheme . '://' . $host . (strpos($banner['image'], '/') === 0 ? '' : '/') . $banner['image']; } } } } // 获取新闻数据 $articles = []; if ($tid > 0) { $articles = Articles::where('tid', $tid) ->where('delete_time', null) ->where('status', 2) ->order('publish_date', 'desc') ->limit(8) ->select() ->toArray(); // 处理图片:如果文章image为空,则取分类的image foreach ($articles as &$article) { if (empty($article['image']) && !empty($article['cate'])) { $category = ArticlesCategory::where('id', $article['cate']) ->where('delete_time', null) ->find(); if ($category && !empty($category['image'])) { $article['image'] = $category['image']; } } // 处理图片路径 if (!empty($article['image']) && !preg_match('/^https?:\/\//', $article['image'])) { $scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http'; $article['image'] = $scheme . '://' . $host . (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 . (strpos($article['thumb'], '/') === 0 ? '' : '/') . $article['thumb']; } } } // 获取企业联系信息和站点设置 $companyInfo = []; if ($tid > 0) { // 获取租户信息 $tenant = Tenant::where('id', $tid) ->where('delete_time', null) ->field('contact_phone, contact_email, address, worktime') ->find(); // 获取站点设置 $siteSetting = \app\model\System\SystemSiteSetting::where('tid', $tid) ->where('delete_time', null) ->find(); $companyInfo = array_merge( $tenant ? $tenant->toArray() : [], $siteSetting ? $siteSetting->toArray() : [] ); } else { $companyInfo = [ 'sitename' => '', 'logo' => '', 'logow' => '', 'ico' => '', 'description' => '', 'contact_phone' => '-', 'contact_email' => '-', 'address' => '-', 'worktime' => '-' ]; } // 处理图片路径 if (!empty($companyInfo['logo']) && !preg_match('/^https?:\/\//', $companyInfo['logo'])) { $scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http'; $companyInfo['logo'] = $scheme . '://' . $host . (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 . (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 . (strpos($companyInfo['ico'], '/') === 0 ? '' : '/') . $companyInfo['ico']; } // 辅助函数:去除 HTML 标签 function stripHtml($html) { if (empty($html)) return ''; $text = preg_replace('/<[^>]+>/', ' ', $html); $text = preg_replace('/\s+/', ' ', $text); return trim($text); } ?> <?php echo !empty($companyInfo['sitename']) ? $companyInfo['sitename'] : '实例 - 云泽网模板'; ?>

新闻中心

Read More

关于我们

特色业务

我们始终以专业、高效、创新为核心,深耕行业多年,形成了独具优势的特色业务体系。凭借成熟的服务流程、过硬的技术实力与丰富的实战经验,为客户提供一站式、定制化解决方案。

Basic Design

Web Design

$ 29.00

  • Carefully crafted components
  • Amazing page examples
  • Super friendly support team
  • Awesome Support
Get Started
Standard Design

Web Development

$ 89.00

  • Carefully crafted components
  • Amazing page examples
  • Super friendly support team
  • Awesome Support
Get Started
Pro Design

Design & Develop

$ 199.00

  • Carefully crafted components
  • Amazing page examples
  • Super friendly support team
  • Awesome Support
Get Started

联系我们

如果您有任何需求,欢迎联系我们!

+86

友情链接