Skip to content

Commit c6860e0

Browse files
committed
适配支持标签云 TagManager 模块
1 parent fb87df3 commit c6860e0

File tree

49 files changed

+2951
-2839
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2951
-2839
lines changed

config/module.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
'VisitStatistic' => [
3535
'enable' => true,
3636
],
37-
// 'Notice' => [
38-
// 'enable' => true,
39-
// ],
4037
// 'BlogAdminApi' => [
4138
// 'enable' => true,
4239
// ],

module/Blog/Admin/Controller/BlogController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use ModStart\Widget\TextLink;
2323
use Module\Blog\Core\BlogSiteUrlBiz;
2424
use Module\Blog\Core\BlogSuperSearchBiz;
25+
use Module\Blog\Core\BlogTagManagerBiz;
2526
use Module\Blog\Type\BlogVisitMode;
2627
use Module\Blog\Util\BlogCategoryUtil;
2728
use Module\Blog\Util\BlogTagUtil;
@@ -103,10 +104,12 @@ protected function crud(AdminCRUDBuilder $builder)
103104
return Response::generateSuccess();
104105
})
105106
->hookChanged(function (Form $form) use (&$updatedCategoryIds) {
106-
RepositoryUtil::makeItems($form->item())->map(function ($item) use (&$updatedCategoryIds) {
107+
$tags = [];
108+
RepositoryUtil::makeItems($form->item())->map(function ($item) use (&$updatedCategoryIds, &$tags) {
107109
$updatedCategoryIds[] = $item->categoryId;
108110
SiteUrlProvider::updateBiz(BlogSiteUrlBiz::NAME, modstart_web_url('blog/' . $item->id), $item->title);
109111
BlogSuperSearchBiz::syncUpsert([$item->toArray()]);
112+
$tags[] = $item->tag;
110113
});
111114
if (!empty($updatedCategoryIds)) {
112115
$updatedCategoryIds = array_unique($updatedCategoryIds);
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace Module\Blog\Core;
4+
5+
use ModStart\Core\Dao\ModelUtil;
6+
use ModStart\Core\Util\TagUtil;
7+
use Module\Blog\Model\Blog;
8+
use Module\TagManager\Biz\AbstractTagManagerBiz;
9+
10+
class BlogTagManagerBiz extends AbstractTagManagerBiz
11+
{
12+
const NAME = 'Blog';
13+
14+
public function name()
15+
{
16+
return self::NAME;
17+
}
18+
19+
public function title()
20+
{
21+
return '博客系统';
22+
}
23+
24+
public function searchUrl($tag)
25+
{
26+
return modstart_web_url('blogs', ['keywords' => $tag]);
27+
}
28+
29+
public function syncBatch($nextId)
30+
{
31+
$batch = ModelUtil::batch(Blog::class, $nextId, 100);
32+
TagUtil::recordsString2Array($batch['records'], ['tag']);
33+
$tags = [];
34+
foreach ($batch['records'] as $record) {
35+
$tags = array_merge($tags, $record['tag']);
36+
}
37+
$data = [];
38+
$data['nextId'] = $batch['nextId'];
39+
$data['tags'] = $tags;
40+
$data['finish'] = empty($batch['records']);
41+
return $data;
42+
}
43+
44+
45+
}

module/Blog/Core/ModuleServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Module\MemberLike\Event\MemberLikeChangeEvent;
2121
use Module\Partner\Biz\PartnerPositionBiz;
2222
use Module\Reward\Biz\RewardBiz;
23+
use Module\TagManager\Biz\TagManagerBiz;
2324
use Module\Vendor\Admin\Widget\AdminWidgetDashboard;
2425
use Module\Vendor\Admin\Widget\AdminWidgetLink;
2526
use Module\Vendor\Provider\HomePage\HomePageProvider;
@@ -130,6 +131,9 @@ public function boot(Dispatcher $events)
130131
}
131132
});
132133
}
134+
if (modstart_module_enabled('TagManager')) {
135+
TagManagerBiz::register(BlogTagManagerBiz::class);
136+
}
133137
ScheduleBiz::register(BlogAutoPostScheduleBiz::class);
134138
}
135139

module/Blog/Docs/release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 3.6.0
22

3+
- 新增:适配支持标签云 TagManager 模块
34
- 修复:博客上一篇下一篇链接错误问题
45

56
---

module/Blog/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"PayCenter",
3030
"HotSearch",
3131
"ShareJS",
32-
"Notice"
32+
"Notice",
33+
"TagManager"
3334
],
3435
"config": {}
3536
}

public/asset/common/editor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/asset/common/uploadButton.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/asset/entry/basic.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/asset/entry/dataFileManager.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)