feat:修改
This commit is contained in:
		
							parent
							
								
									0cb15e4c04
								
							
						
					
					
						commit
						7a197098aa
					
				| @ -73,13 +73,14 @@ function handSendMessage(client: socket.TCPSocket, type, data) { | |||||||
|     case '02-21-000012': |     case '02-21-000012': | ||||||
|     case '02-21-000014': |     case '02-21-000014': | ||||||
|       data.forEach((item) => { |       data.forEach((item) => { | ||||||
|         client.send({ data: new Uint8Array(item) }) |         console.log(TAG, JSON.stringify(item)) | ||||||
|  |         client.send({ data: new Uint8Array(item).buffer }) | ||||||
|       }) |       }) | ||||||
|       break; |       break; | ||||||
|     case '02-21-000010': |     case '02-21-000010': | ||||||
|     case '02-21-000011': |     case '02-21-000011': | ||||||
|     case '02-21-000013': |     case '02-21-000013': | ||||||
|       client.send({ data: new Uint8Array(data) }) |       client.send({ data: new Uint8Array(data).buffer }) | ||||||
|       break; |       break; | ||||||
| 
 | 
 | ||||||
|     default:break; |     default:break; | ||||||
| @ -107,7 +108,7 @@ function handReceiveMessage(client: socket.TCPSocket, sendData, receiveData):RES | |||||||
|       const end = start + 2; |       const end = start + 2; | ||||||
|       const packageIndex =  bytesToDecimal([start,end]); |       const packageIndex =  bytesToDecimal([start,end]); | ||||||
|       console.info(TAG, '补包内容' + JSON.stringify(new Uint8Array(sendData[packageIndex]))) |       console.info(TAG, '补包内容' + JSON.stringify(new Uint8Array(sendData[packageIndex]))) | ||||||
|       client.send({data:new Uint8Array(sendData[packageIndex])}); |       client.send({data:new Uint8Array(sendData[packageIndex]).buffer}); | ||||||
|     }) |     }) | ||||||
|   }else{ |   }else{ | ||||||
|     const decoder =  util.TextDecoder.create('utf-8'); |     const decoder =  util.TextDecoder.create('utf-8'); | ||||||
|  | |||||||
| @ -447,14 +447,15 @@ export default class TcpToByte { | |||||||
| 
 | 
 | ||||||
|   // 图片处理
 |   // 图片处理
 | ||||||
|   getBytePhoto(base64) { |   getBytePhoto(base64) { | ||||||
|     const thisBase64 = base64.split(',')[1] |     const buffer = Buffer.from(base64, 'base64'); | ||||||
|     const buffer = Buffer.from(thisBase64, 'base64'); |     let arr = [] | ||||||
|     //@ts-ignore
 |     for (let i = 0; i < buffer.length; i++) { | ||||||
|     const arr = Array.from(buffer) |       arr.push(buffer[i]); | ||||||
| 
 |     } | ||||||
|     return (string2Bytes(arr.length + 5, 4 * 8)).concat([0]).concat(string2Bytes(arr.length, 4 * 8)).concat(arr) |     return (string2Bytes(arr.length + 5, 4 * 8)).concat([0]).concat(string2Bytes(arr.length, 4 * 8)).concat(arr) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|   //随机获取流水号
 |   //随机获取流水号
 | ||||||
|   getRandomLsh() { |   getRandomLsh() { | ||||||
|     return Math.floor(Math.random() * 65535); |     return Math.floor(Math.random() * 65535); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user