Skip to content

Commit cffe2df

Browse files
committed
【修正】动态点赞api
1 parent 9eb4771 commit cffe2df

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

blog-api/src/main/java/com/rawchen/controller/MomentController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public Result moments(@RequestParam(defaultValue = "1") Integer pageNum,
6464
*/
6565
@AccessLimit(seconds = 86400, maxCount = 1, msg = "不可以重复点赞哦")
6666
@VisitLogger(behavior = "点赞动态")
67-
@PostMapping("/moment/like")
68-
public Result like(@RequestParam Long id) {
67+
@PostMapping("/moment/like/{id}")
68+
public Result like(@PathVariable Long id) {
6969
momentService.addLikeByMomentId(id);
7070
return Result.ok("点赞成功");
7171
}

blog-view/src/api/moment.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ export function getMomentListByPageNum(token, pageNum) {
1515

1616
export function likeMoment(id) {
1717
return axios({
18-
url: 'moment/like',
18+
url: `moment/like/${id}`,
1919
method: 'POST',
20-
params: {
21-
id
22-
}
2320
})
2421
}

0 commit comments

Comments
 (0)