|
@@ -118,37 +118,43 @@ public class WeChatController {
|
|
* 跳转首页权限
|
|
* 跳转首页权限
|
|
*/
|
|
*/
|
|
@GetMapping("/getPageAuthorization")
|
|
@GetMapping("/getPageAuthorization")
|
|
- public void getPageAuthorization(@RequestParam(value = "openId",required = false) String openId) throws UnsupportedEncodingException {
|
|
|
|
|
|
+ public ApiResult<MceMbuser> getPageAuthorization(@RequestParam(value = "openId",required = false) String openId) throws UnsupportedEncodingException {
|
|
String http = "https://";
|
|
String http = "https://";
|
|
String code = request.getParameter("code");
|
|
String code = request.getParameter("code");
|
|
System.out.println("String openId: "+openId);
|
|
System.out.println("String openId: "+openId);
|
|
LOGGER.info("String openId: "+openId);
|
|
LOGGER.info("String openId: "+openId);
|
|
|
|
|
|
if((openId != null) && (openId != "")){
|
|
if((openId != null) && (openId != "")){
|
|
- try{
|
|
|
|
LambdaQueryWrapper<MceMbuser> queryWrapper = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<MceMbuser> queryWrapper = Wrappers.lambdaQuery();
|
|
queryWrapper.eq(MceMbuser::getOpenid,openId).last("LIMIT 1");
|
|
queryWrapper.eq(MceMbuser::getOpenid,openId).last("LIMIT 1");
|
|
MceMbuser one = mceMbuserService.getOne(queryWrapper);
|
|
MceMbuser one = mceMbuserService.getOne(queryWrapper);
|
|
- if(one != null){
|
|
|
|
- //String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_INDEX+"?openId="+one.getOpenid();
|
|
|
|
- String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_INDEX+"?flag=true";
|
|
|
|
- response.sendRedirect(URLDecoder.decode(sendUrl, "UTF-8"));
|
|
|
|
- }else{
|
|
|
|
- //String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_LOGIN+"?openId="+openId;
|
|
|
|
- String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_LOGIN+"?flag=true";
|
|
|
|
- response.sendRedirect(URLDecoder.decode(sendUrl, "UTF-8"));
|
|
|
|
- }
|
|
|
|
- }catch (IOException e){
|
|
|
|
- throw new BusinessException(e.getMessage());
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ return ApiResult.success(one);
|
|
|
|
+// try{
|
|
|
|
+// LambdaQueryWrapper<MceMbuser> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+// queryWrapper.eq(MceMbuser::getOpenid,openId).last("LIMIT 1");
|
|
|
|
+// MceMbuser one = mceMbuserService.getOne(queryWrapper);
|
|
|
|
+// if(one != null){
|
|
|
|
+// //String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_INDEX+"?openId="+one.getOpenid();
|
|
|
|
+// String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_INDEX+"?flag=true";
|
|
|
|
+// response.sendRedirect(URLDecoder.decode(sendUrl, "UTF-8"));
|
|
|
|
+// }else{
|
|
|
|
+// //String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_LOGIN+"?openId="+openId;
|
|
|
|
+// String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_LOGIN+"?flag=true";
|
|
|
|
+// response.sendRedirect(URLDecoder.decode(sendUrl, "UTF-8"));
|
|
|
|
+// }
|
|
|
|
+// }catch (IOException e){
|
|
|
|
+// throw new BusinessException(e.getMessage());
|
|
|
|
+// }
|
|
|
|
|
|
}else{
|
|
}else{
|
|
- try{
|
|
|
|
- String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_LOGIN+"?flag=true";
|
|
|
|
- response.sendRedirect(URLDecoder.decode(sendUrl, "UTF-8"));
|
|
|
|
- }catch (IOException e){
|
|
|
|
- throw new BusinessException(e.getMessage());
|
|
|
|
- }
|
|
|
|
|
|
+ throw new BusinessException("openId null");
|
|
|
|
+// try{
|
|
|
|
+// String sendUrl = http+constant.call_back_domain+constant.WE_CHAT_LOGIN+"?flag=true";
|
|
|
|
+// response.sendRedirect(URLDecoder.decode(sendUrl, "UTF-8"));
|
|
|
|
+// }catch (IOException e){
|
|
|
|
+// throw new BusinessException(e.getMessage());
|
|
|
|
+// }
|
|
// if(StringUtils.isBlank(code)){
|
|
// if(StringUtils.isBlank(code)){
|
|
// String temp = http+constant.call_back_domain+"/prod-api/service-iot"+request.getRequestURI();
|
|
// String temp = http+constant.call_back_domain+"/prod-api/service-iot"+request.getRequestURI();
|
|
// String url = URLDecoder.decode(temp, "UTF-8");
|
|
// String url = URLDecoder.decode(temp, "UTF-8");
|