fix: 修改鉴权码为testtoken
All checks were successful
iot-test-platform CI/CD / build-and-deploy (push) Successful in 25s
All checks were successful
iot-test-platform CI/CD / build-and-deploy (push) Successful in 25s
This commit is contained in:
@@ -12,50 +12,51 @@ import com.iot.transport.jt808.service.handler.MessageHandler;
|
||||
|
||||
/**
|
||||
* 终端注册 ==> 终端注册应答
|
||||
*
|
||||
* @author huaxl
|
||||
*/
|
||||
public class RegisterHandler extends MessageHandler {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
|
||||
public RegisterHandler() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(DataPack packageData) {
|
||||
|
||||
|
||||
PackHead header = packageData.getPackHead();
|
||||
logger.info("[终端注册],msgid={}, phone={},flowid={}", header.getId(), header.getTerminalPhone(), header.getFlowId());
|
||||
logger.info("[终端注册],msgid={}, phone={},flowid={}", header.getId(), header.getTerminalPhone(),
|
||||
header.getFlowId());
|
||||
try {
|
||||
|
||||
|
||||
RegisterPack msg = this.decoder.toTerminalRegisterMsg(packageData);
|
||||
log.debug("终端注册:{}", msg);
|
||||
|
||||
final String sessionId = Session.buildId(msg.getChannel());
|
||||
Session session = sessionManager.findBySessionId(sessionId);
|
||||
if (session == null) {
|
||||
session = Session.buildSession(msg.getChannel(), msg.getPackHead().getTerminalPhone());
|
||||
}
|
||||
session.setAuthenticated(true);
|
||||
session.setTerminalPhone(msg.getPackHead().getTerminalPhone());
|
||||
sessionManager.put(session.getId(), session);
|
||||
|
||||
RegisterBodyPack respMsgBody = new RegisterBodyPack();
|
||||
respMsgBody.setReplyCode(RegisterBodyPack.success);
|
||||
respMsgBody.setReplyFlowId(msg.getPackHead().getFlowId());
|
||||
// 使用手机号作为鉴权码
|
||||
respMsgBody.setReplyToken(msg.getPackHead().getTerminalPhone());
|
||||
|
||||
int flowId = super.getFlowId(msg.getChannel());
|
||||
byte[] bs = this.msgEncoder.encode4TerminalRegisterResp(msg, respMsgBody, flowId);
|
||||
final String sessionId = Session.buildId(msg.getChannel());
|
||||
Session session = sessionManager.findBySessionId(sessionId);
|
||||
if (session == null) {
|
||||
session = Session.buildSession(msg.getChannel(), msg.getPackHead().getTerminalPhone());
|
||||
}
|
||||
session.setAuthenticated(true);
|
||||
session.setTerminalPhone(msg.getPackHead().getTerminalPhone());
|
||||
sessionManager.put(session.getId(), session);
|
||||
|
||||
super.send2Client(msg.getChannel(), bs);
|
||||
RegisterBodyPack respMsgBody = new RegisterBodyPack();
|
||||
respMsgBody.setReplyCode(RegisterBodyPack.success);
|
||||
respMsgBody.setReplyFlowId(msg.getPackHead().getFlowId());
|
||||
// 使用固定鉴权码
|
||||
respMsgBody.setReplyToken("testtoken");
|
||||
|
||||
int flowId = super.getFlowId(msg.getChannel());
|
||||
byte[] bs = this.msgEncoder.encode4TerminalRegisterResp(msg, respMsgBody, flowId);
|
||||
|
||||
super.send2Client(msg.getChannel(), bs);
|
||||
} catch (Exception e) {
|
||||
logger.error("<<<<<err={}", e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user