微信接入

1.微信接入签名验证

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String signature = request.getParameter("signature");
		String timestamp = request.getParameter("timestamp");
		String nonce = request.getParameter("nonce");
		String echostr = request.getParameter("echostr");
		String Token = "************";
		System.out.println(signature+" "+timestamp+" "+nonce+" "+echostr);
		
		if(CheckUtil.checkSignature(signature, timestamp, nonce)){
			System.out.println("签名正确");
			response.getWriter().write(echostr);
		}else {
			System.out.println("签名错误");
		}
		
	}

其中验证签名的加密方法如下 (网上有很多找一个SHA1加密算法即可)

public static boolean checkSignature(String signature,String timestamp,String nonce){
		String[] arr = new String[]{token,timestamp,nonce};
		//排序
		Arrays.sort(arr);
		
		//生成字符串
		StringBuffer content = new StringBuffer();
		for(int i=0;i<arr.length;i++){
			content.append(arr[i]);
		}
		
		//sha1加密
		String temp = getSha1(content.toString());
		System.out.println(temp);
		return temp.equals(signature);
	}
	
	//sha1加密
	public static String getSha1(String str){
        if(str==null||str.length()==0){
            return null;
        }
        char hexDigits[] = {'0','1','2','3','4','5','6','7','8','9',
                'a','b','c','d','e','f'};
        try {
            MessageDigest mdTemp = MessageDigest.getInstance("SHA1");
            mdTemp.update(str.getBytes("UTF-8"));

            byte[] md = mdTemp.digest();
            int j = md.length;
            char buf[] = new char[j*2];
            int k = 0;
            for (int i = 0; i < j; i++) {
                byte byte0 = md[i];
                buf[k++] = hexDigits[byte0 >>> 4 & 0xf];
                buf[k++] = hexDigits[byte0 & 0xf];      
            }
            return new String(buf);
        } catch (Exception e) {
            // TODO: handle exception
            return null;
        }
    }




企业微信接入midjourney的具体步骤如下: 1. 登录企业微信开发者平台,创建应用。在「应用管理」中点击「创建应用」,填写应用名称、应用logo等基本信息。 2. 获取应用的AgentId、CorpId和Secret。在应用详情页中可以找到这些信息,将它们记录下来备用。 3. 在企业微信开发者平台配置应用的回调URL。在「应用管理」-「应用详情」-「基本信息」中找到「业务设置」栏目,点击「设置」,填写回调URL,该URL将用于接收企业微信的消息和事件推送。 4. 在企业微信开发者平台设置应用的权限。在「权限管理」-「成员授权」中选择需要使用应用的企业成员,并分配相应的权限。 5. 在midjourney平台添加企业微信适配器。在midjourney后台,在「渠道管理」中选择「添加渠道」,选择企业微信,并填写相关配置信息:AgentId、CorpId和Secret。 6. 配置企业微信适配器的回调URL。在midjourney后台,进入「渠道管理」-「企业微信渠道」,找到对应的适配器,并填写回调URL,该URL将用于接收企业微信消息和事件推送。 7. 测试和验证。在midjourney后台,可以使用模拟器功能进行测试,验证企业微信与midjourney的消息互通情况。 通过以上步骤,你就可以完成企业微信接入midjourney,并开始使用midjourney提供的各种功能来管理和处理企业微信的消息和事件了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值