|
|
@@ -10,6 +10,8 @@ import com.uas.sso.entity.Token;
|
|
|
import com.uas.sso.service.UserService;
|
|
|
import com.uas.sso.foreign.weixin.entity.UserInfo;
|
|
|
import com.uas.sso.foreign.weixin.service.WeChatService;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.Assert;
|
|
|
@@ -40,13 +42,16 @@ public class WeChatController extends BaseController {
|
|
|
|
|
|
private static final String WX_LOGIN_SCOPE = "snsapi_login";
|
|
|
|
|
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(WeChatController.class);
|
|
|
+
|
|
|
@RequestMapping("/getQrUrl")
|
|
|
public ModelMap getQrUrl(@RequestParam(defaultValue = "sso") String appId, @RequestParam String url) {
|
|
|
try {
|
|
|
url = url + (url.contains("?") ? "&" : "?") + "type=wx";
|
|
|
url = URLEncoder.encode(url, "utf8");
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
- throw new RuntimeException("程序编码异常");
|
|
|
+ LOGGER.warn("程序编码异常, {}", e.getMessage());
|
|
|
+ return error("程序编码异常");
|
|
|
}
|
|
|
String qrUrl = "https://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
|
|
|
App app = appService.findOne(appId);
|