feat:修改
This commit is contained in:
		
							parent
							
								
									738e83c356
								
							
						
					
					
						commit
						6a2fb2e902
					
				| @ -17,10 +17,26 @@ const config = { | |||||||
|   port: 50189 |   port: 50189 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 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() | ||||||
|  | |||||||
| @ -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) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user