Skip to content

Commit

Permalink
fix: route ‘/gov/zj/search/:websiteid?/:word/:cateid?’ result.item de…
Browse files Browse the repository at this point in the history
…duplication (#16730)

* feat: 宁波市人力资源保障局-某分类-公告列表

* feat: 宁波国资委-某分类-公告列表

* Update lib/routes/gov/zj/ningborsjnotice.ts

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/routes/gov/zj/ningbogzw-notice.ts

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/routes/gov/zj/ningbogzw-notice.ts

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/routes/gov/zj/ningborsjnotice.ts

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* fix: description content indent update

* fix: route ‘/gov/zj/search/:websiteid?/:word/:cateid?’ result.item deduplication

* fix: route ‘/gov/zj/search/:websiteid?/:word/:cateid?’ result.item deduplication

---------
  • Loading branch information
HaoyuLee authored Oct 17, 2024
1 parent b8695ad commit f8d7e71
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions lib/routes/gov/zj/search.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Route } from '@/types';
import { Route, DataItem } from '@/types';
import { parseDate } from '@/utils/parse-date';
import got from '@/utils/got';
import { load } from 'cheerio';
import dayjs from 'dayjs';

export const route: Route = {
path: '/zj/search/:websiteid?/:word/:cateid?',
categories: ['government'],
Expand All @@ -24,18 +23,18 @@ export const route: Route = {
url: 'search.zj.gov.cn/jsearchfront/search.do',
maintainers: ['HaoyuLee'],
description: `
| 行政区域 | websiteid |
| ------------ | -- |
| 宁波市本级 | 330201000000000 |
| 行政区域 | websiteid |
| ------------ | -- |
| 宁波市本级 | 330201000000000 |
| 搜索关键词 | word |
| 搜索关键词 | word |
| 信息分类 | cateid |
| 信息分类 | cateid |
| 排序类型 | sortType |
| ------------ | -- |
| 按相关度 | 1 |
| 按时间 | 2 |
| 排序类型 | sortType |
| ------------ | -- |
| 按相关度 | 1 |
| 按时间 | 2 |
`,
async handler(ctx) {
const { websiteid = '330201000000000', word = '人才', cateid = 658, sortType = 2 } = ctx.req.param();
Expand Down Expand Up @@ -71,10 +70,16 @@ export const route: Route = {
description: $('.newsDescribe>a').text() || '',
};
}) || [];
const res = {};
for (const current of items) {
if (!res[current.link]) {
res[current.link] = current;
}
}
return {
title: '浙江省人民政府-全省政府网站统一搜索',
link: 'https://search.zj.gov.cn/jsearchfront/search.do',
item: items,
item: Object.entries(res).map(([, value]) => value) as DataItem[],
};
},
};

0 comments on commit f8d7e71

Please sign in to comment.