|
|
@ -376,10 +376,13 @@ public class QyWxOperationController { |
|
|
|
|
|
|
|
|
// user-agent加密
|
|
|
// user-agent加密
|
|
|
String header = request.getHeader("user-agent"); |
|
|
String header = request.getHeader("user-agent"); |
|
|
|
|
|
System.out.println("header-"+header); |
|
|
String crypt = Md5.crypt(header); |
|
|
String crypt = Md5.crypt(header); |
|
|
|
|
|
System.out.println("crypt-"+crypt); |
|
|
JSONObject ticketForApp = QyWxConfig.getQyWxJsApiTicketForApp(crypt); |
|
|
JSONObject ticketForApp = QyWxConfig.getQyWxJsApiTicketForApp(crypt); |
|
|
|
|
|
System.out.println("ticketForApp-"+ticketForApp); |
|
|
JSONObject ticketForEnterprise = QyWxConfig.getQyWxJsApiTicketForEnterprise(crypt); |
|
|
JSONObject ticketForEnterprise = QyWxConfig.getQyWxJsApiTicketForEnterprise(crypt); |
|
|
|
|
|
System.out.println("ticketForEnterprise-"+ticketForEnterprise); |
|
|
Integer errcodeForEnterprise = ticketForEnterprise.getInteger("errcode"); |
|
|
Integer errcodeForEnterprise = ticketForEnterprise.getInteger("errcode"); |
|
|
Integer errcodeForApp = ticketForApp.getInteger("errcode"); |
|
|
Integer errcodeForApp = ticketForApp.getInteger("errcode"); |
|
|
// 获取企业的jsapi_ticket
|
|
|
// 获取企业的jsapi_ticket
|
|
|
@ -387,18 +390,24 @@ public class QyWxOperationController { |
|
|
String ticketForEnterApps = ""; |
|
|
String ticketForEnterApps = ""; |
|
|
if (Integer.compare(0, errcodeForEnterprise) == 0) { |
|
|
if (Integer.compare(0, errcodeForEnterprise) == 0) { |
|
|
ticketForEnterprises = ticketForEnterprise.getString("ticket"); |
|
|
ticketForEnterprises = ticketForEnterprise.getString("ticket"); |
|
|
|
|
|
System.out.println("ticketForEnterprises----->"+ticketForEnterprises); |
|
|
} |
|
|
} |
|
|
if (Integer.compare(0, errcodeForApp) == 0) { |
|
|
if (Integer.compare(0, errcodeForApp) == 0) { |
|
|
ticketForEnterApps = ticketForApp.getString("ticket"); |
|
|
ticketForEnterApps = ticketForApp.getString("ticket"); |
|
|
|
|
|
System.out.println("ticketForEnterApps----->"+ticketForEnterApps); |
|
|
} |
|
|
} |
|
|
Integer expires_in = ticketForEnterprise.getInteger("expires_in"); |
|
|
Integer expires_in = ticketForEnterprise.getInteger("expires_in"); |
|
|
|
|
|
|
|
|
// 步骤1. 将这些参数拼接成字符串string1:
|
|
|
// 步骤1. 将这些参数拼接成字符串string1:
|
|
|
String jsapi_ticket_app = "jsapi_ticket=" + ticketForEnterApps + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; |
|
|
String jsapi_ticket_app = "jsapi_ticket=" + ticketForEnterApps + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; |
|
|
|
|
|
System.out.println("jsapi_ticket_app-"+jsapi_ticket_app); |
|
|
String jsapi_ticket_enterprises = "jsapi_ticket=" + ticketForEnterprises + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; |
|
|
String jsapi_ticket_enterprises = "jsapi_ticket=" + ticketForEnterprises + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; |
|
|
|
|
|
System.out.println("jsapi_ticket_enterprises-"+jsapi_ticket_enterprises); |
|
|
// 步骤2. 对string1进行sha1签名,得到signature
|
|
|
// 步骤2. 对string1进行sha1签名,得到signature
|
|
|
s = DigestUtils.sha1Hex(jsapi_ticket_app); |
|
|
s = DigestUtils.sha1Hex(jsapi_ticket_app); |
|
|
|
|
|
System.out.println("s"+s); |
|
|
s1 = DigestUtils.sha1Hex(jsapi_ticket_enterprises); |
|
|
s1 = DigestUtils.sha1Hex(jsapi_ticket_enterprises); |
|
|
|
|
|
System.out.println("s1"+s1); |
|
|
|
|
|
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().put("wms_QyWxScanQrCodeSignature", "jsapi_ticket_app", s); |
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().put("wms_QyWxScanQrCodeSignature", "jsapi_ticket_app", s); |
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().put("wms_QyWxScanQrCodeSignature", "jsapi_ticket_enterprises", s1); |
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().put("wms_QyWxScanQrCodeSignature", "jsapi_ticket_enterprises", s1); |
|
|
@ -417,7 +426,7 @@ public class QyWxOperationController { |
|
|
result.put("corpid", QyWxConfig.corpid); |
|
|
result.put("corpid", QyWxConfig.corpid); |
|
|
result.put("agentid", String.valueOf(QyWxConfig.AgentId)); |
|
|
result.put("agentid", String.valueOf(QyWxConfig.AgentId)); |
|
|
result.put("url", url); |
|
|
result.put("url", url); |
|
|
|
|
|
System.out.println("url-"+url); |
|
|
|
|
|
|
|
|
return new RestResponse(result); |
|
|
return new RestResponse(result); |
|
|
} |
|
|
} |
|
|
|