-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route/秀动网): add more routes (#13884)
* feat(route): add artist route * feat(route): add brand route * chore: merge '/params' route into '/search' route * chore: fix and clean code * chore: sort new entries in alphabetical order. * chore: add new routes in maintainer * chore: sort maintain entries in alphabetical order. * fix: fix event route
- Loading branch information
Showing
10 changed files
with
212 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { TITLE, HOST } = require('./const'); | ||
const { fetchPerformerInfo } = require('./service'); | ||
|
||
module.exports = async (ctx) => { | ||
const id = ctx.params.id; | ||
const artist = await fetchPerformerInfo({ | ||
performerId: id, | ||
}); | ||
ctx.state.data = { | ||
title: `${TITLE} - ${artist.name}`, | ||
description: artist.content, | ||
link: `${HOST}/artist/${artist.id}`, | ||
item: artist.activityList, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { TITLE, HOST } = require('./const'); | ||
const { fetchBrandInfo } = require('./service'); | ||
|
||
module.exports = async (ctx) => { | ||
const id = ctx.params.id; | ||
const brand = await fetchBrandInfo({ | ||
brandId: id, | ||
}); | ||
ctx.state.data = { | ||
title: `${TITLE} - ${brand.name}`, | ||
description: brand.content, | ||
link: `${HOST}/host/${brand.id}`, | ||
item: brand.activityList, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
module.exports = { | ||
'/artist/:id': ['lchtao26'], | ||
'/brand/:id': ['lchtao26'], | ||
'/event/:cityCode/:showStyle?': ['lchtao26'], | ||
'/search/:keyword': ['lchtao26'], | ||
'/search/:type/:keyword?': ['lchtao26'], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module.exports = (router) => { | ||
router.get('/artist/:id', require('./artist')); | ||
router.get('/brand/:id', require('./brand')); | ||
router.get('/event/:cityCode/:showStyle?', require('./event')); | ||
router.get('/search/:keyword?', require('./search')); | ||
router.get('/params/:type', require('./params')); | ||
router.get('/search/:type/:keyword?', require('./search')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,51 @@ | ||
const { TITLE, HOST } = require('./const'); | ||
const { fetchActivityList } = require('./service'); | ||
const { fetchActivityList, fetchPerformerList, fetchBrandList, fetchCityList, fetchStyleList } = require('./service'); | ||
|
||
module.exports = async (ctx) => { | ||
const keyword = ctx.params.keyword; | ||
const { items } = await fetchActivityList({ | ||
keyword, | ||
}); | ||
ctx.state.data = { | ||
title: `${TITLE} - ${keyword}`, | ||
link: HOST, | ||
item: items, | ||
}; | ||
const type = ctx.params.type || ''; | ||
const keyword = ctx.params.keyword || ''; | ||
|
||
switch (type) { | ||
case 'event': | ||
ctx.state.data = { | ||
title: `${TITLE} - 搜演出 - ${keyword || '全部'}`, | ||
link: HOST, | ||
item: await fetchActivityList({ keyword }), | ||
}; | ||
break; | ||
case 'artist': | ||
ctx.state.data = { | ||
title: `${TITLE} - 搜艺人 - ${keyword || '全部'}`, | ||
link: HOST, | ||
item: await fetchPerformerList({ searchKeyword: keyword }), | ||
}; | ||
break; | ||
case 'brand': | ||
ctx.state.data = { | ||
title: `${TITLE} - 搜厂牌 - ${keyword || '全部'}`, | ||
link: HOST, | ||
item: await fetchBrandList({ searchKeyword: keyword }), | ||
}; | ||
break; | ||
case 'city': | ||
ctx.state.data = { | ||
title: `${TITLE} - 搜城市 - ${keyword || '全部'}`, | ||
link: HOST, | ||
item: await fetchCityList(keyword), | ||
}; | ||
break; | ||
case 'style': | ||
ctx.state.data = { | ||
title: `${TITLE} - 搜风格 - ${keyword || '全部'}`, | ||
link: HOST, | ||
item: await fetchStyleList(keyword), | ||
}; | ||
break; | ||
default: | ||
ctx.state.data = { | ||
title: `${TITLE} - 搜演出 - ${type || '全部'}`, | ||
link: HOST, | ||
item: await fetchActivityList({ keyword: type }), | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters