From b6b608922ae5231d24c6ea8ec8d8fbf795965c28 Mon Sep 17 00:00:00 2001 From: 3y Date: Tue, 6 Dec 2022 22:24:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91=20=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=87=AD=E8=AF=81=E6=A0=A1=E9=AA=8C=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E6=88=90=20=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/MiniProgramController.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/MiniProgramController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/MiniProgramController.java index 23e4c67..32a9b8e 100644 --- a/austin-web/src/main/java/com/java3y/austin/web/controller/MiniProgramController.java +++ b/austin-web/src/main/java/com/java3y/austin/web/controller/MiniProgramController.java @@ -2,6 +2,7 @@ package com.java3y.austin.web.controller; import cn.binarywang.wx.miniapp.api.WxMaSubscribeService; +import cn.hutool.http.HttpUtil; import com.google.common.base.Throwables; import com.java3y.austin.common.constant.AustinConstant; import com.java3y.austin.common.enums.RespStatusEnum; @@ -75,5 +76,20 @@ public class MiniProgramController { } } + /** + * 登录凭证校验 + * + * @return + */ + @GetMapping("/sync/openid") + @ApiOperation("登录凭证校验") + public BasicResultVO syncOpenId(String code) { + String appId = "xxx"; + String secret = "xxxxx"; + String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appId + "&secret=" + secret + "&js_code=" + code + "&grant_type=authorization_code"; + String result = HttpUtil.get(url); + System.out.println(result); + return BasicResultVO.success(result); + } }