feat(route): add freeOnly option for MyMusicSheet (#13450)
* feat: add mymusicsheet route * Update mymusicsheet route * fix: missing iso after the price * docs: add wikipedia page for ISO 4217 * docs: add empty line after MyMusicSheet * feat: add free sheet retreive option for mymusicsheet-user sheets * fix: wrong route data in maintainer.js * fix: wrong route data in maintainer.js * Update lib/v2/mymusicsheet/templates/description.art * Update lib/v2/mymusicsheet/templates/description.art * feat: allow only retrieve free sheets ---------
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/user/sheets/:username/:iso?': ['Freddd13'],
|
||||
'/user/sheets/:username/:iso?/:freeOnly?': ['Freddd13'],
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/user/sheets/:username/:iso?', require('./usersheets'));
|
||||
router.get('/user/sheets/:username/:iso?/:freeOnly?', require('./usersheets'));
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
||||
const baseUrl = 'https://www.mymusicsheet.com';
|
||||
const graphqlUrl = 'https://mms.pd.mapia.io/mms/graphql';
|
||||
const exchangeRateUrl = 'https://payport.pd.mapia.io/v2/currency';
|
||||
const { username, iso = 'CNY' } = ctx.params;
|
||||
const { username, iso = 'CNY', freeOnly } = ctx.params;
|
||||
|
||||
const exchangeRateResponse = await got(exchangeRateUrl, {
|
||||
searchParams: {
|
||||
@@ -65,7 +65,7 @@ module.exports = async (ctx) => {
|
||||
orderBy: {
|
||||
createdAt: 'DESC',
|
||||
},
|
||||
isFree: null,
|
||||
isFree: Boolean(freeOnly),
|
||||
category: null,
|
||||
artistUrl: username,
|
||||
aggregationKeywords: ['PACKAGE_IDS', 'TAG_IDS', 'INSTRUMENTS', 'SHEET_TYPE', 'INCLUDE_CHORD', 'INCLUDE_LYRICS', 'INSTRUMENTATION', 'LEVEL', 'CATEGORY'],
|
||||
|
||||
@@ -272,7 +272,8 @@ Language
|
||||
|
||||
### User Sheets {#mymusicsheet-user-sheets}
|
||||
|
||||
<Route author="Freddd13" example="/mymusicsheet/HalcyonMusic" path="/mymusicsheet/user/sheets/:username/:iso?" paramsDesc={['用户名,可在URL中找到', '用于显示价格的ISO 4217货币代码, 支持常见代码, 默认为人民币, 即`CNY`']} radar="1" rssbud="1"/>
|
||||
|
||||
<Route author="Freddd13" example="/mymusicsheet/user/sheets/HalcyonMusic/USD/1" path="/mymusicsheet/user/sheets/:username/:iso?/:freeOnly?" paramsDesc={['用户名,可在URL中找到', '用于显示价格的ISO 4217货币代码, 支持常见代码, 默认为人民币, 即`CNY`', '只返回免费谱, 任意值为开启']} radar="1" rssbud="1"/>
|
||||
|
||||
关于ISO 4217,请参考[维基百科](https://zh.wikipedia.org/zh-cn/ISO_4217#%E7%8E%B0%E8%A1%8C%E4%BB%A3%E7%A0%81)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user