From 7d0ed2252042e9a1c71c12dc0207f70d3ae1a6c9 Mon Sep 17 00:00:00 2001 From: liqian <735273025@qq.com> Date: Fri, 24 Jan 2025 11:18:16 +0800 Subject: [PATCH 1/4] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=9C=A8=E6=96=B0=E7=AA=97=E5=8F=A3=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/tops_nas/helper.phtml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/index/view/tops_nas/helper.phtml b/app/index/view/tops_nas/helper.phtml index 6874f10..db14761 100644 --- a/app/index/view/tops_nas/helper.phtml +++ b/app/index/view/tops_nas/helper.phtml @@ -365,7 +365,7 @@

联系我们

{if condition="$banners_size > 0"} - + {if condition="!empty($banners[0]['picture']) && $banners[0]['picture'] != '/uploads/nopic.jpg'"} @@ -375,64 +375,64 @@ {/if} {if condition="$banners_size > 1"} - + {if condition="!empty($banners[1]['picture']) && $banners[1]['picture'] != '/uploads/nopic.jpg'"} {/if} {$banners[1]['name']} {$banners[1]['desc']} - + {/if} {if condition="$banners_size > 2"} - + {if condition="!empty($banners[2]['picture']) && $banners[2]['picture'] != '/uploads/nopic.jpg'"} {/if} {$banners[2]['name']} {$banners[2]['desc']} - + {/if} {if condition="$banners_size > 3"} - + {if condition="!empty($banners[3]['picture']) && $banners[3]['picture'] != '/uploads/nopic.jpg'"} {/if} {$banners[3]['name']} {$banners[3]['desc']} - + {/if} {if condition="$banners_size > 4"} - + {if condition="!empty($banners[4]['picture']) && $banners[4]['picture'] != '/uploads/nopic.jpg'"} {/if} {$banners[4]['name']} {$banners[4]['desc']} - + {/if} {if condition="$banners_size > 5"} - + {if condition="!empty($banners[5]['picture']) && $banners[5]['picture'] != '/uploads/nopic.jpg'"} {/if} {$banners[5]['name']} {$banners[5]['desc']} - + {/if} {if condition="$banners_size > 6"} - + {if condition="!empty($banners[6]['picture']) && $banners[6]['picture'] != '/uploads/nopic.jpg'"} {/if} {$banners[6]['name']} {$banners[6]['desc']} - + {/if}
From 627c0adbff8432c9b32a2d03673cbb36dec420ff Mon Sep 17 00:00:00 2001 From: liqian <735273025@qq.com> Date: Wed, 5 Feb 2025 15:57:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9nas=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=B8=AE=E5=8A=A9=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/mobile/controller/TopsNas.php | 168 ++++++++ app/mobile/view/tops_nas/guide.phtml | 2 + app/mobile/view/tops_nas/helper.phtml | 382 +++++++++++++++++++ app/mobile/view/tops_nas/helper_detail.phtml | 286 ++++++++++++++ 4 files changed, 838 insertions(+) create mode 100644 app/mobile/view/tops_nas/helper.phtml create mode 100644 app/mobile/view/tops_nas/helper_detail.phtml diff --git a/app/mobile/controller/TopsNas.php b/app/mobile/controller/TopsNas.php index 2a9cbe2..e8e15cb 100755 --- a/app/mobile/controller/TopsNas.php +++ b/app/mobile/controller/TopsNas.php @@ -147,6 +147,7 @@ class TopsNas extends BaseController 'id', 'pid', 'name', + 'picture' ]) ->where('isshow', '=', 1) ->where('country_code', '=', $this->country_code) @@ -263,4 +264,171 @@ class TopsNas extends BaseController return $this->fetch(); } + + // 根据分类获取文章 + 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(76); + // 获取文章 + $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(127); + if (!empty($banners)) { + $banners = $banners['typeid_127']['banners']; + } + $this->assign('banners', $banners); + $this->assign('banners_size', count($banners)); + + return $this->fetch(); + } + + // 搜索帮助文章 + public function helper_search() + { + $base_category = 76; + $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(76); + // 获取文章 + $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(); + } } diff --git a/app/mobile/view/tops_nas/guide.phtml b/app/mobile/view/tops_nas/guide.phtml index e1863b5..3897495 100755 --- a/app/mobile/view/tops_nas/guide.phtml +++ b/app/mobile/view/tops_nas/guide.phtml @@ -148,6 +148,7 @@ display: flex; flex-direction: row; align-items: center; + flex-wrap: wrap; } .narsjswdMbPage .narsjswd-mb-list .jswdmb-item .jswdmb-tags .jswdmb-tag { font-size: 0.75rem; @@ -155,6 +156,7 @@ border: 0.0625rem solid #000; border-radius: 0.125rem; margin-right: 0.5rem; + margin-bottom: 0.5rem; } .narsjswdMbPage .narsjswd-mb-list .jswdmb-item .jswdmb-tags .tagmnjswdtype1 { color: #00c5dd; diff --git a/app/mobile/view/tops_nas/helper.phtml b/app/mobile/view/tops_nas/helper.phtml new file mode 100644 index 0000000..85f5aa4 --- /dev/null +++ b/app/mobile/view/tops_nas/helper.phtml @@ -0,0 +1,382 @@ + + + + + 帮助中心 + + {include file='include/head-nas' /} + + + +
+
+ + +
+ +

