View.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller;
  12. use crmeb\basic\BaseController;
  13. class View extends BaseController
  14. {
  15. public function mobile()
  16. {
  17. $siteName = systemConfig('site_name');
  18. $https = (parse_url(systemConfig('site_url'))['scheme'] ?? '') == 'https';
  19. $url = set_http_type($this->request->url(true), $https ? 0 : 1);
  20. $url .= (strpos($url, '?') === false ? '?' : '&');
  21. $url .= 'inner_frame=1';
  22. return \think\facade\View::fetch('/mobile/view', compact('siteName', 'url'));
  23. }
  24. public function h5()
  25. {
  26. if ((!$this->request->isMobile()) && (!$this->request->param('inner_frame')) && !strpos($this->request->server('HTTP_USER_AGENT'), 'MicroMessenger')) return $this->mobile();
  27. $DB = DIRECTORY_SEPARATOR;
  28. return view(app()->getRootPath() . 'public' . $DB . 'index.html');
  29. }
  30. }