From bbf91a77fe4a4c9789097a8edd5b356e4de13736 Mon Sep 17 00:00:00 2001 From: happyme531 <2302004040@qq.com> Date: Sun, 4 Aug 2024 20:09:59 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=9F=B3=E4=B9=90=E7=9B=92]=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0Chimomo=E6=8F=90=E4=BE=9B=E7=9A=84=E4=BA=91=E7=AB=AF?= =?UTF-8?q?=E6=AD=8C=E6=9B=B2API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/cloud/chimomoApi.js" | 12 ++++++------ .../test/cloud/testChimomoApi.js" | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git "a/\346\245\232\347\225\231\351\246\231\351\237\263\344\271\220\347\233\222/src/cloud/chimomoApi.js" "b/\346\245\232\347\225\231\351\246\231\351\237\263\344\271\220\347\233\222/src/cloud/chimomoApi.js" index 0241c2d..ec123e7 100644 --- "a/\346\245\232\347\225\231\351\246\231\351\237\263\344\271\220\347\233\222/src/cloud/chimomoApi.js" +++ "b/\346\245\232\347\225\231\351\246\231\351\237\263\344\271\220\347\233\222/src/cloud/chimomoApi.js" @@ -6,9 +6,9 @@ let axios = require('axios'); /** * @typedef {Object} ChimomoApiFileEntry - * @property {number} id - 文件的唯一标识符 + * @property {string} id - 文件的唯一标识符 (uuid) * @property {string} name - MIDI文件的名称 - * @property {string} url - MIDI文件的下载链接 + * @property {string} type - 文件类型,貌似不影响使用 * @property {string} createdAt - 文件创建的日期和时间,格式为 'YYYY-MM-DD HH:mm:ss' * @property {string} uploader - 上传者的名称 */ @@ -23,7 +23,7 @@ let axios = require('axios'); */ function ChimomoApi() { - const apiBase = "http://autoplay.chimomo.cn/api/v1/" + const apiBase = "https://autoplay.chimomo.cn/api/v1/" /** @@ -34,7 +34,7 @@ function ChimomoApi() { * @param {(err: Error?, data: ChimomoApiMusicList?) => void} callback 回调函数 */ this.fetchMusicList = function (pageNo, pageSize, keyword, callback) { - const url = `${apiBase}midi/list`; + const url = `${apiBase}/song/list`; const params = { pageNo, pageSize, @@ -59,11 +59,11 @@ function ChimomoApi() { /** * @brief 获取音乐文件 - * @param {number} musicId 音乐ID + * @param {string} musicId 音乐ID * @param {(err: Error?, data: import('@tonejs/midi').MidiJSON?) => void} callback 回调函数 */ this.fetchMusicFileById = function (musicId, callback) { - const url = `${apiBase}midi/${musicId}`; + const url = `${apiBase}/song/${musicId}`; let config = { timeout: 5000 }; diff --git "a/\346\245\232\347\225\231\351\246\231\351\237\263\344\271\220\347\233\222/test/cloud/testChimomoApi.js" "b/\346\245\232\347\225\231\351\246\231\351\237\263\344\271\220\347\233\222/test/cloud/testChimomoApi.js" index a0f2247..7d521eb 100644 --- "a/\346\245\232\347\225\231\351\246\231\351\237\263\344\271\220\347\233\222/test/cloud/testChimomoApi.js" +++ "b/\346\245\232\347\225\231\351\246\231\351\237\263\344\271\220\347\233\222/test/cloud/testChimomoApi.js" @@ -15,7 +15,7 @@ describe('ChimomoApi', () => { }); test('fetchMusicFileById', (t, done) => { - api.fetchMusicFileById(949, (err, data) => { + api.fetchMusicFileById('58a38ed3-f8b1-4a6b-a69a-1ca9048ed3d8', (err, data) => { assert.strictEqual(err, null); assert.notStrictEqual(data, undefined); assert.ok(typeof data === 'object');