1;多个模板时报错提示修改

2;获取店铺名加备用
This commit is contained in:
wangshuai 2024-07-28 11:28:57 +08:00
parent d8fa117b4c
commit df96d30102
2 changed files with 40 additions and 1 deletions

View File

@ -191,6 +191,6 @@ public class BusTemplateInfoServiceImpl implements IBusTemplateInfoService
}else if(list.size() == 0){
throw new ServiceException("请添加/编辑模版!");
}
throw new ServiceException("模版信息异常");
throw new ServiceException("生效的模板过多,请确认只有一个模板生效");
}
}

View File

@ -581,6 +581,13 @@ public class MeituanServiceImpl implements IMeituanService {
@Override
public String getStoreName(String cookie){
String url = "https://e.waimai.meituan.com/v2/index/homePage";
Map<String, Object> params = new LinkedHashMap<>();
params.put("region_id", valueFromCookie("region_id", cookie));
params.put("region_version", valueFromCookie("region_version", cookie));
params.put("yodaReady", "h5");
params.put("csecplatform", 4);
params.put("csecversion", "2.4.0");
url = appendParams(url, params);
HttpGet request = new HttpGet(url);
request.setHeader("Cookie",cookie);
request.setHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36");
@ -604,6 +611,38 @@ public class MeituanServiceImpl implements IMeituanService {
return null;
}
public String getStoreNameApi(String cookie){
String url = "https://e.waimai.meituan.com/api/v2/account/homePage";
Map<String, Object> params = new LinkedHashMap<>();
params.put("acctId", valueFromCookie("acctId", cookie));
params.put("region_id", valueFromCookie("region_id", cookie));
params.put("region_version", valueFromCookie("region_version", cookie));
params.put("yodaReady", "h5");
params.put("csecplatform", 4);
params.put("csecversion", "2.4.0");
url = appendParams(url, params);
HttpGet request = new HttpGet(url);
request.setHeader("Cookie",cookie);
request.setHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36");
CloseableHttpClient client = proxyHttpClient();
String result = null;
try {
result = EntityUtils.toString(client.execute(request).getEntity());
} catch (Exception e) {
System.out.println(e.getMessage());
}
if (result != null){
JSONObject jsonObject = JSONObject.parseObject(result);
String code = jsonObject.getString(("code"));
if ("0".equals(code)) {
JSONObject data = jsonObject.getJSONObject("data");
JSONObject wmPoiData = data.getJSONObject("wmPoiData");
String wmPoiName = wmPoiData.getString("wmPoiName");
return wmPoiName;
}
}
return null;
}
/**
* 获取号码
*