<!DOCTYPE html>
<html>
<head>
	<meta charset='UTF-8'>
	<title>API Key有效性检测</title>
	<meta name='description' content='输入您的API Key,查询其使用次数、首次使用时间以及是否过期。'>
	<meta name='keywords' content='API Key, 有效性, 检测, 查询, 使用次数, 首次使用时间, 过期,  API接口, 工具'>
	<script src='https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
	<style>
		body{
			font-family: Arial, Helvetica, sans-serif;
			background-color: #f2f2f2;
		}
		h1{
			text-align: center;
			margin-top: 50px;
		}
		form{
			margin: 50px auto;
			width: 50%;
			background-color: #fff;
			padding: 20px;
			border-radius: 10px;
			box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
		}
		label{
			display: block;
			margin-bottom: 10px;
			font-weight: bold;
		}
		input[type='text']{
			padding: 5px;
			border-radius: 5px;
			border: none;
			box-shadow: 0px 0px 5px rgba(0,0,0,0.2);
			width: 100%;
			margin-bottom: 20px;
		}
		input[type='submit']{
			background-color: #4CAF50;
			color: #fff;
			padding: 10px 20px;
			border: none;
			border-radius: 5px;
			cursor: pointer;
		}
		input[type='submit']:hover{
			background-color: #3e8e41;
		}
		.result{
			margin: 50px auto;
			width: 50%;
			background-color: #fff;
			padding: 20px;
			border-radius: 10px;
			box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
			display: none;
		}
		.result h2{
			margin-top: 0px;
			margin-bottom: 20px;
			font-weight: bold;
			text-align: center;
		}
		.result p{
			font-weight: bold;
			margin-bottom: 10px;
		}
	</style>
</head>
<body>
	<h1>API Key有效性检测</h1>
	<form id='queryForm'>
		<label for='keys'>请输入您的API Key:</label>
		<input type='text' id='keys' name='keys' placeholder='例如:sk-xxxxxxxxxxxx'>
		<input type='submit' value='查询'>
	</form>
	<div class='result'>
		<h2>查询结果</h2>
		<p>API Key:<span id='result-keys'></span></p>
		<p>今日已使用次数:<span id='result-useAmount'></span></p>
		<p>首次使用时间:<span id='result-activateTime'></span></p>
		<p>Key状态:<span id='result-status'></span></p>
	</div>
	<script>
		$(function(){
			$('#queryForm').submit(function(event){
				event.preventDefault(); //阻止表单提交
				var keys = $('#keys').val(); //获取keys
				$.post('https://svip-api.cveoy.top/v3/grants', {'keys': keys}, function(data){
					$('.result').show();
					$('#result-keys').text(data.keys);
					$('#result-useAmount').text(data.useAmount);
					var activateTime = new Date(parseInt(data.activateTime));
					$('#result-activateTime').text(activateTime.toLocaleString());
					var expireTime = new Date(activateTime.getTime() + 5*24*60*60*1000); //添加5天
					var nowTime = new Date();
					if((nowTime.getTime() - activateTime.getTime())/1000/60 > 7200){ //大于7200分钟
						$('#result-status').text('Key已到期!');
					}else{
						$('#result-status').text('Key有效');
					}
				}, 'json');
			});
		});
	</script>
</body>
</html>
API Key有效性检测工具

原文地址: https://www.cveoy.top/t/topic/jsz2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录