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 @@ + - - - 帮助中心 - {include file='include/head-nas' /} - + + + 帮助中心 + {include file='include/head-nas' /} + + - - {include file='include/top-header-nas'/} -
- -
-
帮助中心 / 使用教程
- - - -
- -
- -
- -
- -
-
{$article.content|default=''}
-
- -
-
-

目录

-
    -
    -
    -
    -
    - {include file='include/bottom2023'/} - - + $('#dropdown').show().html(html); + } + }) + }, 300); + }) + // 内容 + // 清空标题列表 + $("#title-list ul").empty(); + // 提取 h1 标题 + var h1Titles = $("#rendered-content").find("h3"); + h1Titles.each(function(index) { + var title = $(this); + var titleText = title.text(); + var titleId = "title-" + index; + title.attr("id", titleId); + var listItem = $("
  • "); + var link = $("", { + href: "#" + titleId, + text: titleText + }); + listItem.append(link); + $("#title-list ul").append(listItem); + }); + }); + + + \ No newline at end of file diff --git a/app/mobile/view/tops_nas/beta.phtml b/app/mobile/view/tops_nas/beta.phtml index 7f6e9a9..0821557 100755 --- a/app/mobile/view/tops_nas/beta.phtml +++ b/app/mobile/view/tops_nas/beta.phtml @@ -233,8 +233,8 @@ 3.请遵守国家相关法律、法规,勿上传、下载和分享非法数据
    - 意见反馈 - 帮助中心 + 意见反馈 + 帮助中心
    diff --git a/app/mobile/view/tops_nas/download.phtml b/app/mobile/view/tops_nas/download.phtml index 72e54e8..b5ff8c3 100755 --- a/app/mobile/view/tops_nas/download.phtml +++ b/app/mobile/view/tops_nas/download.phtml @@ -120,6 +120,12 @@ width: 50%; height: 50%; } + .narswljshow .nDtopIt2 .nDitImg .yy_name{ + font-size: 1.1rem; + padding-bottom: 10px; + padding-top:5px; + font-weight: bold; + } diff --git a/app/us/controller/BaseController.php b/app/us/controller/BaseController.php index 84041d9..baf0cc6 100755 --- a/app/us/controller/BaseController.php +++ b/app/us/controller/BaseController.php @@ -175,6 +175,47 @@ class BaseController extends Controller { return $tree; } + protected function buildTree($data, $pid = 0) + { + $tree = []; + foreach ($data as $val) { + if ($val['pid'] == $pid) { + $children = $this->buildTree($data, $val['id']); + if (!empty($children)) { + $val['items'] = $children; + } + $tree[] = $val; + } + } + + return $tree; + } + + /** + * nasNavigation 获取并组装nas专题页的top导航和footer + */ + protected function nasNavigation() + { + $navs = Loader::model('Navigation')->field([ + 'id', + 'pid', + 'name', + 'url', + 'value', + 'data_type', + 'is_new_window_open', + ]) + ->where('stat', '=', 0) + ->where('nav_type', '=', 'tops_nas_header') + ->where('country_code', '=', $this->country_code) + ->order('sort') + ->select(); + + $navs_array = collection($navs)->toArray(); + $header = $this->NavDataDealWith($navs_array); + $this->assign('nav_header', $this->buildTree($header)); + } + //导航初始化 private function navInit(){ // 读取缓存数据 diff --git a/app/us/controller/TopsNas.php b/app/us/controller/TopsNas.php index c9a9935..e3ab4ab 100755 --- a/app/us/controller/TopsNas.php +++ b/app/us/controller/TopsNas.php @@ -1,16 +1,278 @@ alias('b')->field([ + 'b.id', + 'b.typeid', + 'bt.name' => 'typename', + 'bt.description' => 'typedesc', + 'b.name', + 'b.categoryid', + 'b.url', + 'b.picture', + 'b.alt', + 'b.style', + 'b.description' => 'desc', + 'b.descolor', + 'b.btncolor', + 'b.videourl', + ]) + ->join('banner_type bt', 'bt.stat= 0 and bt.id=b.typeid') + ->where('b.stat', '=', 0) + ->where('b.typeid', 'in', $typeids) + ->order(['sort' => 'asc', 'id' => 'asc']) + ->select(); + + $chucks = []; + foreach ($banners as $val) { + if (empty($chucks['typeid_' . $val['typeid']])) { + $chucks['typeid_' . $val['typeid']]['id'] = $val['typeid']; + $chucks['typeid_' . $val['typeid']]['name'] = $val['typename']; + $chucks['typeid_' . $val['typeid']]['desc'] = $val['typedesc']; + $chucks['typeid_' . $val['typeid']]['banners'] = []; + } + + $link = $val['url']; + if (empty($val['url']) && !empty($val['categoryid'])) { + $link = url_rewrite('productsub', ['id' => $val['categoryid']]); + } + $chucks['typeid_' . $val['typeid']]['banners'][] = [ + 'id' => $val['id'], + 'name' => $val['name'], + 'link' => $link, + 'picture' => $val['picture'], + 'alt' => $val['alt'], + 'style' => $val['style'], + 'desc' => $val['desc'], + 'desc_color' => $val['descolor'], + 'btn_color' => $val['btncolor'], + 'video_url' => $val['videourl'], + ]; + } + + return $chucks; + } + + /** + * getCategoryTree 获取特定文章分类树 + */ + private function getCategoryTree($cid) + { + // 设备 + $category = Loader::model('ArticleCategory') + ->field([ + 'id', + 'pid', + 'name', + 'picture' + ]) + ->where('isshow', '=', 1) + ->where(function($query) use($cid) { + $query->where('id', '=', $cid)->WhereOr('pid', '=', $cid); + }) + ->where('country_code', '=', $this->country_code) + ->order(['sort' => 'asc']) + ->select(); + + $category_array = collection($category)->toArray(); + $category_tree = $this->buildTree($category_array, $cid); + return $category_tree; + } + + // 根据分类获取文章 + private function getArticleByCategory($categorys, $limit = null) + { + if (!is_array($categorys)) { + throw new \Exception('请确认分类正确'); + } + if (empty($categorys)) { + return []; + } + + $sub_query = Loader::model('Article') + ->field([ + 'id', + 'cid', + 'name', + 'sort' + ]) + ->where('stat', '=', 0) + ->where('cid', '=', $categorys[0]['id']) + ->where('country_code', '=', $this->country_code) + ->order(['sort' => 'asc', 'id' => 'desc']); + if (!empty($limit)) { + $sub_query = $sub_query->limit($limit); + } + $sub_query = $sub_query->buildSql(); + + $model = \think\Db::table($sub_query . ' a'); + foreach ($categorys as $key => $val) { + if ($key == 0) continue; + $model->union(function ($query) use ($val, $limit) { + $query->name('article')->field([ + 'id', + 'cid', + 'name', + 'sort' + ]) + ->where('stat', '=', 0) + ->where('cid', '=', $val['id']) + ->where('country_code', '=', $this->country_code) + ->order(['sort' => 'asc', 'id' => 'desc']); + if (!empty($limit)) { + $query->limit($limit); + } + }); + } + + $map = []; + $data = $data = $model->select(); + foreach ($data as $key => $val) { + $map['cid_' . $val['cid']][] = $val; + } + return $map; + } + + // 帮助中心 + public function helper() + { + // 获取分类 + $categorys = $this->getCategoryTree(77); + // 获取文章 + $articles = $this->getArticleByCategory($categorys, 3); + // 组装数据 + foreach ($categorys as $key => &$val) { + if (!isset($val['articles'])) { + $val['articles'] = []; + } + if (isset($articles['cid_' . $val['id']])) { + $items = $articles['cid_' . $val['id']]; + foreach ($items as $k => $v) { + $val['articles'][] = [ + 'id' => $v['id'], + 'name' => $v['name'] + ]; + } + } + } + unset($val); + $this->assign('categorys', $categorys); + + // 获取banner + $banners = $this->getBanners(128); + if (!empty($banners)) { + $banners = $banners['typeid_128']['banners']; + } + $this->assign('banners', $banners); + $this->assign('banners_size', count($banners)); + + return $this->fetch(); + } + + // 搜索帮助文章 + public function helper_search() + { + $base_category = 77; + $keywords = request()->param('keywords'); + $articles = Loader::model('Article') + ->field([ + 'id', + 'name', + 'sort', + ]) + ->where('stat', '=', 0) + ->where('country_code', '=', $this->country_code) + ->where('cid', 'in', function ($query) use ($base_category) { + $query->name('article_category') + ->field(['id']) + ->where('id', '=', $base_category) + ->whereOr('pid', '=', $base_category); + }) + ->where(function ($query) use ($keywords) { + if (!empty($keywords)) { + $query->where('name', 'like', '%' . $keywords . '%'); + } + }) + ->order(['sort' => 'asc', 'id' => 'desc']) + ->select(); + + return json([ + 'code' => 0, + 'message' => '获取成功', + 'data' => $articles + ]); + } + + // 帮助中心文章详细 + public function helper_detail() + { + $id = request()->param('id'); + $article = Loader::model('Article')->where('id', '=', $id)->find(); + + if (request()->isAjax()) { + return json([ + 'code' => 0, + 'message' => '获取成功', + 'data' => $article + ]); + } else { + // 获取分类 + $categorys = $this->getCategoryTree(77); + // 获取文章 + $articles = $this->getArticleByCategory($categorys); + // 组装数据 + foreach ($categorys as $key => &$val) { + if (!isset($val['articles'])) { + $val['articles'] = []; + } + if (isset($articles['cid_' . $val['id']])) { + $items = $articles['cid_' . $val['id']]; + foreach ($items as $k => $v) { + $val['articles'][] = [ + 'id' => $v['id'], + 'name' => $v['name'] + ]; + } + } + } + unset($val); + $this->assign('categorys', $categorys); + $this->assign('article', $article); + $this->assign('cid', request()->param('cid', $article->cid)); + } + + return $this->fetch(); + } + + // 下载 public function download() { + $focus_image = []; + $downloads = []; + // 获取banner + $banners = $this->getBanners([129, 130]); + if (!empty($banners)) { + $focus_image = $banners['typeid_130']['banners']; + $downloads = $banners['typeid_129']['banners']; + } + $this->assign('focus_image', $focus_image); + $this->assign('downloads', $downloads); + return $this->fetch(); } diff --git a/app/us/view/include/bottom2023.phtml b/app/us/view/include/bottom2023.phtml new file mode 100755 index 0000000..fd6f1b6 --- /dev/null +++ b/app/us/view/include/bottom2023.phtml @@ -0,0 +1,202 @@ + + + diff --git a/app/us/view/include/top-header-nas.phtml b/app/us/view/include/top-header-nas.phtml index 39c2f7f..2575621 100755 --- a/app/us/view/include/top-header-nas.phtml +++ b/app/us/view/include/top-header-nas.phtml @@ -2,33 +2,15 @@
    + style="cursor:pointer;width: 13rem;height: 2.8rem;" + src="__PUBLIC__/web/images/newlogo_nas.png" />
    @@ -36,8 +18,9 @@ + \ No newline at end of file diff --git a/app/us/view/tops_nas/download.phtml b/app/us/view/tops_nas/download.phtml index 48dd254..12ca245 100755 --- a/app/us/view/tops_nas/download.phtml +++ b/app/us/view/tops_nas/download.phtml @@ -1,36 +1,167 @@ - - - - 元创官网 - - - {include file='include/head-nas'/} - - -
    - - - -
    -
    -
    - -
    - - -
    - - -
    - - -
    -
    -
    - {include file='include/bottom'/} - - + + + + 元创官网 + + + {include file='include/head-nas'/} + + + + +
    + + {include file='include/top-header-nas'/} +
    + +
    +
    + +
    + {if condition="!empty($downloads)"} +
    + {volist name="downloads" id="vo"} + +
    +
    {$vo.name}
    +
    Download
    +
    +
    + {/volist} +
    + {/if} +
    +
    + {include file='include/bottom2023'/} + + + \ No newline at end of file diff --git a/app/us/view/tops_nas/helper.phtml b/app/us/view/tops_nas/helper.phtml new file mode 100644 index 0000000..fcdf3ce --- /dev/null +++ b/app/us/view/tops_nas/helper.phtml @@ -0,0 +1,555 @@ + + + + + + + 帮助中心 + {include file='include/head-nas' /} + + + + +
    + + {include file='include/top-header-nas'/} + +
    + + + + +
    + +
    +

    User's Guide

    +
    + {if condition="!empty($categorys)"} + {volist name="categorys" id="vo"} +
    +
    + {$vo.name} +
    +
    + {volist name="vo.articles" id="va"} + +
    + {$va.name} + + + +
    + {/volist} + {if condition="count($vo.articles) >= 3"} + Click to view more + + + + + {/if} +
    +
    + {/volist} + {/if} +
    +
    + + +
    + {include file='include/bottom2023'/} + + + + \ No newline at end of file diff --git a/app/us/view/tops_nas/helper_detail.phtml b/app/us/view/tops_nas/helper_detail.phtml new file mode 100644 index 0000000..d1477df --- /dev/null +++ b/app/us/view/tops_nas/helper_detail.phtml @@ -0,0 +1,452 @@ + + + + + + + 帮助中心 + {include file='include/head-nas' /} + + + + + + {include file='include/top-header-nas'/} +
    + +
    +
    Quick Start Guide
    + + + +
    + +
    + +
    + +
    + +
    +
    {$article.content|default=''}
    +
    + +
    +
    +

    Content

    +
      +
      +
      +
      +
      + {include file='include/bottom2023'/} + + + + \ No newline at end of file diff --git a/app/usmobile/controller/BaseController.php b/app/usmobile/controller/BaseController.php index 308ca2c..31a3d59 100755 --- a/app/usmobile/controller/BaseController.php +++ b/app/usmobile/controller/BaseController.php @@ -15,6 +15,9 @@ class BaseController extends Controller { //当前用户 protected $customer_id = 0; + // 当前国家编码 + protected $country_code = 'US'; + public function __construct() { parent::__construct(); } @@ -71,6 +74,47 @@ class BaseController extends Controller { $this->view->assign('allCategoryList', $this->categoryList); } + protected function buildTree($data, $pid = 0) + { + $tree = []; + foreach ($data as $val) { + if ($val['pid'] == $pid) { + $children = $this->buildTree($data, $val['id']); + if (!empty($children)) { + $val['items'] = $children; + } + $tree[] = $val; + } + } + + return $tree; + } + + /** + * nasNavigation 获取并组装nas专题页的top导航和footer + */ + protected function nasNavigation() + { + $navs = Loader::model('Navigation')->field([ + 'id', + 'pid', + 'name', + 'url', + 'value', + 'data_type', + 'is_new_window_open', + ]) + ->where('stat', '=', 0) + ->where('nav_type', '=', 'tops_nas_header') + ->where('country_code', '=', $this->country_code) + ->order('sort') + ->select(); + + $navs_array = collection($navs)->toArray(); + $header = $this->NavDataDealWith($navs_array); + $this->assign('nav_header', $this->buildTree($header)); + } + //导航初始化 private function navInit(){ // 读取缓存数据 diff --git a/app/usmobile/controller/TopsNas.php b/app/usmobile/controller/TopsNas.php index af87026..a496a6c 100755 --- a/app/usmobile/controller/TopsNas.php +++ b/app/usmobile/controller/TopsNas.php @@ -1,16 +1,267 @@ alias('b')->field([ + 'b.id', + 'b.typeid', + 'bt.name' => 'typename', + 'bt.description' => 'typedesc', + 'b.name', + 'b.categoryid', + 'b.url', + 'b.picture', + 'b.alt', + 'b.style', + 'b.description' => 'desc', + 'b.descolor', + 'b.btncolor', + 'b.videourl', + ]) + ->join('banner_type bt', 'bt.stat= 0 and bt.id=b.typeid') + ->where('b.stat', '=', 0) + ->where('b.typeid', 'in', $typeids) + ->order(['sort' => 'asc', 'id' => 'asc']) + ->select(); + + $chucks = []; + foreach ($banners as $val) { + if (empty($chucks['typeid_' . $val['typeid']])) { + $chucks['typeid_' . $val['typeid']]['id'] = $val['typeid']; + $chucks['typeid_' . $val['typeid']]['name'] = $val['typename']; + $chucks['typeid_' . $val['typeid']]['desc'] = $val['typedesc']; + $chucks['typeid_' . $val['typeid']]['banners'] = []; + } + + $link = $val['url']; + if (empty($val['url']) && !empty($val['categoryid'])) { + $link = url_rewrite('productsub', ['id' => $val['categoryid']]); + } + $chucks['typeid_' . $val['typeid']]['banners'][] = [ + 'id' => $val['id'], + 'name' => $val['name'], + 'link' => $link, + 'picture' => $val['picture'], + 'alt' => $val['alt'], + 'style' => $val['style'], + 'desc' => $val['desc'], + 'desc_color' => $val['descolor'], + 'btn_color' => $val['btncolor'], + 'video_url' => $val['videourl'], + ]; + } + + return $chucks; + } + + public function helper() + { + // 获取分类 + $categorys = $this->getCategoryTree(77); + // 获取文章 + $articles = $this->getArticleByCategory($categorys, 3); + // 组装数据 + foreach ($categorys as $key => &$val) { + if (!isset($val['articles'])) { + $val['articles'] = []; + } + if (isset($articles['cid_' . $val['id']])) { + $items = $articles['cid_' . $val['id']]; + foreach ($items as $k => $v) { + $val['articles'][] = [ + 'id' => $v['id'], + 'name' => $v['name'] + ]; + } + } + } + unset($val); + $this->assign('categorys', $categorys); + + $banners = $this->getBanners(128); + if (!empty($banners)) { + $banners = $banners['typeid_128']['banners']; + } + $this->assign('banners', $banners); + $this->assign('banners_size', count($banners)); + + return $this->fetch(); + } + + public function helper_search() + { + $base_category = 77; + $keywords = request()->param('keywords'); + $articles = Loader::model('Article') + ->field([ + 'id', + 'name', + 'sort', + ]) + ->where('stat', '=', 0) + ->where('country_code', '=', $this->country_code) + ->where('cid', 'in', function ($query) use ($base_category) { + $query->name('article_category') + ->field(['id']) + ->where('id', '=', $base_category) + ->whereOr('pid', '=', $base_category); + }) + ->where(function ($query) use ($keywords) { + if (!empty($keywords)) { + $query->where('name', 'like', '%' . $keywords . '%'); + } + }) + ->order(['sort' => 'asc', 'id' => 'desc']) + ->select(); + + return json([ + 'code' => 0, + 'message' => '获取成功', + 'data' => $articles + ]); + } + + /** + * getCategoryTree 获取特定文章分类树 + */ + private function getCategoryTree($cid = 36) + { + // 设备 + $category = Loader::model('ArticleCategory') + ->field([ + 'id', + 'pid', + 'name', + 'picture' + ]) + ->where('isshow', '=', 1) + ->where('country_code', '=', $this->country_code) + ->order(['sort' => 'asc']) + ->select(); + $category_array = collection($category)->toArray(); + $category_tree = $this->buildTree($category_array, $cid); + return $category_tree; + } + + // 根据分类获取文章 + private function getArticleByCategory($categorys, $limit = null) + { + if (!is_array($categorys)) { + throw new \Exception('请确认分类正确'); + } + if (empty($categorys)) { + return []; + } + + $sub_query = Loader::model('Article') + ->field([ + 'id', + 'cid', + 'name', + 'sort' + ]) + ->where('stat', '=', 0) + ->where('cid', '=', $categorys[0]['id']) + ->where('country_code', '=', $this->country_code) + ->order(['sort' => 'asc', 'id' => 'desc']); + if (!empty($limit)) { + $sub_query = $sub_query->limit($limit); + } + $sub_query = $sub_query->buildSql(); + + $model = \think\Db::table($sub_query . ' a'); + foreach ($categorys as $key => $val) { + if ($key == 0) continue; + $model->union(function ($query) use ($val, $limit) { + $query->name('article')->field([ + 'id', + 'cid', + 'name', + 'sort' + ]) + ->where('stat', '=', 0) + ->where('cid', '=', $val['id']) + ->where('country_code', '=', $this->country_code) + ->order(['sort' => 'asc', 'id' => 'desc']); + if (!empty($limit)) { + $query->limit($limit); + } + }); + } + + $map = []; + $data = $data = $model->select(); + foreach ($data as $key => $val) { + $map['cid_' . $val['cid']][] = $val; + } + return $map; + } + + public function helper_detail() + { + $id = request()->param('id'); + $article = Loader::model('Article')->where('id', '=', $id)->find(); + + if (request()->isAjax()) { + return json([ + 'code' => 0, + 'message' => '获取成功', + 'data' => $article + ]); + } else { + // 获取分类 + $categorys = $this->getCategoryTree(77); + // 获取文章 + $articles = $this->getArticleByCategory($categorys,); + // 组装数据 + foreach ($categorys as $key => &$val) { + if (!isset($val['articles'])) { + $val['articles'] = []; + } + if (isset($articles['cid_' . $val['id']])) { + $items = $articles['cid_' . $val['id']]; + foreach ($items as $k => $v) { + $val['articles'][] = [ + 'id' => $v['id'], + 'name' => $v['name'] + ]; + } + } + } + unset($val); + $this->assign('categorys', $categorys); + $this->assign('article', $article); + $this->assign('cid', request()->param('cid')); + } + + return $this->fetch(); } public function download() { + $focus_image = []; + $downloads = []; + // 获取banner + $banners = $this->getBanners([129, 130]); + if (!empty($banners)) { + $focus_image = $banners['typeid_130']['banners']; + $downloads = $banners['typeid_129']['banners']; + } + $this->assign('focus_image', $focus_image); + $this->assign('downloads', $downloads); + return $this->fetch(); } diff --git a/app/usmobile/view/include/top_nas.phtml b/app/usmobile/view/include/top_nas.phtml new file mode 100755 index 0000000..4b172bd --- /dev/null +++ b/app/usmobile/view/include/top_nas.phtml @@ -0,0 +1,174 @@ +
      +
      +
      + +
      +
      + + + + + + + + + +
      +
      + +
      + + + + + + \ No newline at end of file diff --git a/app/usmobile/view/tops_nas/download.phtml b/app/usmobile/view/tops_nas/download.phtml index eabb554..acdc416 100755 --- a/app/usmobile/view/tops_nas/download.phtml +++ b/app/usmobile/view/tops_nas/download.phtml @@ -1,270 +1,186 @@ - - - - 元创官网 - - {include file='include/head-nas'/} - + - .narsmb-wlj { - width: 100%; - display: flex; - flex-direction: column; - } - - .narsmb-wlj .narsmbwlj-title { - text-align: center; - font-size: 1.6875rem; - font-weight: bold; - padding-top: 2.0625rem; - padding-bottom: 1.3125rem; - } - - .narsmb-wlj .narsmbwltitem { - margin: 0 0.4375rem; - height: 9.0625rem; - background: #131b28; - display: flex; - flex-direction: row; - justify-content: space-between; - margin-bottom: 0.5rem; - } - - .narsmb-wlj .narsmbwltitem .narsmbwljcp { - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; - height: inherit; - } - - .narsmb-wlj .narsmbwltitem .narsmbwljcp .narsmbtt { - font-size: 1.0625rem; - font-weight: bold; - color: #fff; - width: 35.5rem; - text-align: center; - margin-left: 35%; - } - - .narsmb-wlj .narsmbwltitem .narsmbwljcp .narsmbwljimg { - height: inherit; - } - - .narsmb-wlj .narsmbwltitem .narsmbwljcpinfo { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - color: #fff; - flex: 1; - margin: 0 1.25rem; - } - - .narsmb-wlj .narsmbwltitem .narsmbwljcpinfo .narsmbif-title { - font-weight: bold; - font-size: 1.0625rem; - padding-bottom: 1rem; - } - - .narsmb-wlj .narsmbwltitem .narsmbwljcpinfo .narsmbif-info { - font-size: 0.625rem; - line-height: 1rem; - text-align: center; - } - - .narsmb-wlj .narsmbwltitem .narsmbwljcpinfo .narsmbwlj-xzbt { - width: 7.25rem; - height: 2.1875rem; - border-radius: 3.25rem; - line-height: 2.1875rem; - border: 1px solid #ffffff; - font-size: 0.875rem; - text-align: center; - cursor: pointer; - margin: 0 1.25rem; - } - - .narsmb-wlj .narsmbwltitem .narsmbwljcpinfo .narsmbtt { - font-size: 1.0625rem; - font-weight: bold; - color: #fff; - text-align: center; - } - - .narsMBbannerSwiper { - padding-top: 0px; - } - - - - - - - -
      - -
      -
      -
      - -
      - -
      - -
      -
      + + {include file='include/top_nas'/} +
      +
      + +
      +
      +
      - - - {include file='include/bottom'/} + {if condition="!empty($downloads)"} +
      + {volist name="downloads" id="vo"} + +
      + +
      {$vo.name}
      +
      Download
      +
      +
      + {/volist} +
      + {/if}
      - - - + {include file='include/bottom'/} +
      + + + \ No newline at end of file diff --git a/app/usmobile/view/tops_nas/helper.phtml b/app/usmobile/view/tops_nas/helper.phtml new file mode 100644 index 0000000..86ed5cb --- /dev/null +++ b/app/usmobile/view/tops_nas/helper.phtml @@ -0,0 +1,425 @@ + + + + + + 帮助中心 + + {include file='include/head-nas' /} + + + + +
      +
      + + + + +
      + +

      User's Guide

      + {volist name="categorys" id="vo"} +
      +
      + {$vo.name} +
      +
      + {volist name="vo.articles" id="va"} + +
      + {$va.name} + +
      + {/volist} + {if condition="count($vo.articles) >= 3"} + +
      Click to view more
      +
      + {/if} +
      +
      + {/volist} +

      Contact US

      +
      + {if condition="$banners_size > 0"} + {if condition="!empty($banners[0]['link'])"} + + {else/} + + {/if} + + {$banners[0]['name']} + {$banners[0]['desc']} + + {/if} + {if condition="$banners_size > 1"} + {if condition="!empty($banners[1]['link'])"} + + {else/} + + {/if} + + {$banners[1]['name']} + {$banners[1]['desc']} + + {/if} + {if condition="$banners_size > 2"} + {if condition="!empty($banners[2]['link'])"} + + {else/} + + {/if} + + {$banners[2]['name']}
      {$banners[2]['desc']}
      +
      + {/if} + {if condition="$banners_size > 3"} + {if condition="!empty($banners[3]['link'])"} + + {else/} + + {/if} + + {$banners[3]['name']}
      {$banners[3]['desc']}
      +
      + {/if} + {if condition="$banners_size > 4"} + {if condition="!empty($banners[4]['link'])"} + + {else/} + + {/if} + + {$banners[4]['name']}
      {$banners[4]['desc']}
      +
      + {/if} +
      + + + {include file="include/bottom" /} +
      + + + + \ No newline at end of file diff --git a/app/usmobile/view/tops_nas/helper_detail.phtml b/app/usmobile/view/tops_nas/helper_detail.phtml new file mode 100644 index 0000000..c611ddd --- /dev/null +++ b/app/usmobile/view/tops_nas/helper_detail.phtml @@ -0,0 +1,348 @@ + + + + + + 帮助中心 + + {include file='include/head-nas' /} + + + + +
      +
      + +
      + + +
      +
      +
      {$article.content|default=''}
      + + + +
      +
      + +
      +
      + {include file="include/bottom" /} +
      + + + \ No newline at end of file diff --git a/public/frontend/web/css/nas.css b/public/frontend/web/css/nas.css index 63cec2e..4117c0a 100755 --- a/public/frontend/web/css/nas.css +++ b/public/frontend/web/css/nas.css @@ -67,8 +67,8 @@ a { display: flex; flex-direction: row; align-items: center; - justify-content: space-between; - width: 75rem; + /*justify-content: space-between;*/ + width: 82rem; margin: 0 auto; }