登录的时候消息发送异常,后台报错
来源:9-12 执行系统消息异步收发(一)
视线模糊
2023-08-04
好像是类型不匹配
UserController中的login方法
int id = userService.login(form.getCode());
传入的是整型
public Integer login(String code) {
String openId = getOpenId(code);
Integer id = userDao.searchIdByOpenId(openId);
if (id == null) {
throw new EmosException(“账户不存在”);
}
// 从消息队列中接收消息,转移到消息表
messageTask.receiveAsync(id + “”);
return id;
}
但是在MessageTask中的 receiveAsync是需要字符型 ,是不是需要转换一下喃
public int receiveAsync(String topic) {
return receive(topic);
}
写回答
1回答
-
神思者
2023-08-04
你给后端的登陆方法设置断点,看一下解析出来的id是什么。如果令牌有问题,解析出来的id就不对,你debug看一下
042023-08-07
相似问题