Commit 8bb64144 authored by puppetect's avatar puppetect

Merge branch 'staging' of http://120.77.149.83/root/browser-backend into staging

parents 44475158 94b094bd
......@@ -232,6 +232,33 @@ 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 ResultDto delShopCookie(@PathVariable String shopId) {
Integer result = shopService.deleteShopCookieById(shopId);
ResultDto resultDto = new ResultDto();
resultDto.setStatus(result);
return resultDto;
}
private void dealClientRequestException(ResultDto resultDto, ClientRequestException e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
......
......@@ -649,6 +649,25 @@ 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 Integer deleteShopCookieById(String id) {
Shop shop = shopRepository.findById(id).orElseThrow(() -> new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST));
shop.setShopCookie("");
Shop save = shopRepository.save(shop);
Integer i = 1;
if (StringUtils.isEmpty(save.getShopCookie())) {
i = 0;
}
return i;
}
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);
Integer deleteShopCookieById(String id);
}
......@@ -53,7 +53,7 @@ public class SpecialLineCheckTask {
specialLineState = finalFail == ipResourceList.size() ? "off" : null;
}
if ("off".equals(globalField.getSpecialLineState())) {
specialLineState = finalSuccess > 5 ? "on" : null;
specialLineState = finalSuccess > 1 ? "on" : null;
}
if (!StringUtils.isEmpty(specialLineState)) {
......@@ -83,6 +83,10 @@ public class SpecialLineCheckTask {
if (success == 1) {
finalSuccess++;
}
// 用于性能优化
if (finalSuccess == 2) {
break;
}
}
int[] arr = {finalSuccess, finalFail};
......
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