修复取消收藏接口
This commit is contained in:
parent
ff167a56b3
commit
db5588577b
|
|
@ -107,10 +107,10 @@ public class ArticleController {
|
|||
*/
|
||||
@PostMapping("/cancelCollect")
|
||||
public Object cancelCollect(@RequestBody Map<String, String> params) {
|
||||
Assert.notNull(params.get("id"), "id参数缺失");
|
||||
Integer id = Integer.parseInt(params.get("id"));
|
||||
Assert.notNull(params.get("articleId"), "id参数缺失");
|
||||
Integer id = Integer.parseInt(params.get("articleId"));
|
||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||
iArticleService.cancelCollect(id, userId);
|
||||
iArticleService.cancelCollect(articleId, userId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ public interface IArticleService {
|
|||
* 取消收藏
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
* @param articleId 主键
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
void cancelCollect(Integer id, Integer userId);
|
||||
void cancelCollect(Integer articleId, Integer userId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,14 +230,14 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
* 取消收藏
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
* @param articleId 文章ID
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
@Override
|
||||
public void cancelCollect(Integer id, Integer userId) {
|
||||
public void cancelCollect(Integer articleId, Integer userId) {
|
||||
ArticleCollect articleCollect = articleCollectMapper.selectOne(
|
||||
new QueryWrapper<ArticleCollect>()
|
||||
.eq("id", id)
|
||||
.eq("article_id", articleId)
|
||||
.eq("user_id", userId)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue