545354
This commit is contained in:
1 parent
fa178be336
commit
4cbd7b4083
2 files changed
-114
No files matched your search
@@ -1503,61 +1503,6 @@
|
||||
<p>6.考研上岸</p>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
function getDomainSuffix() {
|
||||
|
||||
const hostname = window.location.hostname;
|
||||
|
||||
|
||||
const parts = hostname.split('.');
|
||||
|
||||
|
||||
if (parts.length < 2) {
|
||||
console.error('域名格式不正确,无法提取后缀');
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const tld = parts.slice(-2).join('.');
|
||||
console.log('提取的域名后缀:', tld);
|
||||
|
||||
|
||||
return tld;
|
||||
}
|
||||
|
||||
|
||||
const domainSuffix = getDomainSuffix();
|
||||
console.log('当前网站的域名后缀:', domainSuffix);
|
||||
|
||||
|
||||
if (domainSuffix) {
|
||||
const order = 'renew';
|
||||
const apiUrl = `https://www.nazhumi.com/api/v1?domain=${domainSuffix}&order=${order}`;
|
||||
|
||||
|
||||
async function fetchRenewalPrice() {
|
||||
try {
|
||||
const response = await fetch(apiUrl);
|
||||
const data = await response.json();
|
||||
const prices = data.data.price;
|
||||
const lowestPrice = prices.reduce((min, current) => {
|
||||
const renewPrice = parseFloat(current.renew);
|
||||
return (renewPrice < min) ? renewPrice : min;
|
||||
}, Infinity);
|
||||
console.log('最低续费价格:', lowestPrice);
|
||||
return lowestPrice;
|
||||
} catch (error) {
|
||||
console.error('获取数据失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fetchRenewalPrice();
|
||||
}
|
||||
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user