update: 返回数据优化

This commit is contained in:
binaryify 2024-05-07 15:30:04 +08:00
parent 15a2e1bcdf
commit b6310e1b24
4 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,9 @@
# 更新日志 # 更新日志
### 4.19.1 | 2024.05.07
- 返回数据优化
### 4.19.0 | 2024.05.07 ### 4.19.0 | 2024.05.07
- 云贝签到接口替换 - 云贝签到接口替换

View File

@ -1,6 +1,6 @@
{ {
"name": "NeteaseCloudMusicApi", "name": "NeteaseCloudMusicApi",
"version": "4.19.0", "version": "4.19.1",
"description": "网易云音乐 NodeJS 版 API", "description": "网易云音乐 NodeJS 版 API",
"scripts": { "scripts": {
"start": "node app.js", "start": "node app.js",

View File

@ -22,7 +22,9 @@
<label for="noFormat" class="ml-2">不格式化(针对返回内容解析)</label> <label for="noFormat" class="ml-2">不格式化(针对返回内容解析)</label>
</div> </div>
<div> <div>
<p>解密结果: {{ result }}</p> <p>解密结果:
<pre>{{ JSON.stringify(JSON.parse(result), null, 2) }}</pre>
</p>
</div> </div>
</div> </div>
@ -34,7 +36,7 @@
data() { data() {
return { return {
hexString: 'AD96DDB984491E79B6F429DD650C6E2AE524627AC223AC9A123C66BB0997965950FED137544A93DFC718E16F57C8C121AF537086F395570A5602A3922366D11964DAFACD7830AACABF62E5650E67F457E79C1D2E13502391FC3487216CC5BF8681843FCB8E05559487EB18AAC1BE0EFEA4F7B6A050478366153A9426C238B8869600B275704555A9EB94C92E4F3FDABE9E0BCE07645410D0AA7B675698A4CAE6CD3620633ABF0B849A4244CC8DFC5DB2646D5EA9B3954E62BFEF19AFEAFDDC34E55C3E9A1DD3167CF53D443617108141', hexString: 'AD96DDB984491E79B6F429DD650C6E2AE524627AC223AC9A123C66BB0997965950FED137544A93DFC718E16F57C8C121AF537086F395570A5602A3922366D11964DAFACD7830AACABF62E5650E67F457E79C1D2E13502391FC3487216CC5BF8681843FCB8E05559487EB18AAC1BE0EFEA4F7B6A050478366153A9426C238B8869600B275704555A9EB94C92E4F3FDABE9E0BCE07645410D0AA7B675698A4CAE6CD3620633ABF0B849A4244CC8DFC5DB2646D5EA9B3954E62BFEF19AFEAFDDC34E55C3E9A1DD3167CF53D443617108141',
result: '', result: '{}',
isFormat: true isFormat: true
} }
}, },
@ -48,11 +50,11 @@
url: `/eapi/decrypt?hexString=${this.hexString}&isFormat=${this.isFormat}`, url: `/eapi/decrypt?hexString=${this.hexString}&isFormat=${this.isFormat}`,
method: 'post' method: 'post'
}) })
this.result = res.data this.result = JSON.stringify(res.data)
console.log(res.data); console.log(res.data);
} catch (error) { } catch (error) {
console.error(error) console.error(error)
alert(error.response.data.message) alert(error?.response?.data?.message || '解密失败,数据格式错误')
} }
} }
} }

View File

@ -88,7 +88,7 @@ const eapi = (url, object) => {
const eapiResDecrypt = (encryptedParams) => { const eapiResDecrypt = (encryptedParams) => {
// 使用aesDecrypt解密参数 // 使用aesDecrypt解密参数
const decryptedData = aesDecrypt(encryptedParams, eapiKey, '', 'hex') const decryptedData = aesDecrypt(encryptedParams, eapiKey, '', 'hex')
return decryptedData return JSON.parse(decryptedData)
} }
const eapiReqDecrypt = (encryptedParams) => { const eapiReqDecrypt = (encryptedParams) => {
// 使用aesDecrypt解密参数 // 使用aesDecrypt解密参数