diff --git a/docs/install/README.md b/docs/install/README.md index 467102658..2a873b6f0 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -610,3 +610,8 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行 1. 在 4399 首页登录。 2. 打开开发者工具,切换到 Network 面板,刷新 3. 查找`www.4399.com`的访问请求,点击请求,在右侧 Headers 中找到 Cookie. + +- 滴答清单 + + - `DIDA365_USERNAME`: 滴答清单用户名 + - `DIDA365_PASSWORD`: 滴答清单密码 diff --git a/docs/other.md b/docs/other.md index ea56de979..fea663a0d 100644 --- a/docs/other.md +++ b/docs/other.md @@ -4,6 +4,18 @@ pageClass: routes # 其他 +## 4399 论坛 + +### 4399 论坛 + + +::: warning 注意 + +需要用户 cookie 值,详情见部署页面的配置模块。 + +::: + + ## acwifi 路由器交流 ### 新闻 @@ -351,6 +363,18 @@ type 为 all 时,category 参数不支持 cost 和 free +## 滴答清单 + +### 习惯打卡 + +::: warning 注意 + +需要账号密码,详情见部署文档部分 RSS 模块配置 + +::: + + + ## 东莞教研网 ### 信息公开 @@ -919,13 +943,3 @@ type 为 all 时,category 参数不支持 cost 和 free ### はてな匿名ダイアリー - 人気記事アーカイブ - -### 4399 论坛 - - -::: warning 注意 - -需要用户 cookie 值,详情见部署页面的配置模块。 - -::: - diff --git a/lib/routes/dida365/habit-checkins.js b/lib/routes/dida365/habit-checkins.js index af5d41852..f5fff93bc 100644 --- a/lib/routes/dida365/habit-checkins.js +++ b/lib/routes/dida365/habit-checkins.js @@ -27,36 +27,47 @@ if (config.dida365.username && config.dida365.password) { module.exports = async (ctx) => { if (loginFlag) { - const habitsListRes = await got.get({ + const habitsRes = await got.get({ url: 'https://api.dida365.com/api/v2/habits', cookieJar, }); - const habitsList = habitsListRes.data; + const habits = habitsRes.data; const paramsList = []; - habitsList.forEach((item) => { + habits.forEach((item) => { paramsList.push(['habitIds', item.id]); }); const searchParams = new URLSearchParams(paramsList); - const checkinsRes = await got.get({ + const habitCheckinsRes = await got.get({ url: 'https://api.dida365.com/api/v2/habitCheckins', cookieJar, searchParams, }); - const checkins = checkinsRes.data; + const checkins = habitCheckinsRes.data; + const habitRecordsRes = await got.get({ + url: 'https://api.dida365.com/api/v2/habitRecords', + cookieJar, + searchParams, + }); + const records = habitRecordsRes.data; + let list = []; for (const habitId in checkins.checkins) { - const info = habitsList.find((item) => item.id === habitId); + const info = habits.find((item) => item.id === habitId); list = list.concat( checkins.checkins[habitId] .sort((a, b) => a.checkinStamp - b.checkinStamp) - .map((checkin, index) => ({ - title: `第${index + 1}天${info.name}打卡`, - pubDate: `${(checkin.checkinStamp + '').slice(0, 4)}-${(checkin.checkinStamp + '').slice(4, 6)}-${(checkin.checkinStamp + '').slice(6, 8)}`, - link: `https://dida365.com/webapp/#q/all/habit/${checkin.habitId}`, - guid: checkin.id, - })) + .map((checkin, index) => { + const record = records.habitRecords[checkin.habitId].find((re) => re.stamp === checkin.checkinStamp); + return { + title: `第${index + 1}天${info.name}打卡`, + description: record && record.content, + pubDate: `${(checkin.checkinStamp + '').slice(0, 4)}-${(checkin.checkinStamp + '').slice(4, 6)}-${(checkin.checkinStamp + '').slice(6, 8)}`, + link: `https://dida365.com/webapp/#q/all/habit/${checkin.habitId}`, + guid: checkin.id, + }; + }) ); }