Commit 27819849 authored by xuxinpc's avatar xuxinpc

收藏夹相关接口 修改传参方式

parent 1eb91b38
......@@ -3,6 +3,7 @@ package com.edgec.browserbackend.browser.controller;
import com.edgec.browserbackend.account.dto.ResultDto;
import com.edgec.browserbackend.browser.domain.UserCode;
import com.edgec.browserbackend.browser.dto.FavoriteUrl;
import com.edgec.browserbackend.browser.dto.FavoriteUrlDto;
import com.edgec.browserbackend.browser.service.ShopService;
import com.edgec.browserbackend.browser.service.TempService;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
......@@ -58,11 +59,12 @@ public class TempController {
/**
* 店铺收藏夹 删除收藏
*/
@DeleteMapping("/favorites/{shopId}")
public ResultDto deleteFavoritesByShopId(@PathVariable("shopId") String shopId, @RequestBody FavoriteUrl favoriteUrl) {
@DeleteMapping("/favorites")
public ResultDto deleteFavoritesByShopId(@RequestBody FavoriteUrlDto favoriteUrlDto) {
ResultDto resultDto = new ResultDto();
try {
resultDto.setData(shopService.deleteFavoritesByShopId(shopId, favoriteUrl));
FavoriteUrl favoriteUrl = new FavoriteUrl(favoriteUrlDto.getTitle(),favoriteUrlDto.getUrl());
resultDto.setData(shopService.deleteFavoritesByShopId(favoriteUrlDto.getShopId(), favoriteUrl));
resultDto.setStatus(0);
} catch (ClientRequestException e) {
dealClientRequestException(resultDto, e);
......@@ -73,11 +75,12 @@ public class TempController {
/**
* 店铺收藏夹 新增收藏
*/
@PostMapping("/favorites/{shopId}")
public ResultDto saveFavoritesByShopId(@PathVariable("shopId") String shopId, @RequestBody FavoriteUrl favoriteUrl) {
@PostMapping("/favorites")
public ResultDto saveFavoritesByShopId(@RequestBody FavoriteUrlDto favoriteUrlDto) {
ResultDto resultDto = new ResultDto();
try {
resultDto.setData(shopService.saveFavoritesByShopId(shopId, favoriteUrl));
FavoriteUrl favoriteUrl = new FavoriteUrl(favoriteUrlDto.getTitle(),favoriteUrlDto.getUrl());
resultDto.setData(shopService.deleteFavoritesByShopId(favoriteUrlDto.getShopId(), favoriteUrl));
resultDto.setStatus(0);
} catch (ClientRequestException e) {
dealClientRequestException(resultDto, e);
......
package com.edgec.browserbackend.browser.dto;
/**
* @author 每天进步一点点
* @date 2020/9/19 20:13
* @description
*/
public class FavoriteUrlDto {
private String title;
private String url;
private String shopId;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getShopId() {
return shopId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment