From 36b9fe60321d28cddd12d2185af089efd902f549 Mon Sep 17 00:00:00 2001 From: 3y Date: Sun, 15 Jan 2023 20:53:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=B5=8B=E8=AF=95=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E5=88=A0=E9=99=A4=E6=B3=A8=E5=86=8C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OfficialAccountParamConstant.java | 2 +- .../controller/OfficialAccountController.java | 36 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/austin-common/src/main/java/com/java3y/austin/common/constant/OfficialAccountParamConstant.java b/austin-common/src/main/java/com/java3y/austin/common/constant/OfficialAccountParamConstant.java index 9b75998..bd7d927 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/constant/OfficialAccountParamConstant.java +++ b/austin-common/src/main/java/com/java3y/austin/common/constant/OfficialAccountParamConstant.java @@ -39,7 +39,7 @@ public class OfficialAccountParamConstant { /** * 扫码/关注后/取消关注后的服务号文案 */ - public static final String SUBSCRIBE_TIPS = "关注公众号:Java3y 回复 austin 可获取项目笔记哟!"; + public static final String SUBSCRIBE_TIPS = "项目群还有少量名额,添加我的微信 sanwai3y 备注【项目】,我会拉入项目群"; public static final String SCAN_TIPS = "咋又扫码啦?重新关注一波吧!"; public static final String UNSUBSCRIBE_TIPS = "老乡别走!"; diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/OfficialAccountController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/OfficialAccountController.java index df98a5e..e4f75fb 100644 --- a/austin-web/src/main/java/com/java3y/austin/web/controller/OfficialAccountController.java +++ b/austin-web/src/main/java/com/java3y/austin/web/controller/OfficialAccountController.java @@ -3,6 +3,7 @@ package com.java3y.austin.web.controller; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.google.common.base.Throwables; import com.java3y.austin.common.constant.CommonConstant; @@ -31,9 +32,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import java.util.*; /** * 微信服务号 @@ -199,4 +198,35 @@ public class OfficialAccountController { return null; } } + + /** + * 原因:微信测试号最多只能拥有100个测试用户 + *

+ * 临时 删除测试号的用户,避免正常有问题 + *

+ * 【正常消息推送平台不会有这个接口】 + * + * @return + */ + @RequestMapping("/delete/test/user") + @ApiOperation("/删除测试号的测试用户") + public BasicResultVO deleteTestUser(HttpServletRequest request ) { + try { + String cookie = request.getHeader("Cookie"); + List openIds = loginUtils.getLoginConfig() + .getOfficialAccountLoginService().getUserService().userList(null).getOpenids(); + for (String openId : openIds) { + Map params = new HashMap<>(4); + params.put("openid", openId); + params.put("random", "0.859336489537766"); + params.put("action", "delfan"); + HttpUtil.createPost("http://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo") + .header("Cookie", cookie).form(params).execute(); + } + return BasicResultVO.success(); + } catch (Exception e) { + log.error("OfficialAccountController#deleteTestUser fail:{}", Throwables.getStackTraceAsString(e)); + return null; + } + } }