From feb470136f17fceb394ad3ce8bf39d5cfd85a2d0 Mon Sep 17 00:00:00 2001 From: wangshuai Date: Mon, 29 Jul 2024 15:47:42 +0800 Subject: [PATCH] =?UTF-8?q?1;=20=E5=BA=97=E9=93=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=90=A5=E9=94=80=E9=87=8F=E6=94=B9=E4=B8=BAH=E8=AF=84?= =?UTF-8?q?=E9=87=8F=20=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=202;=20=E9=9B=86=E6=88=90=E7=A7=81=E5=AF=86=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E6=96=B9=E6=B3=95=E9=85=8D=E7=BD=AE=20=E5=BE=85?= =?UTF-8?q?=E5=BC=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 13 +- .../ruoyi/common/config/ProxyProperties.java | 131 +++++++++++++++++- ruoyi-ui/src/views/market/brand/index.vue | 2 +- ruoyi-ui/src/views/market/self/index.vue | 4 +- ruoyi-ui/src/views/market/whole/index.vue | 4 +- ruoyi-ui/src/views/statistics/black/index.vue | 1 + ruoyi-ui/src/views/statistics/shop/index.vue | 4 +- 7 files changed, 145 insertions(+), 14 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index de1176c..6c5c7c7 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -95,9 +95,9 @@ token: # 令牌自定义标识 header: Authorization # 令牌密钥 - secret: abcdefghijklmnopqrstuvwxyz + secret: abcdefghijklmnopqrstuvwxyzws # 令牌有效期(默认30分钟) - expireTime: 30 + expireTime: 120 # MyBatis配置 mybatis: @@ -154,6 +154,15 @@ clientIP: accountsecretKey: 2xib03rq8uqh15x230ea9emjasiu3exv secretId: ohrruf71orkzv9l9enhi secretKey: bp4iyx52tc9oe46hj0lriyux2m6hpzvu + getdpsAddr: https://dps.kdlapi.com/api/getdps + getdpsvalidtime: https://dps.kdlapi.com/api/getdpsvalidtime + checkdpsvalid: https://dps.kdlapi.com/api/checkdpsvalid + accountSM: d1353713811 + pwdSM: btqffqim + accountSecretIdSM: ol1ydp86g518q4y607xe + accountsecretKeySM: 6vwfgvti51u2njgntamc1f23lqq7kave + secretIdSM: uadb4a2pwopd613sxr89 + secretKeySM: 2xib03rq8uqh15x230ea9emjasiu3exv eleme: isSandbox: false diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/ProxyProperties.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/ProxyProperties.java index b56706e..f55cf08 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/ProxyProperties.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/ProxyProperties.java @@ -1,12 +1,13 @@ package com.ruoyi.common.config; -import com.tencentcloudapi.common.Credential; -import com.tencentcloudapi.common.profile.ClientProfile; -import com.tencentcloudapi.common.profile.HttpProfile; -import com.tencentcloudapi.sms.v20210111.SmsClient; +import com.alibaba.fastjson2.JSONObject; import lombok.Data; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Data @@ -42,4 +43,124 @@ public class ProxyProperties { @Value("${clientIP.secretKey}") private String secretKey; + @Value("${clientIP.getdpsAddr}") + private String getdpsAddr; + @Value("${clientIP.getdpsvalidtime}") + private String getdpsvalidtime; + @Value("${clientIP.checkdpsvalid}") + private String checkdpsvalid; + @Value("${clientIP.accountSM}") + private String accountSM; + @Value("${clientIP.pwdSM}") + private String pwdSM; + @Value("${clientIP.accountSecretIdSM}") + private String accountSecretIdSM; + @Value("${clientIP.accountsecretKeySM}") + private String accountsecretKeySM; + @Value("${clientIP.secretIdSM}") + private String secretIdSM; + @Value("${clientIP.secretKeySM}") + private String secretKeySM; + + + private String getUrl() { + try { + // 请求参数 + int num = 1; // 提取数量 + String params = "?secret_id=" + secretIdSM + "&signature=" + secretKeySM + "&num=" + num; + + CloseableHttpClient httpclient = HttpClients.createDefault(); + try { + HttpGet httpget = new HttpGet(getdpsAddr + params); + httpget.addHeader("Accept-Encoding", "gzip"); //使用gzip压缩传输数据让访问更快 + + System.out.println("Executing request " + httpget.getURI()); + CloseableHttpResponse response = httpclient.execute(httpget); + try { + String ip = EntityUtils.toString(response.getEntity()); + if (checkdpsvalid(ip) && getdpsvalidtime(ip)) { + return ip; + } + getUrl(); + } finally { + response.close(); + } + } finally { + httpclient.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + private Boolean getdpsvalidtime(String proxy) { + Boolean flag = false; + try { + // 请求参数 + String params = "?secret_id=" + secretIdSM + "&proxy=" + proxy + "&signature=" + secretKeySM; + CloseableHttpClient httpclient = HttpClients.createDefault(); + try { + HttpGet httpget = new HttpGet(getdpsvalidtime + params); + httpget.addHeader("Accept-Encoding", "gzip"); //使用gzip压缩传输数据让访问更快 + + System.out.println("Executing request " + httpget.getURI()); + CloseableHttpResponse response = httpclient.execute(httpget); + try { + String result = EntityUtils.toString(response.getEntity()); + JSONObject jsonObject = JSONObject.parseObject(result); + String code = jsonObject.getString(("code")); + if ("0".equals(code)) { + int count = jsonObject.getJSONObject("data").getInteger(proxy); + if (count >= 0) { + System.out.println(jsonObject.getJSONObject("data").getInteger(proxy).toString()); + return true; + } + } + } finally { + response.close(); + } + } finally { + httpclient.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return flag; + } +// GET https://dps.kdlapi.com/api/checkdpsvalid?secret_id=o1fjh1re9o28876h7c08 +// &proxy=113.120.61.166:22989,123.163.183.200:18635 +// &signature=oxf0n0g59h7wcdyvz2uo68ph2s + + + private Boolean checkdpsvalid(String proxy) { + Boolean flag = false; + try { + // 请求参数 + String params = "?secret_id=" + secretIdSM + "&proxy=" + proxy + "&signature=" + secretKeySM; + CloseableHttpClient httpclient = HttpClients.createDefault(); + try { + HttpGet httpget = new HttpGet(checkdpsvalid + params); + httpget.addHeader("Accept-Encoding", "gzip"); //使用gzip压缩传输数据让访问更快 + + System.out.println("Executing request " + httpget.getURI()); + CloseableHttpResponse response = httpclient.execute(httpget); + try { + String result = EntityUtils.toString(response.getEntity()); + JSONObject jsonObject = JSONObject.parseObject(result); + String code = jsonObject.getString(("code")); + if ("0".equals(code)) { + flag = jsonObject.getJSONObject("data").getBooleanValue(proxy); + } + } finally { + response.close(); + } + } finally { + httpclient.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return flag; + } } diff --git a/ruoyi-ui/src/views/market/brand/index.vue b/ruoyi-ui/src/views/market/brand/index.vue index b492bb7..aedc31c 100644 --- a/ruoyi-ui/src/views/market/brand/index.vue +++ b/ruoyi-ui/src/views/market/brand/index.vue @@ -459,7 +459,7 @@ export default { 'el-tooltip', { props: { - content: '昨日营销量与昨日单量比值', // 鼠标悬停时要展示的文字提示 + content: '昨日好评量与昨日回访量比值', // 鼠标悬停时要展示的文字提示 placement: 'top' // 悬停内容展示的位置 } }, diff --git a/ruoyi-ui/src/views/market/self/index.vue b/ruoyi-ui/src/views/market/self/index.vue index ddd766b..d2990da 100644 --- a/ruoyi-ui/src/views/market/self/index.vue +++ b/ruoyi-ui/src/views/market/self/index.vue @@ -199,7 +199,7 @@ - + @@ -509,7 +509,7 @@ export default { 'el-tooltip', { props: { - content: '昨日营销量与昨日单量比值', // 鼠标悬停时要展示的文字提示 + content: '昨日好评量与昨日回访量比值', // 鼠标悬停时要展示的文字提示 placement: 'top' // 悬停内容展示的位置 } }, diff --git a/ruoyi-ui/src/views/market/whole/index.vue b/ruoyi-ui/src/views/market/whole/index.vue index d2f6dde..bab50e5 100644 --- a/ruoyi-ui/src/views/market/whole/index.vue +++ b/ruoyi-ui/src/views/market/whole/index.vue @@ -216,7 +216,7 @@ - + @@ -582,7 +582,7 @@ export default { 'el-tooltip', { props: { - content: '昨日营销量与昨日单量比值', // 鼠标悬停时要展示的文字提示 + content: '昨日好评量与昨日回访量比值', // 鼠标悬停时要展示的文字提示 placement: 'top' // 悬停内容展示的位置 } }, diff --git a/ruoyi-ui/src/views/statistics/black/index.vue b/ruoyi-ui/src/views/statistics/black/index.vue index 36e8d52..957b1d1 100644 --- a/ruoyi-ui/src/views/statistics/black/index.vue +++ b/ruoyi-ui/src/views/statistics/black/index.vue @@ -268,6 +268,7 @@ export default { submitForm() { if(this.formIds.length==0){ this.$modal.msgSuccess("请勾选数据!"); + return } this.form.orderIds = this.formIds; this.$refs["form"].validate(valid => { diff --git a/ruoyi-ui/src/views/statistics/shop/index.vue b/ruoyi-ui/src/views/statistics/shop/index.vue index 8037278..3e42268 100644 --- a/ruoyi-ui/src/views/statistics/shop/index.vue +++ b/ruoyi-ui/src/views/statistics/shop/index.vue @@ -191,7 +191,7 @@ - + @@ -493,7 +493,7 @@ export default { 'el-tooltip', { props: { - content: '昨日营销量与昨日单量比值', // 鼠标悬停时要展示的文字提示 + content: '昨日好评量与昨日回访量比值', // 鼠标悬停时要展示的文字提示 placement: 'top' // 悬停内容展示的位置 } },