From b796e87106d18c329dbe9c0f1ad9707b018e62ff Mon Sep 17 00:00:00 2001 From: overwriter <9856mmm@gmail.com> Date: Sat, 19 Oct 2024 23:57:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=90=AC=E6=AD=8C?= =?UTF-8?q?=E8=B6=B3=E8=BF=B9=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.MD | 5 +++ module/listen_data_realtime_report.js | 11 ++++++ module/listen_data_report.js | 12 +++++++ module/listen_data_today_song.js | 9 +++++ module/listen_data_total.js | 9 +++++ module/listen_data_year_report.js | 9 +++++ public/docs/home.md | 52 +++++++++++++++++++++++++++ 7 files changed, 107 insertions(+) create mode 100644 module/listen_data_realtime_report.js create mode 100644 module/listen_data_report.js create mode 100644 module/listen_data_today_song.js create mode 100644 module/listen_data_total.js create mode 100644 module/listen_data_year_report.js diff --git a/README.MD b/README.MD index a701e2b..703a9c2 100644 --- a/README.MD +++ b/README.MD @@ -440,6 +440,11 @@ banner({ type: 0 }).then((res) => { 294. 用户状态 - 支持设置的状态 295. 用户状态 - 相同状态的用户 296. 用户状态 - 编辑 +297. 听歌足迹 - 年度听歌足迹 +298. 听歌足迹 - 今日收听 +299. 听歌足迹 - 总收听时长 +300. 听歌足迹 - 本周/本月收听时长 +301. 听歌足迹 - 周/月/年收听报告 ## 单元测试 diff --git a/module/listen_data_realtime_report.js b/module/listen_data_realtime_report.js new file mode 100644 index 0000000..e415ca9 --- /dev/null +++ b/module/listen_data_realtime_report.js @@ -0,0 +1,11 @@ +// 听歌足迹 - 本周/本月收听时长 +const createOption = require('../util/option.js') +module.exports = (query, request) => { + return request( + `/api/content/activity/listen/data/realtime/report`, + { + type: query.type || 'week', //周 week 月 month + }, + createOption(query), + ) +} diff --git a/module/listen_data_report.js b/module/listen_data_report.js new file mode 100644 index 0000000..21aef52 --- /dev/null +++ b/module/listen_data_report.js @@ -0,0 +1,12 @@ +// 听歌足迹 - 周/月/年收听报告 +const createOption = require('../util/option.js') +module.exports = (query, request) => { + return request( + `/api/content/activity/listen/data/report`, + { + type: query.type || 'week', //周 week 月 month 年 year + endTime: query.endTime, // 不填就是本周/月的 + }, + createOption(query), + ) +} diff --git a/module/listen_data_today_song.js b/module/listen_data_today_song.js new file mode 100644 index 0000000..9c2f7e6 --- /dev/null +++ b/module/listen_data_today_song.js @@ -0,0 +1,9 @@ +// 听歌足迹 - 今日收听 +const createOption = require('../util/option.js') +module.exports = (query, request) => { + return request( + `/api/content/activity/listen/data/today/song/play/rank`, + {}, + createOption(query), + ) +} diff --git a/module/listen_data_total.js b/module/listen_data_total.js new file mode 100644 index 0000000..83472ba --- /dev/null +++ b/module/listen_data_total.js @@ -0,0 +1,9 @@ +// 听歌足迹 - 总收听时长 +const createOption = require('../util/option.js') +module.exports = (query, request) => { + return request( + `/api/content/activity/listen/data/total`, + {}, + createOption(query), + ) +} diff --git a/module/listen_data_year_report.js b/module/listen_data_year_report.js new file mode 100644 index 0000000..ba32cb9 --- /dev/null +++ b/module/listen_data_year_report.js @@ -0,0 +1,9 @@ +// 听歌足迹 - 年度听歌足迹 +const createOption = require('../util/option.js') +module.exports = (query, request) => { + return request( + `/api/content/activity/listen/data/year/report`, + {}, + createOption(query), + ) +} diff --git a/public/docs/home.md b/public/docs/home.md index 8f8cc0d..e1dfb6b 100644 --- a/public/docs/home.md +++ b/public/docs/home.md @@ -312,6 +312,11 @@ 294. 用户状态 - 支持设置的状态 295. 用户状态 - 相同状态的用户 296. 用户状态 - 编辑 +297. 听歌足迹 - 年度听歌足迹 +298. 听歌足迹 - 今日收听 +299. 听歌足迹 - 总收听时长 +300. 听歌足迹 - 本周/本月收听时长 +301. 听歌足迹 - 周/月/年收听报告 ## 安装 @@ -4863,6 +4868,53 @@ bitrate = Math.floor(br / 1000) **接口地址 :** `/user/social/status/edit` +### 听歌足迹 - 年度听歌足迹 + +说明 : 登录后调用此接口, 获取年度听歌足迹 + +**接口地址 :** `/listen/data/year/report` + +### 听歌足迹 - 今日收听 + +说明 : 登录后调用此接口, 获取今日收听 + +**接口地址 :** `/listen/data/today/song` + +### 听歌足迹 - 总收听时长 + +说明 : 登录后调用此接口, 获取总收听时长; 相关接口可能需要vip权限 + +**接口地址 :** `/listen/data/total` + +### 听歌足迹 - 本周/本月收听时长 + +说明 : 登录后调用此接口, 获取本周/本月收听时长 + +**必选参数 :** + +`type`: 维度类型 周 week 月 month; 今年没结束,不支持今年的数据 + +**接口地址 :** `/listen/data/realtime/report` + +**调用例子 :** `/listen/data/realtime/report?type=month` + +### 听歌足迹 - 周/月/年收听报告 + +说明 : 登录后调用此接口, 获取周/月/年收听报告 + +**必选参数 :** + +`type`: 维度类型 周 week 月 month 年 year + +**可选参数 :** + +`endTime` : 周: 每周周六0点的时间戳 月: 每月最后一天0点的时间戳 年: 每年最后一天0点的时间戳 +不填就是本周/月的, 今年没结束,则没有今年的数据 + +**接口地址 :** `/listen/data/report` + +**调用例子 :** `/listen/data/report?type=month` + ## 离线访问此文档 此文档同时也是 Progressive Web Apps(PWA), 加入了 serviceWorker, 可离线访问