Merge branch 'dev_tcp2byte' of http://47.122.70.237:3000/harmony_car/subject-two into dev_tcp2byte

This commit is contained in:
wangzhongjie 2025-03-05 19:45:28 +08:00
commit 27db86cf2a
2 changed files with 18 additions and 2 deletions

View File

@ -18,10 +18,26 @@ const config = {
port: 40000 port: 40000
} }
const singleTcpClient = (function () {
let instance;
function createInstance() {
return socket.constructTCPSocketInstance()
}
return {
getClient: function () {
if (!instance) {
instance = createInstance();
}
return instance
}
};
})();
export default async function tcp2ByteRequest(data): Promise<RES> { export default async function tcp2ByteRequest(data): Promise<RES> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const tcpClient: socket.TCPSocket = socket.constructTCPSocketInstance() const tcpClient: socket.TCPSocket = singleTcpClient.getClient()
const {address,port} = config const {address,port} = config
const tcp2Byte = new TcpToByte() const tcp2Byte = new TcpToByte()

View File

@ -324,7 +324,7 @@ export default class TcpToByte {
//考试路线 //考试路线
const ksxl = str2UTF8(temp.ksxl) const ksxl = str2UTF8(temp.ksxl)
//考车号码 //考车号码
const kchp = str2UTF8(temp.kchp) // const kchp = str2UTF8(temp.kchp)
const time = timeTOBCD(temp.jssj) const time = timeTOBCD(temp.jssj)