| | |
| | | import org.springframework.web.server.ServerWebExchange; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigInteger; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * JWT获取令牌和刷新令牌接口 |
| | |
| | | return ApiResponse.failed( "登录已失效"); |
| | | } |
| | | |
| | | @ApiOperation("获取企业微信JS签名") |
| | | @PostMapping("/getQwSignature") |
| | | @ResponseBody |
| | | public ApiResponse<Object> getQwSignature(@RequestBody String url) { |
| | | |
| | | /* Map jsapiTicket = s; |
| | | String ticket = jsapiTicket.get("ticket").toString(); |
| | | String noncestr = UUID.randomUUID().toString(); |
| | | Long timestamp = System.currentTimeMillis() / 1000; |
| | | |
| | | String jsapiTicketStr = ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; |
| | | try { |
| | | MessageDigest instance = MessageDigest.getInstance("SHA-1"); |
| | | instance.update(jsapiTicketStr.getBytes()); |
| | | byte[] digest = instance.digest(); |
| | | BigInteger bigInteger = new BigInteger(1, digest); |
| | | String string = bigInteger.toString(); |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("noncestr", noncestr); |
| | | result.put("jsapi_ticket", string); |
| | | result.put("timestamp", timestamp); |
| | | result.put("url", url); |
| | | result.put("ticket", ticket); |
| | | return ApiResponse.success( result); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | throw new RuntimeException(e); |
| | | }*/ |
| | | return ApiResponse.failed( "获取签名失败"); |
| | | } |
| | | } |