@isTest
public with sharing class NFM501HttpCallMock implements HttpCalloutMock {
	// 实现这个接口方法
	public HTTPResponse respond(HTTPRequest request) {
		// 创建一个假的回应
		if(request.getEndpoint().contains('test/v1/token')||request.getEndpoint().contains('v1/token')){
			System.debug('------------------------------------------------------');
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
			// response.setBody('{"object":"eyJhbGciOiJIUzUxMiJ9","access_token":"eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImV4cCI6MTYyNDM1OTkzNH0.IXcAshOMZ08Y_ik7o-Iu4EmUy6o0pI9jz4xcx7orpxn6dTUV7wXVWqmdRl3Ded64Pq7OYKB5Vf_FQFUbgeyYjg","code":"0","msg":"正确返回数据"}');
			response.setBody('{"access_token":"eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImV4cCI6MTYyNDM1OTkzNH0.IXcAshOMZ08Y_ik7o-Iu4EmUy6o0pI9jz4xcx7orpxn6dTUV7wXVWqmdRl3Ded64Pq7OYKB5Vf_FQFUbgeyYjg","code":"0","msg":"正确返回数据"}');
			response.setStatus('OK');
			response.setStatusCode(0);
			// response.setStatusCode(200);
			return response;
		}else if(request.getEndpoint().contains('test/v1/info/page')){
			System.debug('++++++++++++++++++++++++++++++++++++++++++++++++++++++');
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
			response.setBody('{"object":"eyJhbGciOiJIUzUxMiJ9","code":"0","data":{"cursorMark":"60d01dde42ec7ed48d3730d6","list1":[{"infoId":"227328190","infoPublishTime":"2021-06-21 09:41:26","infoQianlimaUrl":"http://www.qianlima.com/zb/detail/20210621_227328190.html","projectId":"38_99df2844cf784982acdc61d00d7a7dbb"}]},"msg":"正确返回数据"}');
			response.setStatus('OK');
			response.setStatusCode(0);
			// response.setStatusCode(200);
			return response;
		}else if(request.getEndpoint().contains('test/v1/info/detailHtml')){
			System.debug('======================================================');
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
			response.setBody('{"object":"eyJhbGciOiJIUzUxMiJ9","code":"0","data":{"infoHtml":"<!DOCTYPE html><html>a</html>"},"msg":"正确返回数据"}');
			response.setStatus('OK');
			// Blob responseBody502 = Blob.valueOf(String.valueOf(response));
			// response.setBodyAsBlob(responseBody502);
			response.setStatusCode(0);
			return response;
		}else if(request.getEndpoint().contains('/api/token/getToken')){
			System.debug('======================================================');
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
			response.setBody('{"status":"0","message":"RT_SUCCESS","timestamp":1648705499476,"txId":null,"object":"eyJhbGciOiJIUzUxMiJ9.eyJjcmVhdGVkIjoxNjQ1NTg0MzMzNzA4LCJhcHBpZCI6Ik5oakM3cURuOFhTdHZkSU0iLCJleHAiOjE2NTA3NjgzMzN9.Us2DQubj1fXaoxbuTAMJCqSmFbLIdEjnlngJmyR8NejpeoL5G8_8GQ0YrjhmuZ4hlKYNSE7e4QXJq9a-eD86Lg","success":true}');
			response.setStatus('OK');
			//response:[responseBody={"status":"0","message":"RT_SUCCESS","timestamp":1648824454629,"txId":"959584836874403840","object":{"http://cusdata.qianlima.com/vip/info/download/V2/eyJhbGciOiJIUzI1NiJ9.eyJpbmZvSWQiOiIyNjU0MjU3NzkiLCJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImZpbGVVcmwiOiI2NzcxNEE3NjM0NkY3OTQzNTczMjVBMzg1NjY3NkY0NzdBNTE2NDVBNjM3NzNEM0QifQ.lR9LNgndLPmi3hxlaWru6xeKsPXTYnNaFxGVzmzoqM8":{"name":"附件_265425779_168189381.pdf","key":"20220401/5ac6ebae4ea845f49fc97c26c864d9fc.pdf"}},"success":true}, status=200]
			// Blob responseBody502 = Blob.valueOf(String.valueOf(response));
			// response.setBodyAsBlob(responseBody502);
			response.setStatusCode(0);
			return response;
		}else if(request.getEndpoint().contains('/api/nfm/503')){
			System.debug('======================================================');
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
			response.setBody('{"status":"0","message":"RT_SUCCESS","timestamp":1648824454629,"txId":"959584836874403840","object":{"http://cusdata.qianlima.com/vip/info/download/V2/eyJhbGciOiJIUzI1NiJ9.eyJpbmZvSWQiOiIyNjU0MjU3NzkiLCJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImZpbGVVcmwiOiI2NzcxNEE3NjM0NkY3OTQzNTczMjVBMzg1NjY3NkY0NzdBNTE2NDVBNjM3NzNEM0QifQ.lR9LNgndLPmi3hxlaWru6xeKsPXTYnNaFxGVzmzoqM8":{"name":"附件_265425779_168189381.pdf","key":"20220401/5ac6ebae4ea845f49fc97c26c864d9fc.pdf"}},"success":true}');
			response.setStatus('OK');
			//response:[responseBody={"status":"0","message":"RT_SUCCESS","timestamp":1648824454629,"txId":"959584836874403840","object":{"http://cusdata.qianlima.com/vip/info/download/V2/eyJhbGciOiJIUzI1NiJ9.eyJpbmZvSWQiOiIyNjU0MjU3NzkiLCJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImZpbGVVcmwiOiI2NzcxNEE3NjM0NkY3OTQzNTczMjVBMzg1NjY3NkY0NzdBNTE2NDVBNjM3NzNEM0QifQ.lR9LNgndLPmi3hxlaWru6xeKsPXTYnNaFxGVzmzoqM8":{"name":"附件_265425779_168189381.pdf","key":"20220401/5ac6ebae4ea845f49fc97c26c864d9fc.pdf"}},"success":true}, status=200]
			// Blob responseBody502 = Blob.valueOf(String.valueOf(response));
			// response.setBodyAsBlob(responseBody502);
			response.setStatusCode(0);
			return response;
		}else if(request.getEndpoint().contains('/api/nfm/502')){
			System.debug('======================================================');
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
			response.setBody('{"status":"0","message":"RT_SUCCESS","timestamp":1648824454629,"txId":"959584836874403840","object":{"http://cusdata.qianlima.com/vip/info/download/V2/eyJhbGciOiJIUzI1NiJ9.eyJpbmZvSWQiOiIyNjU0MjU3NzkiLCJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImZpbGVVcmwiOiI2NzcxNEE3NjM0NkY3OTQzNTczMjVBMzg1NjY3NkY0NzdBNTE2NDVBNjM3NzNEM0QifQ.lR9LNgndLPmi3hxlaWru6xeKsPXTYnNaFxGVzmzoqM8":{"name":"附件_265425779_168189381.pdf","key":"20220401/5ac6ebae4ea845f49fc97c26c864d9fc.pdf"}},"success":true}');
			response.setStatus('OK');
			//response:[responseBody={"status":"0","message":"RT_SUCCESS","timestamp":1648824454629,"txId":"959584836874403840","object":{"http://cusdata.qianlima.com/vip/info/download/V2/eyJhbGciOiJIUzI1NiJ9.eyJpbmZvSWQiOiIyNjU0MjU3NzkiLCJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImZpbGVVcmwiOiI2NzcxNEE3NjM0NkY3OTQzNTczMjVBMzg1NjY3NkY0NzdBNTE2NDVBNjM3NzNEM0QifQ.lR9LNgndLPmi3hxlaWru6xeKsPXTYnNaFxGVzmzoqM8":{"name":"附件_265425779_168189381.pdf","key":"20220401/5ac6ebae4ea845f49fc97c26c864d9fc.pdf"}},"success":true}, status=200]
			// Blob responseBody502 = Blob.valueOf(String.valueOf(response));
			// response.setBodyAsBlob(responseBody502);
			response.setStatusCode(0);
			return response;
		}else if(request.getEndpoint().contains('/api/nfm/501')){
			System.debug('======================================================');
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
			response.setBody('{"data":{"list1":[{"DataId":"958850380886708224","agentRelationWayEncrypted":["ca93b1d0d9e14d81119d429b03faa17c"],"agentRelationNameEncrypted":["9e8e6aa24a7bf37db834622fd302b7b4"],"zhongRelationWayEncrypted":[],"zhongRelationNameEncrypted":[],"zhaoRelationWayEncrypted":["9e4d791610abcc65d501f3d96f11bf50"],"zhaoRelationNameEncrypted":["c41f9f806b7de8fffae5cb668dbb09e4"],"allKeywords":"进口","moreZhongBiaoUnit":[],"zhongRelationWay":[],"zhongRelationName":[],"zhongBiaoUnit":[],"zhaoRelationWay":["***********"],"zhaoRelationName":["***"],"zhaoBiaoUnit":["无极县医院"],"xmNumber":"HBZJ-2022N0253","winnerAmount":[],"tenderEndTime":"2022-04-20 09:30:00","tenderBeginTime":"","target":null,"projectId":"14e9fe7920df42d697830ce12abf31f3","openBidingTime":"","keywords":"电切镜,硬性镜,超声刀,内窥镜,窥镜,内镜,输尿管软镜,支气管镜,气管镜","isElectronic":"0","infoTypeSegment":"3","infoType":"0","infoTitle":"无极县医院迁建项目部分医疗设备购置（三）公开招标公告","infoQianlimaUrl":"http://www.qianlima.com/zb/detail/20220330_265423120.html","infoPublishTime":"2022-03-30 17:07:25","infoId":"265423120","infoFile":["http://cusdata.qianlima.com/vip/info/download/V2/eyJhbGciOiJIUzI1NiJ9.eyJpbmZvSWQiOiIyNjU0MjMxMjAiLCJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImZpbGVVcmwiOiI1NTcyNTk3NTU1NTQ2QzY5NEY1OTZCNTE0MzUzNjc3MDVBNzUzNDU3NzQ0MTNEM0QifQ.9ZMaqZVUxWgc9xAlHvfNEjUnPKztSokDqqZU-tGqpLw"],"budget":[{"unit":"元","amount":"38706500.00"}],"bidingEndTime":"2022-04-20 09:30:00","bidingAcquireTime":"2022-03-31 09:00:00","biddingType":"0","areaProvince":"河北省","areaCountry":"无极县","areaCity":"石家庄市","agentUnit":["河北中机咨询有限公司"],"agentRelationWay":["***********"],"agentRelationName":["***"]}],"cursorMark":"62444cc820386292a07cf3a1"},"code":"0","msg":"正确返回数据"}');
			response.setStatus('OK');
			//response:[responseBody={"status":"0","message":"RT_SUCCESS","timestamp":1648824454629,"txId":"959584836874403840","object":{"http://cusdata.qianlima.com/vip/info/download/V2/eyJhbGciOiJIUzI1NiJ9.eyJpbmZvSWQiOiIyNjU0MjU3NzkiLCJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImZpbGVVcmwiOiI2NzcxNEE3NjM0NkY3OTQzNTczMjVBMzg1NjY3NkY0NzdBNTE2NDVBNjM3NzNEM0QifQ.lR9LNgndLPmi3hxlaWru6xeKsPXTYnNaFxGVzmzoqM8":{"name":"附件_265425779_168189381.pdf","key":"20220401/5ac6ebae4ea845f49fc97c26c864d9fc.pdf"}},"success":true}, status=200]
			// Blob responseBody502 = Blob.valueOf(String.valueOf(response));
			// response.setBodyAsBlob(responseBody502);
			response.setStatusCode(0);
			return response;
		}
		
		else{
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Disposition','filename=文件大小超过12M');
			Blob responseBody503 = Blob.valueOf('Blob[497920]');
			response.setBodyAsBlob(responseBody503);
			response.setStatus('OK');
			response.setStatusCode(0);
			return response;
		}
	}
}