Commit 2d5f6c08 authored by xuxin's avatar xuxin

获取与删除cookie

parent 8626022c
......@@ -232,6 +232,28 @@ public class ShopController {
}
/**
* 获取cookie
*/
@GetMapping("/cookie/{shopId}")
public ResultDto getShopCookie(@PathVariable String shopId) {
String cookie = shopService.queryShopCookieById(shopId);
ResultDto resultDto = new ResultDto();
resultDto.setStatus(0);
resultDto.setData(cookie);
return resultDto;
}
/**
* 删除cookie
*/
@DeleteMapping("/cookie/{shopId}")
public void delShopCookie(@PathVariable String shopId) {
shopService.deleteShopCookieById(shopId);
}
private void dealClientRequestException(ResultDto resultDto, ClientRequestException e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
......
......@@ -649,6 +649,19 @@ public class ShopServiceImpl implements ShopService {
return result;
}
@Override
public String queryShopCookieById(String id) {
Shop shop = shopRepository.findById(id).orElseThrow(() -> new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST));
return shop.getShopCookie();
}
@Override
public void deleteShopCookieById(String id) {
Shop shop = shopRepository.findById(id).orElseThrow(() -> new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST));
shop.setShopCookie("");
shopRepository.save(shop);
}
private String getShopId(String username, ShopResultDto shopResultDto) {
Shop shop = new Shop();
shopResultDto.setOwner(username);
......
......@@ -34,4 +34,8 @@ public interface ShopService {
List<String> getBatchShopUsers(String username, List<String> shopIds);
Integer dealDirtyData();
String queryShopCookieById(String id);
void deleteShopCookieById(String id);
}
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