diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php index b49abea..64cf36e 100755 --- a/app/common/controller/BaseController.php +++ b/app/common/controller/BaseController.php @@ -8,7 +8,8 @@ use think\Db; use think\Cache; use think\Config; -class BaseController extends Controller { +class BaseController extends Controller +{ //当前网站ID protected $siteid = 32267; @@ -20,6 +21,7 @@ class BaseController extends Controller { protected $controller; protected $action; protected $langid; + protected $country_code; public function __construct() { @@ -46,10 +48,10 @@ class BaseController extends Controller { $this->lang = 'zh-cn'; $this->view->assign('lang', $this->lang); $this->view->assign('langid', $this->langid); - + $uuid = createGuid(); $this->view->assign('uuid', $uuid); - + // 该服务停用了,导致访问慢,暂时注释 // setMomitorFeed($this->request->controller(), $uuid); @@ -77,22 +79,22 @@ class BaseController extends Controller { $url = $this->request->url(true); if ($url == 'https://www.orico.com.cn/index.php') - return $this->redirect('https://www.orico.com.cn'); + return $this->redirect('https://www.orico.com.cn'); - if ($this->request->isMobile() && strpos($base_url, 'mobile') === false) - { + if ($this->request->isMobile() && strpos($base_url, 'mobile') === false) { $ctrl = \think\helper\Str::snake($this->controller); if ($ctrl == 'tops_nas') { + if ($this->country_code == 'US') { + return $this->redirect(url("@usmobile/$ctrl/$action")); + } return $this->redirect(url("@mobile/$ctrl/$action")); } - - if (strpos($domain, 'orico.cc')) - { + + if (strpos($domain, 'orico.cc')) { // 英文 if ($base_url == '/') return $this->redirect($scheme . '://www.orico.cc/usmobile.html'); // 首页 - else if ($controller == 'product') - { + else if ($controller == 'product') { // 产品 $id = $this->request->param('id'); if ($action == 'catelists') @@ -103,29 +105,21 @@ class BaseController extends Controller { return $this->redirect($scheme . '://www.orico.cc/usmobile/product/detail/id/' . $id . '.html'); else if ($action == 'new_arrival') return $this->redirect($scheme . '://www.orico.cc/usmobile/product/new_arrival.html'); - } - else if ($controller == 'article') - { + } else if ($controller == 'article') { // 新闻 - $id = $this->request->param('id'); - if ($action == 'catelists') - { + $id = $this->request->param('id'); + if ($action == 'catelists') { $page = $this->request->param('page'); $page = isset($page) ? $page : 1; - } - else if ($action == 'detail') + } else if ($action == 'detail') return $this->redirect($scheme . '://www.orico.cc/usmobile/article/detail/id/' . $id . '.html'); - } - else if ($controller == 'group') + } else if ($controller == 'group') return $this->redirect($scheme . '://www.orico.cc/usmobile/' . $controller . '/' . $action . '.html'); - } - else - { + } else { // 中文 if ($base_url == '/') return $this->redirect($scheme . '://www.orico.com.cn/mobile.html'); // 首页 - else if ($controller == 'product') - { + else if ($controller == 'product') { // 产品 $id = $this->request->param('id'); if ($action == 'catelists') @@ -134,42 +128,35 @@ class BaseController extends Controller { return $this->redirect($scheme . '://www.orico.com.cn/mobile/product/subcatelists/id/' . $id . '.html'); else if ($action == 'detail') return $this->redirect($scheme . '://www.orico.com.cn/mobile/product/detail/id/' . $id . '.html'); - } - else if ($controller == 'article') - { + } else if ($controller == 'article') { // 新闻 $id = $this->request->param('id'); - - if ($action == 'catelists') - { + + if ($action == 'catelists') { $page = $this->request->param('page'); $page = isset($page) ? $page : 1; - } - else if ($action == 'detail') + } else if ($action == 'detail') return $this->redirect($scheme . '://www.orico.com.cn/mobile/article/detail/id/' . $id . '.html'); - } - else if ($controller == 'group'){ - + } else if ($controller == 'group') { + /*if($action == 'oricoindex'){ return $this->redirect($scheme . '://www.orico.com.cn/mobile'); }*/ return $this->redirect($scheme . '://www.orico.com.cn/mobile/' . $controller . '/' . $action . '.html'); } - - } } - } //空操作 - public function _empty() { - if ($_SERVER['HTTP_HOST']=="www.orico.com.cn" && $_SERVER['HTTP_HOST']=="orico.com.cn") { - return $this->redirect("http://orico.com.cn"); - } elseif ($_SERVER['HTTP_HOST']=="www.orico.cc" || $_SERVER['HTTP_HOST']=="orico.cc") { - return $this->redirect("http://orico.cc"); + public function _empty() + { + if ($_SERVER['HTTP_HOST'] == "www.orico.com.cn" && $_SERVER['HTTP_HOST'] == "orico.com.cn") { + return $this->redirect("http://orico.com.cn"); + } elseif ($_SERVER['HTTP_HOST'] == "www.orico.cc" || $_SERVER['HTTP_HOST'] == "orico.cc") { + return $this->redirect("http://orico.cc"); } - return exception(_lang_('This operation not valid')); + return exception(_lang_('This operation not valid')); } /** @@ -178,12 +165,14 @@ class BaseController extends Controller { * @param integer $id id * @return bool 检测结果 */ - protected function verify_check($code, $id = '') { + protected function verify_check($code, $id = '') + { $verify = new \verify\Verify(); return $verify->check($code, $id); } - protected function verify_build($id = '', $cfg = []) { + protected function verify_build($id = '', $cfg = []) + { //$verify = new \verify\Verify((array) Config::get('captcha')); $config = [ 'expire' => 900, // 验证码过期时间(s) @@ -206,7 +195,8 @@ class BaseController extends Controller { * @param string $name 缓存变量名 * @return bool */ - public function cacheHas($name) { + public function cacheHas($name) + { return Cache::has($name); } @@ -218,7 +208,8 @@ class BaseController extends Controller { * @param int|null $expire 有效时间 0为永久 * @return boolean */ - public function cacheSet($name, $value, $expire = null) { + public function cacheSet($name, $value, $expire = null) + { return Cache::set($name, $value, $expire); } @@ -229,7 +220,8 @@ class BaseController extends Controller { * @param mixed $default 默认值 * @return mixed */ - public function cacheGet($name, $default = false) { + public function cacheGet($name, $default = false) + { return Cache::get($name, $default); } @@ -240,7 +232,8 @@ class BaseController extends Controller { * @param string $name 缓存标识 * @return boolean */ - public function cacheDelete($name) { + public function cacheDelete($name) + { return Cache::rm($name); } @@ -250,7 +243,8 @@ class BaseController extends Controller { * @param string $tag 标签名 * @return boolean */ - public function cacheClear($tag = null) { + public function cacheClear($tag = null) + { return Cache::clear($tag); } @@ -260,7 +254,8 @@ class BaseController extends Controller { * @param string $name 缓存变量名 * @return mixed */ - public function cachePull($name) { + public function cachePull($name) + { return Cache::pull($name); } @@ -272,7 +267,8 @@ class BaseController extends Controller { * @param int $expire 有效时间 0为永久 * @return mixed */ - public function cacheRemember($name, $value, $expire = null) { + public function cacheRemember($name, $value, $expire = null) + { return Cache::remember($name, $value, $expire); } @@ -284,7 +280,8 @@ class BaseController extends Controller { * @param bool $overlay 是否覆盖 * @return Driver */ - public function cacheTag($name, $keys = null, $overlay = false) { + public function cacheTag($name, $keys = null, $overlay = false) + { return Cache::tag($name, $keys, $overlay); } @@ -296,7 +293,8 @@ class BaseController extends Controller { * @param array $data 返回数据 * @return json */ - public function json($code, $msg, $data=null) { + public function json($code, $msg, $data = null) + { $result = [ 'code' => $code, 'msg' => $msg, @@ -307,5 +305,4 @@ class BaseController extends Controller { echo json_encode($result); exit; } - } diff --git a/app/index/view/tops_nas/helper_detail.phtml b/app/index/view/tops_nas/helper_detail.phtml index ebf21c1..2ce50d2 100644 --- a/app/index/view/tops_nas/helper_detail.phtml +++ b/app/index/view/tops_nas/helper_detail.phtml @@ -1,402 +1,452 @@ +
- - -
-