企业微信审批功能跳转外部网页需要的配置(后端)

时间:2025-03-10 09:25:56
  • public Map test(@RequestParam("url") String url) throws NoSuchAlgorithmException, IOException {
  • Map<String ,Object> map = new HashMap<String ,Object>();
  • String corpid = 企业微信id;
  • String agentid = 应用id;
  • long timestamp = () / 1000;
  • String nonceStr = 随机字符串;
  • HttpsClient get= new HttpsClient();
  • String abc=("/cgi-bin/gettoken?corpid=“+corpid+”&corpsecret=”+corpsecret");
  • HashMap hashMap = (abc, );
  • String aurl="/cgi-bin/get_jsapi_ticket?access_token="+("access_token");
  • String xyz=(aurl);
  • HashMap hashMap2 = (xyz, );
  • String temp2 =(String) ("ticket");
  • String sign2 = "jsapi_ticket="+temp2+"&noncestr="+nonceStr+"&timestamp="+timestamp+"&url="+url;
  • String signature2 = "";
  • MessageDigest crypt2 = ("SHA-1");
  • ();
  • (("UTF-8"));
  • signature2 = byteToHex(());
  • String turl = "/cgi-bin/ticket/get?access_token="+("access_token")+"&type=agent_config";
  • String def=(turl);
  • HashMap hashMap3 = (def, );
  • String temp =(String) ("ticket");
  • String sign = "jsapi_ticket="+temp+"&noncestr="+nonceStr+"&timestamp="+timestamp+"&url="+url;
  • String signature = "";
  • MessageDigest crypt = ("SHA-1");
  • ();
  • (("UTF-8"));
  • signature = byteToHex(());
  • ("temp", temp);
  • ("url", url);
  • ("signature2", signature2);
  • ("corpid", corpid);
  • ("agentid", agentid);
  • ("timestamp", timestamp);
  • ("nonceStr", nonceStr);
  • ("signature", signature);
  • return map;
  • }