使用教程

+ {volist name="categorys" id="vo"} +
+
+ {$vo.name} +
+
+ {volist name="vo.articles" id="va"} + +
+ {$va.name} + +
+ {/volist} + {if condition="count($vo.articles) >= 3"} + +
查看更多
+
+ {/if} +
+
+ {/volist} +

联系我们

+
+ {if condition="$banners_size > 0"} + + + {if condition="!empty($banners[0]['picture']) && $banners[0]['picture'] != '/uploads/nopic.jpg'"} + + {/if} + {$banners[0]['name']} + {$banners[0]['desc']} + + {/if} + {if condition="$banners_size > 1"} + + + {if condition="!empty($banners[1]['picture']) && $banners[1]['picture'] != '/uploads/nopic.jpg'"} + + {/if} + {$banners[1]['name']} + {$banners[1]['desc']} + + {/if} + {if condition="$banners_size > 2"} + + + {if condition="!empty($banners[2]['picture']) && $banners[2]['picture'] != '/uploads/nopic.jpg'"} + + {/if} + {$banners[2]['name']}
{$banners[2]['desc']}
+
+ {/if} + {if condition="$banners_size > 3"} + + + {if condition="!empty($banners[3]['picture']) && $banners[3]['picture'] != '/uploads/nopic.jpg'"} + + {/if} + {$banners[3]['name']}
{$banners[3]['desc']}
+
+ {/if} + {if condition="$banners_size > 4"} + + + {if condition="!empty($banners[4]['picture']) && $banners[4]['picture'] != '/uploads/nopic.jpg'"} + + {/if} + {$banners[4]['name']}
{$banners[4]['desc']}
+
+ {/if} + {if condition="$banners_size > 5"} + + + {if condition="!empty($banners[5]['picture']) && $banners[5]['picture'] != '/uploads/nopic.jpg'"} + + {/if} + {$banners[5]['name']}
{$banners[5]['desc']}
+
+ {/if} + {if condition="$banners_size > 6"} + + + {if condition="!empty($banners[6]['picture']) && $banners[6]['picture'] != '/uploads/nopic.jpg'"} + + {/if} + {$banners[6]['name']}
{$banners[6]['desc']}
+
+ {/if} +
+ + + {include file="include/bottom1" /} +
+ + + \ No newline at end of file diff --git a/app/mobile/view/tops_nas/helper_detail.phtml b/app/mobile/view/tops_nas/helper_detail.phtml new file mode 100644 index 0000000..c9ff6b0 --- /dev/null +++ b/app/mobile/view/tops_nas/helper_detail.phtml @@ -0,0 +1,286 @@ + + + + + 帮助中心 + + {include file='include/head-nas' /} + + + +
+
+ +
+ + +
+
+
{$article.content|default=''}
+ + + +
+ +
+ {include file="include/bottom1" /} +
+ + + \ No newline at end of file From 1a221945a3d505ac286fdcf5e0da0d59d8018e37 Mon Sep 17 00:00:00 2001 From: liqian <735273025@qq.com> Date: Mon, 17 Feb 2025 15:49:17 +0800 Subject: [PATCH 3/4] =?UTF-8?q?nas=E5=B8=AE=E5=8A=A9=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/tops_nas/beta.phtml | 4 +- app/index/view/tops_nas/helper.phtml | 59 ++++++++++---------- app/index/view/tops_nas/helper_detail.phtml | 6 ++ app/index/view/tops_nas/index.phtml | 1 - app/mobile/view/tops_nas/beta.phtml | 7 ++- app/mobile/view/tops_nas/download.phtml | 5 +- app/mobile/view/tops_nas/helper.phtml | 59 ++++++++------------ app/mobile/view/tops_nas/helper_detail.phtml | 38 ++++++++++--- 8 files changed, 101 insertions(+), 78 deletions(-) diff --git a/app/index/view/tops_nas/beta.phtml b/app/index/view/tops_nas/beta.phtml index c46c3cb..6c2becf 100755 --- a/app/index/view/tops_nas/beta.phtml +++ b/app/index/view/tops_nas/beta.phtml @@ -225,8 +225,8 @@ 3.请遵守国家相关法律、法规,勿上传、下载和分享非法数据
- 意见反馈 - 帮助中心 + 意见反馈 + 帮助中心
diff --git a/app/index/view/tops_nas/helper.phtml b/app/index/view/tops_nas/helper.phtml index db14761..80a7d41 100644 --- a/app/index/view/tops_nas/helper.phtml +++ b/app/index/view/tops_nas/helper.phtml @@ -6,6 +6,9 @@ 帮助中心 {include file='include/head-nas' /} - - {include file='include/top-header-nas'/}
+ + {include file='include/top-header-nas'/}
@@ -444,32 +447,32 @@ // 监听输入框内容变化 var timeout = null; $('#search-input').on('focus input', function() { - clearTimeout(timeout); - var _this = this; - timeout = setTimeout(function () { - var keywords = $(_this).val(); - if (keywords == '') { - $('#dropdown').hide().html(''); - return; - } - $.ajax({ - url: "{:url('tops_nas/helper_search')}", - type: 'POST', - data: {keywords: keywords}, - dataType: 'JSON', - success: function(r) { - var html = ''; - if (r.code == 0) { - html = '' - } - $('#dropdown').show().html(html); - } - }) - }, 300); + clearTimeout(timeout); + var _this = this; + timeout = setTimeout(function () { + var keywords = $(_this).val(); + if (keywords == '') { + $('#dropdown').hide().html(''); + return; + } + $.ajax({ + url: "{:url('tops_nas/helper_search')}", + type: 'POST', + data: {keywords: keywords}, + dataType: 'JSON', + success: function(r) { + var html = ''; + if (r.code == 0) { + html = '' + } + $('#dropdown').show().html(html); + } + }) + }, 300); }) $(document).on('click', function (e) { var target = $(e.target); diff --git a/app/index/view/tops_nas/helper_detail.phtml b/app/index/view/tops_nas/helper_detail.phtml index 91f2a7b..ebf21c1 100644 --- a/app/index/view/tops_nas/helper_detail.phtml +++ b/app/index/view/tops_nas/helper_detail.phtml @@ -6,6 +6,9 @@ 帮助中心 {include file='include/head-nas' /} {include file='include/head-nas'/}