Răsfoiți Sursa

数据汇聚

孙永军 2 ani în urmă
părinte
comite
296fb903b5

+ 8 - 3
src/main/java/com/sxtvs/open/api/odata/controller/OauthRestController.java

@@ -24,6 +24,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
 
 import java.util.Date;
 
@@ -135,7 +136,7 @@ public class OauthRestController {
 
     @RequestMapping("weixin/code")
     @LoginRequired
-    public RedirectDto weixinQrCode() {
+    public ModelAndView weixinQrCode() {
         var token = HttpContextUtil.mustToken();
         logger.info("key", "oauth/weixin/code", "token", token);
         WxApiCreatePreAuthCodeResponse preAuthCodeResponse = wxRestService.createPreAuthCodeResponse();
@@ -143,8 +144,12 @@ public class OauthRestController {
         var preAuthCode = preAuthCodeResponse.getPreAuthCode();
         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");
+        /*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");*/
+        ModelAndView modelAndView1 = new ModelAndView();
+        modelAndView1.setViewName("weixin-code");
+        modelAndView1.addObject("pre_auth_code", preAuthCode);
+        return modelAndView1;
     }