类 WxgzhNoticeService

java.lang.Object
net.sohelp.boot.admin.core.service.notice.WxgzhNoticeService

@Service public class WxgzhNoticeService extends Object
微信公众号消息通知服务类 提供微信公众号相关的消息推送、二维码生成等功能
从以下版本开始:
2023/5/15
作者:
AaronFung
  • 构造器详细资料

    • WxgzhNoticeService

      public WxgzhNoticeService()
  • 方法详细资料

    • send

      public String send(Long userId, String title, String content) throws Exception
      根据用户ID发送公众号消息
      参数:
      userId - 用户ID
      title - 消息标题
      content - 消息内容
      返回:
      发送结果描述
      抛出:
      Exception - 发送过程中可能出现的异常
    • sendMsg

      public void sendMsg(String openId, String templateId, Map<String,String> dataMap) throws Exception
      使用指定模板向特定用户发送微信模板消息
      参数:
      openId - 接收消息的用户OpenID
      templateId - 模板消息ID
      dataMap - 模板数据键值对
      抛出:
      Exception - 发送过程中的异常信息
    • sendLoginMsg

      public String sendLoginMsg(String openId, String loginName, String message) throws SQLException, BusiException
      发送登录通知给指定用户
      参数:
      openId - 用户在微信平台的唯一标识
      loginName - 登录账户名称
      message - 附加的消息内容
      返回:
      微信接口返回的状态描述
      抛出:
      SQLException - SQL执行错误时抛出
      BusiException - 业务逻辑异常时抛出
    • send

      public String send(long userId, String loginName, String message) throws SQLException, BusiException
      根据用户ID发送登录通知
      参数:
      userId - 用户系统内部ID
      loginName - 登录用户名
      message - 通知正文内容
      返回:
      微信响应状态文本
      抛出:
      SQLException - 数据库操作异常
      BusiException - 业务处理异常
    • getCodeTicket

      public String getCodeTicket(String expireSecond, String sceneStr) throws BusiException
      创建带有字符串场景值的临时二维码票据
      参数:
      expireSecond - 二维码过期时间(单位:秒)
      sceneStr - 场景字符串,长度限制为1~64字符
      返回:
      二维码票据(ticket)
      抛出:
      BusiException - 业务异常情况
    • getCodeTicket

      public String getCodeTicket(String expireSecond, int sceneInt) throws SQLException, BusiException
      创建带有整数场景值的临时二维码票据
      参数:
      expireSecond - 二维码过期时间(单位:秒)
      sceneInt - 整型场景值,范围为1~100000(永久二维码最大值)
      返回:
      二维码票据(ticket)
      抛出:
      SQLException - 数据库访问异常
      BusiException - 业务处理异常
    • getSuccessUrl

      public String getSuccessUrl() throws SQLException, BusiException
      获取授权成功后跳转页面URL地址
      返回:
      成功回调地址
      抛出:
      SQLException - 数据查询异常
      BusiException - 配置缺失时抛出
    • checkSignature

      public boolean checkSignature(String signature, String timestamp, String nonce) throws BusiException
      验证来自微信服务器的签名合法性
      参数:
      signature - 微信加密签名
      timestamp - 时间戳
      nonce - 随机数
      返回:
      签名验证通过则返回true,否则false
      抛出:
      BusiException - 加密算法不可用等异常