Explorar el Código

修复已知问题

jiuling hace 1 año
padre
commit
67a7a246ac

+ 6 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/RuoYiSystemApplication.java

@@ -4,6 +4,8 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import com.ruoyi.common.security.annotation.EnableCustomConfig;
 import com.ruoyi.common.security.annotation.EnableRyFeignClients;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.client.RestTemplate;
 
 /**
  * 系统模块
@@ -29,4 +31,8 @@ public class RuoYiSystemApplication
                 " |  |  \\    /  \\      /           \n" +
                 " ''-'   `'-'    `-..-'              ");
     }
+    @Bean
+    public RestTemplate restTemplate() {
+        return new RestTemplate();
+    }
 }

+ 3 - 15
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -59,17 +59,6 @@ import org.springframework.web.client.RestTemplate;
 public class SysUserServiceImpl implements ISysUserService
 {
     private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
-    @Value("${weixin.appid}")
-    private String appid;
-
-    @Value("${weixin.secret}")
-    private String secret;
-
-    @Value("${weixin.token-expire}")
-    private long expire;
-
-    @Value("${weixin.token-secret}")
-    private String tokenSecret;
 
     @Autowired
     private RestTemplate restTemplate;
@@ -97,8 +86,7 @@ public class SysUserServiceImpl implements ISysUserService
 
     @Autowired
     protected Validator validator;
-    @Autowired
-    private RedisService redisService;
+
     @Autowired
     private TokenService tokenService;
 
@@ -596,8 +584,8 @@ public class SysUserServiceImpl implements ISysUserService
         try {
             // 调用微信接口获取openid
             String url = "https://api.weixin.qq.com/sns/jscode2session?" +
-                    "appid=" + appid + "&" +
-                    "secret=" + secret + "&" +
+                    "appid=" + "wxc738cddfb96a9176" + "&" +
+                    "secret=" + "3fb1122e5b811ec55272d84d203983b9" + "&" +
                     "js_code=" + loginBody.getCode() + "&" +
                     "grant_type=authorization_code";
             String result = restTemplate.getForObject(url, String.class);