Skip to content

Commit

Permalink
feat: 阅读记录
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaviilee committed Jan 18, 2025
1 parent 87939f5 commit b0665de
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
18 changes: 17 additions & 1 deletion js/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,20 @@ function postHistory(data) {
return $next2({mute: true}).post("/api/next2/userdata/visit-history/item", data);
}

export { getStat, postStat, getStatRank, postHistory };
// 阅读记录
/**
* 添加阅读记录
* @param {*} data
* @param {*} data.id 例如:文章id,帖子id
* @param {*} data.category 例如:文章,帖子
* @param {*} data.subcategory 例如:文章类型,帖子类型
* @param {*} data.visible_type 例如:2亲友可见 3密码可见 4付费可见 5粉丝可见
* @returns
*/
function postReadHistory(data) {
const {id, category, subcategory, visible_type} = data;
if (visible_type < 2) return Promise.resolve();
return $next2({mute: true}).post(`/api/next2/userdata/common-read-history/${category}/${subcategory}/${id}`, {visible_type});
}

export { getStat, postStat, getStatRank, postHistory, postReadHistory };
18 changes: 17 additions & 1 deletion js/stat_v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,20 @@ function postHistory(data) {
return $next2({mute: true}).post("/api/next2/userdata/visit-history/item", data);
}

export { getStat, postStat, getStatRank, postHistory };
// 阅读记录
/**
* 添加阅读记录
* @param {*} data
* @param {*} data.id 例如:文章id,帖子id
* @param {*} data.category 例如:文章,帖子
* @param {*} data.subcategory 例如:文章类型,帖子类型
* @param {*} data.visible_type 例如:2亲友可见 3密码可见 4付费可见 5粉丝可见
* @returns
*/
function postReadHistory(data) {
const {id, category, subcategory, visible_type} = data;
if (visible_type < 2) return Promise.resolve();
return $next2({mute: true}).post(`/api/next2/userdata/common-read-history/${category}/${subcategory}/${id}`, {visible_type});
}

export { getStat, postStat, getStatRank, postHistory, postReadHistory };
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jx3box/jx3box-common",
"version": "8.5.5",
"version": "8.5.6",
"description": "JX3BOX公共基础模块",
"main": "main.js",
"repository": {
Expand Down

0 comments on commit b0665de

Please sign in to comment.