|
@@ -128,7 +128,7 @@ public class WeChatController {
|
|
|
* 跳转首页权限
|
|
|
*/
|
|
|
@GetMapping("/getPageAuthorization")
|
|
|
- public void getPageAuthorization(){
|
|
|
+ public void getPageAuthorization() throws UnsupportedEncodingException {
|
|
|
String http = "https://";
|
|
|
String code = request.getParameter("code");
|
|
|
String userAgent = request.getHeader("User-Agent");
|
|
@@ -155,9 +155,30 @@ public class WeChatController {
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
- if((null == request.getSession().getAttribute("openid")) && (StringUtils.isBlank(request.getSession().getAttribute("openid").toString()))){
|
|
|
+ Object obj = request.getSession().getAttribute("openid");
|
|
|
+ if((obj != null) && (StringUtils.isNotBlank(obj.toString()))){
|
|
|
+ try{
|
|
|
+ LambdaQueryWrapper<MceMbuser> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(MceMbuser::getOpenid,request.getSession().getAttribute("openid"));
|
|
|
+ MceMbuser one = mceMbuserService.getOne(queryWrapper);
|
|
|
+ if(one != null){
|
|
|
+ request.getSession().setAttribute("phone",one.getPhone());
|
|
|
+ String sendUrl = "https://manager.usky.cn/mobile/#/pages/index?op="+one.getOpenid();
|
|
|
+ response.sendRedirect(sendUrl);
|
|
|
+ }else{
|
|
|
+ request.getSession().removeAttribute("openid");
|
|
|
+ request.getSession().removeAttribute("phone");
|
|
|
+
|
|
|
+ response.sendRedirect("https://manager.usky.cn/mobile/#/pages/login");
|
|
|
+ }
|
|
|
+ }catch (IOException e){
|
|
|
+ throw new BusinessException(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
if(StringUtils.isBlank(code)){
|
|
|
- String url = URLDecoder.decode(http+constant.call_back_domain+request.getRequestURI());
|
|
|
+ String temp = http+constant.call_back_domain+"/prod-api/service-iot"+request.getRequestURI();
|
|
|
+ String url = URLDecoder.decode(temp, "UTF-8");
|
|
|
String sendUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+constant.WE_CHAT_APP_ID+"&redirect_uri="+url+"&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect";
|
|
|
try{
|
|
|
System.out.println("sendUrl: "+sendUrl);
|
|
@@ -194,24 +215,6 @@ public class WeChatController {
|
|
|
throw new BusinessException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
- try{
|
|
|
- LambdaQueryWrapper<MceMbuser> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(MceMbuser::getOpenid,request.getSession().getAttribute("openid"));
|
|
|
- MceMbuser one = mceMbuserService.getOne(queryWrapper);
|
|
|
- if(one != null){
|
|
|
- request.getSession().setAttribute("phone",one.getPhone());
|
|
|
- String sendUrl = "https://manager.usky.cn/mobile/#/pages/index?op="+one.getOpenid();
|
|
|
- response.sendRedirect(sendUrl);
|
|
|
- }else{
|
|
|
- request.getSession().removeAttribute("openid");
|
|
|
- request.getSession().removeAttribute("phone");
|
|
|
-
|
|
|
- response.sendRedirect("https://manager.usky.cn/mobile/#/pages/login");
|
|
|
- }
|
|
|
- }catch (IOException e){
|
|
|
- throw new BusinessException(e.getMessage());
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -347,9 +350,9 @@ public class WeChatController {
|
|
|
|
|
|
TemplateMsgEntityVO messageVo=new TemplateMsgEntityVO();
|
|
|
messageVo.setTTitle(infoTitle);
|
|
|
- messageVo.setTKeyword1("测试1");
|
|
|
- messageVo.setTKeyword2("测试2");
|
|
|
- messageVo.setTKeyword3("测试3");
|
|
|
+ messageVo.setTKeyword1(infoContent);
|
|
|
+// messageVo.setTKeyword2("测试2");
|
|
|
+// messageVo.setTKeyword3("测试3");
|
|
|
messageVo.setTRemark(infoContent);
|
|
|
messageVo.setTUrl(String.format(constant.WE_CHAT_CUSTOMER_CALL_URL,infoId));
|
|
|
messageVo.setTemplateId(constant.WE_CHAT_TEMPLATE_ID);
|