From cd05cd4cd829d1d211ccf64ab00ec863e7f5f2c2 Mon Sep 17 00:00:00 2001 From: wangshuai Date: Sun, 21 Jul 2024 14:10:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=9C=89=E6=95=88=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=95=B0=20api=E6=9B=B4=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/service/impl/MeituanServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java index f7aba0b..f2ec44f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java @@ -284,19 +284,23 @@ public class MeituanServiceImpl implements IMeituanService { CloseableHttpClient httpClient = proxyHttpClient(); String wmPoiId = valueFromCookie("wmPoiId", storeInfo.getStoreCookie()); - String url = "https://waimaieapp.meituan.com/gw/bizdata/marketing/single/analysis"; + String url = "https://waimaieapp.meituan.com/gw/bizdata/single/business/overview"; Map params = new HashMap<>(); // params.put("ignoreSetRouterProxy", true); -// params.put("acctId", valueFromCookie("acctId", storeInfo.getStoreCookie())); + params.put("acctId", valueFromCookie("acctId", storeInfo.getStoreCookie())); params.put("wmPoiId", wmPoiId); params.put("token", valueFromCookie("token", storeInfo.getStoreCookie())); params.put("appType", 3); String date = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyyMMdd")); params.put("beginDate", date); params.put("endDate", date); + params.put("compareType",0); + params.put("durationType",1); url = appendParams(url, params); HttpGet request = new HttpGet(url); request.setHeader("Cookie",storeInfo.getStoreCookie()); + request.setHeader("Host","waimaieapp.meituan.com"); + request.setHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"); String result = null; try { result = EntityUtils.toString(httpClient.execute(request).getEntity()); @@ -309,7 +313,7 @@ public class MeituanServiceImpl implements IMeituanService { String code = jsonObject.getString("code"); if ("0".equals(code)) { JSONArray array = jsonObject.getJSONArray("data"); - JSONObject one = array.getJSONObject(0); + JSONObject one = array.getJSONObject(3); String total = one.getString("base"); System.out.println(total); BusStoreInfo store = new BusStoreInfo();