| | |
| | | SPUtils.put(app.getAppContext(),SPUtils.DES_HEX_PWD,des); |
| | | JKMessage0101 jkMessage0101 = new JKMessage0101(); |
| | | // jkMessage0101.des =((JKMessage8100) jk2019MessageBase).des; |
| | | int time =(int) System.currentTimeMillis(); |
| | | jkMessage0101.timestamp = time; |
| | | byte[] miwen =Utils.encrypt(ByteUtil.intGetBytes(time),des); |
| | | MyLog.i(PlatFormConstant.TAG,"鉴权密文="+BytesUtils.bytesToHexString(miwen)+" time="+time); |
| | | long time =System.currentTimeMillis()/1000; |
| | | int unsignedInt = Utils.parseUnsignedInt(String.valueOf(time),10); |
| | | MyLog.i(String.format("总秒数(long)=%d,装换成unsigned int= %d",time,unsignedInt)); |
| | | jkMessage0101.timestamp = unsignedInt; |
| | | byte[] miwen =Utils.encrypt(ByteUtil.intGetBytes(unsignedInt),des); |
| | | MyLog.i(PlatFormConstant.TAG,"鉴权密文="+BytesUtils.bytesToHexString(miwen)+" time="+unsignedInt); |
| | | jkMessage0101.des = BytesUtils.bytesToHexString(miwen); |
| | | sendMessage(jkMessage0101); |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_REGISTERED); |
| | |
| | | MyLog.i(PlatFormConstant.TAG,"鉴权成功"); |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_LOGIN); |
| | | }else{ |
| | | MyLog.i(PlatFormConstant.TAG,"收到了鉴权消息,但鉴权不成功"); |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_NOT_LOGIN); |
| | | } |
| | | }else if (jk2019MessageBase instanceof JKMessage8201){ |
| | |
| | | @Override |
| | | public void run() { |
| | | |
| | | if (IMSClientBootstrap.getInstance().isActive()){ |
| | | IMSClientBootstrap.getInstance().sendMessage(messageEscaper.escape(msg.toBytes())); |
| | | |
| | | |
| | | if ( ExamPlatformData.getInstance().getExamplatformStatus() == ExamPlatformData.DEV_LOGIN){ |
| | | if (IMSClientBootstrap.getInstance().isActive()){ |
| | | IMSClientBootstrap.getInstance().sendMessage(messageEscaper.escape(msg.toBytes())); |
| | | }else{ |
| | | Log.e(TAG, "run: 发送消息失败,未初始化连接NettyTcp"); |
| | | } |
| | | }else{ |
| | | Log.e(TAG, "run: 发送消息失败,未初始化连接NettyTcp"); |
| | | JK2019MessageBase jk2019MessageBase = MessageManager.get(msg.toString()); |
| | | if ((jk2019MessageBase instanceof JKMessage0100) || (jk2019MessageBase instanceof JKMessage0101)){ |
| | | |
| | | if (IMSClientBootstrap.getInstance().isActive()){ |
| | | IMSClientBootstrap.getInstance().sendMessage(messageEscaper.escape(msg.toBytes())); |
| | | }else{ |
| | | Log.e(TAG, "run: 发送消息失败,未初始化连接NettyTcp"); |
| | | } |
| | | }else{ |
| | | MyLog.i(PlatFormConstant.TAG,"登录未成功,不能发送消息="+BytesUtils.bytesToHexString(ByteUtil.intGetBytes(jk2019MessageBase.messageId))); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |