|
@@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.usky.common.core.bean.ApiResult;
|
|
|
import com.usky.common.core.exception.BusinessException;
|
|
|
+import com.usky.common.core.util.HttpUtils;
|
|
|
import com.usky.common.redis.core.RedisHelper;
|
|
|
import com.usky.iot.constant.constant;
|
|
|
import com.usky.iot.domain.SysWxOpuser;
|
|
|
import com.usky.iot.service.SysWxOpuserService;
|
|
|
+import com.usky.iot.service.vo.SendWeChatMessageRequestVO;
|
|
|
import com.usky.iot.service.vo.SignUpRequestVO;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import ma.glasnost.orika.impl.util.StringUtil;
|
|
|
import me.chanjar.weixin.common.api.WxConsts;
|
|
|
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
|
@@ -35,6 +38,7 @@ import java.util.Objects;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/weChat")
|
|
|
+@Slf4j
|
|
|
public class WeChatController {
|
|
|
@Autowired
|
|
|
private WxMpService wxMpService;
|
|
@@ -118,7 +122,7 @@ public class WeChatController {
|
|
|
.eq(SysWxOpuser::getType,"app");
|
|
|
SysWxOpuser one = sysWxOpuserService.getOne(queryWrapper);
|
|
|
if(one != null){
|
|
|
- String sendUrl = "https://aiot.usky.cn/work/#/pages/index?op="+one.getOpenid();
|
|
|
+ String sendUrl = "https://manager.usky.cn/mobile/#/pages/index?op="+one.getOpenid();
|
|
|
try{
|
|
|
System.out.println("sendUrl: "+sendUrl);
|
|
|
response.sendRedirect(sendUrl);
|
|
@@ -130,7 +134,7 @@ public class WeChatController {
|
|
|
}else{
|
|
|
if(!userAgent.contains("MicroMessenger")){
|
|
|
try{
|
|
|
- response.sendRedirect("https://aiot.usky.cn/work/#/pages/login");
|
|
|
+ response.sendRedirect("https://manager.usky.cn/mobile/#/pages/login");
|
|
|
}catch (IOException e){
|
|
|
throw new BusinessException(e.getMessage());
|
|
|
}
|
|
@@ -163,13 +167,13 @@ public class WeChatController {
|
|
|
if(one != null){
|
|
|
request.getSession().setAttribute("phone",one.getPhone());
|
|
|
|
|
|
- String sendUrl = "https://aiot.usky.cn/work/#/pages/index?op="+one.getOpenid();
|
|
|
+ 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://aiot.usky.cn/work/#/pages/login");
|
|
|
+ response.sendRedirect("https://manager.usky.cn/mobile/#/pages/login");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -186,13 +190,13 @@ public class WeChatController {
|
|
|
SysWxOpuser one = sysWxOpuserService.getOne(queryWrapper);
|
|
|
if(one != null){
|
|
|
request.getSession().setAttribute("phone",one.getPhone());
|
|
|
- String sendUrl = "https://aiot.usky.cn/work/#/pages/index?op="+one.getOpenid();
|
|
|
+ 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://aiot.usky.cn/work/#/pages/login");
|
|
|
+ response.sendRedirect("https://manager.usky.cn/mobile/#/pages/login");
|
|
|
}
|
|
|
}catch (IOException e){
|
|
|
throw new BusinessException(e.getMessage());
|
|
@@ -281,6 +285,28 @@ public class WeChatController {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 微信消息提醒
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PostMapping("sendWeChatMessage")
|
|
|
+// public Map<String,Object> sendWeChatMessage(@RequestBody SendWeChatMessageRequestVO requestVO){
|
|
|
+// String infoType = requestVO.getInfoType();
|
|
|
+// String infoTitle = requestVO.getInfoTitle();
|
|
|
+// String infoContent = requestVO.getInfoContent();
|
|
|
+// Map<String,Object> map = new HashMap<>();
|
|
|
+//
|
|
|
+// String s = null;
|
|
|
+// try {
|
|
|
+// s = HttpUtils.postForm(URL, body, null);
|
|
|
+// }catch (Exception e){
|
|
|
+// log.info("发送微信推送报警出错"+e);
|
|
|
+// }
|
|
|
+// return map;
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|