feat(crawl): 优化美团爬虫逻辑并新增租户配置字段
- 删除handleRequest方法中冗余的storeParam参数注释 - 调整门店列表接口响应处理逻辑的位置 - 在LoginUserVO中增加tenantName和mtShopListInterfaceAddress字段 - 更新LoginView页面登录后全局配置赋值逻辑 - 修复因条件判断位置不当导致的逻辑错误问题
This commit is contained in:
@@ -10,6 +10,16 @@ public class LoginUserVO {
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 租户名称
|
||||
*/
|
||||
public String tenantName;
|
||||
|
||||
/**
|
||||
* 门店列表接口地址
|
||||
*/
|
||||
public String mtShopListInterfaceAddress;
|
||||
|
||||
/**
|
||||
* 美团点评评价接口地址
|
||||
*/
|
||||
|
||||
@@ -118,6 +118,8 @@ public class LoginView {
|
||||
LoginUserVO loginUserVO = jsonResultObject.getObject("data", LoginUserVO.class);
|
||||
// 网络地址
|
||||
GlobalConfig.tenantId = loginUserVO.getTenantId();
|
||||
GlobalConfig.tenantName = loginUserVO.getTenantName();
|
||||
GlobalConfig.mtShopListInterfaceAddress = loginUserVO.getMtShopListInterfaceAddress();
|
||||
GlobalConfig.mtDianPingInterfaceAddress = loginUserVO.getMtDianPingInterfaceAddress();
|
||||
GlobalConfig.mtDaZhInterfaceAddress = loginUserVO.getMtDaZhInterfaceAddress();
|
||||
GlobalConfig.dyPingJiaInterfaceAddress = loginUserVO.getDyPingJiaInterfaceAddress();
|
||||
|
||||
@@ -77,7 +77,6 @@ public class FtbCrawlNetFirstMt extends AbstractFtbCrawlNetBase implements FtbCr
|
||||
* 处理网络请求,提取需要的cookie信息
|
||||
*
|
||||
* @param request 网络请求
|
||||
* @param storeParam
|
||||
*/
|
||||
private void handleRequest(Request request, AtomicBoolean mtCookie, AtomicBoolean dzCookie, AtomicBoolean isCrawlFinished, AtomicReference<JSONObject> atomicReference) {
|
||||
// 美团cookie
|
||||
@@ -126,6 +125,7 @@ public class FtbCrawlNetFirstMt extends AbstractFtbCrawlNetBase implements FtbCr
|
||||
userCookieDTO.setCookie(cookie);
|
||||
userCookieDTO.setStoreParam(atomicReference.get());
|
||||
processCookiet(userCookieDTO, "大众点评",dzCookie);
|
||||
}
|
||||
} else if (request.url().contains(GlobalConfig.mtShopListInterfaceAddress)) {
|
||||
String text = request.response().text();
|
||||
log.info("请求门店返回内容为: {}", text);
|
||||
@@ -133,7 +133,6 @@ public class FtbCrawlNetFirstMt extends AbstractFtbCrawlNetBase implements FtbCr
|
||||
isCrawlFinished.set(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void showSuccessAlertAndCloset(Page page, String platformName) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user