From 5a2e981c4192a1a20483336f788e0ace2fc20281 Mon Sep 17 00:00:00 2001 From: "kuang.yife" Date: Fri, 23 Feb 2024 11:55:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=BD=AC=E8=B0=83=E7=94=A8=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F=EF=BC=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/system/ClewController.java | 23 +++++++++ .../web/controller/tool/NoticeController.java | 49 ++++++++++--------- .../web/core/config/GlobalLogHelper.java | 2 +- .../src/main/resources/application.yml | 2 +- 4 files changed, 50 insertions(+), 26 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ClewController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ClewController.java index 8934b407..7f4067b8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ClewController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ClewController.java @@ -17,6 +17,7 @@ import com.ruoyi.system.domain.ClewPhone; import com.ruoyi.system.domain.OppoCheck; import com.ruoyi.system.service.IClewPhoneService; import com.ruoyi.system.service.ISysUserService; +import com.ruoyi.web.core.config.GlobalLogHelper; import lombok.extern.slf4j.Slf4j; import okhttp3.MediaType; import okhttp3.OkHttpClient; @@ -187,6 +188,28 @@ public class ClewController extends BaseController log.info("请求{}的属性{}", url, content); String s = HttpUtils.sendPost(url, content, headerMap); log.info("请求{}的响应{}", url, s); + }else if("xiaomi".equalsIgnoreCase(clew.getRemark())){ + log.info("oaid : {}, imei:{}", clew.getOaid(), clew.getImei()); +// String imei = clew.getImei(); + String oaid = clew.getOaid(); +// String ua = "Dalvik/2.1.0 (Linux; U; Android 11; M2012K11AC Build/RKQ1.200826.002)"; + String clientIp = "58.49.150.163"; + long convTime = System.currentTimeMillis(); + String convType = "APP_PAY"; + long appId = 1545362; + int customerId = 445972; + String singKey = "FkqMqeKVbCaeSGBI"; + String encryptKey = "IIUWoEaMXlzctOqk"; + GlobalLogHelper.UploadInfo uploadInfo = GlobalLogHelper.UploadInfo.builder() +// .imei(imei) + .oaid(oaid) +// .ua(ua) + .clientIp(clientIp) + .convTime(convTime).convType(convType) + .appId(appId).customerId(customerId).signKey(singKey).encryptKey(encryptKey).build().genInfo(); + log.info("请求xiaomi的属性{}", uploadInfo.getFinalUrl()); + String s = HttpUtils.sendGet(uploadInfo.getFinalUrl()); + log.info("请求xiaomi的响应{}", s); } }catch (Exception e){ e.printStackTrace(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/NoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/NoticeController.java index f8a46abe..80779316 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/NoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/NoticeController.java @@ -102,6 +102,22 @@ public class NoticeController { SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime); log.info("发送给{}短信响应为{}", request.getPhone(), sendSmsResponse); CacheUtils.put(request.getPhone(), code); + // 请求次数入库 + try { + ClewPhone param = new ClewPhone(); + param.setPhone(request.getPhone()); + List clewPhones = clewPhoneService.selectClewPhoneList(param); + if(CollectionUtils.isEmpty(clewPhones)){ + ClewPhone model = new ClewPhone(); + model.setPhone(request.getPhone()); + model.setCreateTime(new Date()); + model.setRemark(request.getFrom()); + clewPhoneService.insertClewPhone(model); + } + }catch (Exception e){ + e.printStackTrace(); + log.error("手机号入库失败!,原因:{}", e.getMessage()); + } // 调用oppo的统计接口 try { if("oppo".equalsIgnoreCase(request.getFrom())){ @@ -136,20 +152,21 @@ public class NoticeController { String s = HttpUtils.sendPost(url, content, headerMap); log.info("请求{}的响应{}", url, s); }else if("xiaomi".equalsIgnoreCase(request.getFrom())){ + log.info("oaid : {}, imei:{}", request.getOaid(), request.getImei()); String imei = request.getImei(); String oaid = request.getOaid(); - String ua = "Dalvik/2.1.0 (Linux; U; Android 11; M2012K11AC Build/RKQ1.200826.002)"; - String clientIp = "127.0.0.1"; +// String ua = "Dalvik/2.1.0 (Linux; U; Android 11; M2012K11AC Build/RKQ1.200826.002)"; + String clientIp = "58.49.150.163"; long convTime = System.currentTimeMillis(); - String convType = "APP_PAY_NEW"; + String convType = "APP_REGISTER"; long appId = 1545362; - int customerId = 1545362; - String singKey = "IIUWoEaMXlzctOqk"; - String encryptKey = "FkqMqeKVbCaeSGBI"; + int customerId = 445972; + String singKey = "rEQNdyVQxHlayYzw"; + String encryptKey = "RPeKBIdybnbMAVlK"; GlobalLogHelper.UploadInfo uploadInfo = GlobalLogHelper.UploadInfo.builder() - .imei(imei) +// .imei(imei) .oaid(oaid) - .ua(ua) +// .ua(ua) .clientIp(clientIp) .convTime(convTime).convType(convType) .appId(appId).customerId(customerId).signKey(singKey).encryptKey(encryptKey).build().genInfo(); @@ -163,22 +180,6 @@ public class NoticeController { e.printStackTrace(); log.error("回调oppo报错:{}", e.getMessage()); } - // 请求次数入库 - try { - ClewPhone param = new ClewPhone(); - param.setPhone(request.getPhone()); - List clewPhones = clewPhoneService.selectClewPhoneList(param); - if(CollectionUtils.isEmpty(clewPhones)){ - ClewPhone model = new ClewPhone(); - model.setPhone(request.getPhone()); - model.setCreateTime(new Date()); - model.setRemark(request.getFrom()); - clewPhoneService.insertClewPhone(model); - } - }catch (Exception e){ - e.printStackTrace(); - log.error("手机号入库失败!,原因:{}", e.getMessage()); - } }catch (Exception e){ log.error("给 {} 发送短信失败 {}", request.getPhone(), ExceptionUtil.getExceptionMessage(e)); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/GlobalLogHelper.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/GlobalLogHelper.java index 089bbb64..71d3f601 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/GlobalLogHelper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/GlobalLogHelper.java @@ -46,7 +46,7 @@ public class GlobalLogHelper { private String signature; private final static String HOST = "http://trail.e.mi.com"; - private final static String PATH = "/global/test"; + private final static String PATH = "/global/log"; @SneakyThrows public UploadInfo genInfo() { diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index cda3c288..44b92b96 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -16,7 +16,7 @@ ruoyi: # 开发环境配置 server: # 服务器的HTTP端口,默认为80 - port: 8001 + port: 19002 servlet: # 应用的访问路径 context-path: /