feat: 第三方登录完善
This commit is contained in:
@@ -60,11 +60,11 @@ public class CallBackController {
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam(value = "msg_signature", required = false) String msgSignature) {
|
||||
// log.info("接收到微信消息:requestBody:{}", requestBody);
|
||||
log.info("接收到微信消息:requestBody:{}", requestBody);
|
||||
Map<String, String> messageMap = MessageUtil.parseXml(requestBody);
|
||||
String msgType = messageMap.get("MsgType");
|
||||
String event = messageMap.get("Event") == null ? "" : messageMap.get("Event");
|
||||
// log.info("msgType:{},event:{}", msgType, event);
|
||||
log.info("msgType:{},event:{}", msgType, event);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(msgType);
|
||||
@@ -78,7 +78,7 @@ public class CallBackController {
|
||||
return "unknown";
|
||||
}
|
||||
String replyContent = weChatMsgHandler.dealMsg(messageMap);
|
||||
// log.info("replyContent:{}", replyContent);
|
||||
log.info("replyContent:{}", replyContent);
|
||||
return replyContent;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.schisandra.wechat.handler;
|
||||
|
||||
import com.schisandra.wechat.redis.RedisUtil;
|
||||
import com.schisandra.wechat.rpc.AuthRpc;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -22,9 +21,6 @@ public class ReceiveTextMsgHandler implements WeChatMsgHandler {
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Resource
|
||||
private AuthRpc authRpc;
|
||||
|
||||
@Override
|
||||
public WeChatMsgTypeEnum getMsgType() {
|
||||
return WeChatMsgTypeEnum.TEXT_MSG;
|
||||
@@ -53,29 +49,6 @@ public class ReceiveTextMsgHandler implements WeChatMsgHandler {
|
||||
"</xml>";
|
||||
|
||||
return replyContent;
|
||||
}else if (LOGIN_KEY_WORD.equals(content)) {
|
||||
Boolean result = authRpc.wechatLogin(toUserName);
|
||||
if (result) {
|
||||
String replyContent = "<xml>\n" +
|
||||
" <ToUserName><![CDATA[" + fromUserName + "]]></ToUserName>\n" +
|
||||
" <FromUserName><![CDATA[" + toUserName + "]]></FromUserName>\n" +
|
||||
" <CreateTime>12345678</CreateTime>\n" +
|
||||
" <MsgType><![CDATA[text]]></MsgType>\n" +
|
||||
" <Content><![CDATA[" + "登录成功" + "]]></Content>\n" +
|
||||
"</xml>";
|
||||
return replyContent;
|
||||
} else {
|
||||
String replyContent = "<xml>\n" +
|
||||
" <ToUserName><![CDATA[" + fromUserName + "]]></ToUserName>\n" +
|
||||
" <FromUserName><![CDATA[" + toUserName + "]]></FromUserName>\n" +
|
||||
" <CreateTime>12345678</CreateTime>\n" +
|
||||
" <MsgType><![CDATA[text]]></MsgType>\n" +
|
||||
" <Content><![CDATA[" + "登录失败" + "]]></Content>\n" +
|
||||
"</xml>";
|
||||
return replyContent;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
|
@@ -1,31 +0,0 @@
|
||||
package com.schisandra.wechat.rpc;
|
||||
|
||||
import com.schisandra.auth.api.SchisandraAuthFeignService;
|
||||
import com.schisandra.auth.entity.Result;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Classname AuthRpc
|
||||
* @BelongsProject: schisandra-cloud-storage
|
||||
* @BelongsPackage: com.schisandra.wechat.rpc
|
||||
* @Author: landaiqing
|
||||
* @CreateTime: 2024-06-20 22:59
|
||||
* @Description: TODO
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class AuthRpc {
|
||||
@Resource
|
||||
private SchisandraAuthFeignService schisandraAuthFeignService;
|
||||
|
||||
public Boolean wechatLogin(String openId) {
|
||||
Result result = schisandraAuthFeignService.wechatLogin(openId);
|
||||
if (result.getSuccess()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user