|
@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.util.Date;
|
|
|
|
|
|
@RestController
|
|
@@ -137,17 +138,17 @@ public class OauthRestController {
|
|
|
@RequestMapping("weixin/code")
|
|
|
@LoginRequired
|
|
|
public RedirectDto weixinQrCode() {
|
|
|
- return new RedirectDto("https://open.sxtvs.net/oauth/weixin/code/v1");
|
|
|
+ return new RedirectDto("https://open.sxtvs.net/oauth/weixin/code/v1?token=");
|
|
|
}
|
|
|
|
|
|
@RequestMapping("weixin/code/v1")
|
|
|
- public ModelAndView weixinQrCodeV1() {
|
|
|
- var token = HttpContextUtil.mustToken();
|
|
|
- logger.info("key", "oauth/weixin/code", "token", token);
|
|
|
+ public ModelAndView weixinQrCodeV1() throws UnsupportedEncodingException {
|
|
|
+// var token = HttpContextUtil.mustToken();
|
|
|
+// logger.info("key", "oauth/weixin/code", "token", token);
|
|
|
WxApiCreatePreAuthCodeResponse preAuthCodeResponse = wxRestService.createPreAuthCodeResponse();
|
|
|
// 这里使用预授权码跟用户token做一个映射
|
|
|
var preAuthCode = preAuthCodeResponse.getPreAuthCode();
|
|
|
- oauthService.saveStateMapping(token, preAuthCode);
|
|
|
+// oauthService.saveStateMapping(token, preAuthCode);
|
|
|
|
|
|
/*return new RedirectDto("https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=wx7040933fd0e4b0e8&pre_auth_code="
|
|
|
+ preAuthCode + "&redirect_uri=http%3A%2F%2Fopen.sxtvs.net%2Foauth%2Fweixin%2Fwx7040933fd0e4b0e8%2Fcallback&auth_type=1");*/
|