jiangping
2025-04-16 9f1e7f80a3260c30e1e534437da5c79e17fc20af
server/src/main/java/com/doumee/api/web/WebMemberController.java
@@ -19,6 +19,12 @@
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获取令牌和刷新令牌接口
@@ -90,4 +96,33 @@
        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 + "&timestamp=" + 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( "获取签名失败");
    }
}