This commit is contained in:
parent
9c2c6dac78
commit
f864b82255
17
app.py
17
app.py
|
|
@ -322,6 +322,23 @@ def search_by_email():
|
||||||
return "Email address not found.", 404
|
return "Email address not found.", 404
|
||||||
|
|
||||||
|
|
||||||
|
# 新增根据域名搜索的路由
|
||||||
|
@app.route('/search_domain')
|
||||||
|
def search_by_domain():
|
||||||
|
domain = request.args.get('domain')
|
||||||
|
if not domain:
|
||||||
|
return "Domain is required.", 400
|
||||||
|
|
||||||
|
# 遍历 customer_data 查找匹配的域名
|
||||||
|
for index, customer in enumerate(customer_data):
|
||||||
|
if domain in customer:
|
||||||
|
# 找到匹配的域名,跳转到对应的 index
|
||||||
|
return redirect(url_for('view_customer', index=index))
|
||||||
|
|
||||||
|
# 如果没有找到匹配的域名
|
||||||
|
return "Domain not found.", 404
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# # 提取字段结构
|
# # 提取字段结构
|
||||||
# field_structure = extract_index_structure(es, 'customer')
|
# field_structure = extract_index_structure(es, 'customer')
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,17 @@
|
||||||
<button onclick="searchByEmail()">Search by Email</button>
|
<button onclick="searchByEmail()">Search by Email</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 搜索域名的输入框和按钮 -->
|
||||||
|
<div>
|
||||||
|
<input type="text" id="domainSearch" placeholder="Enter domain">
|
||||||
|
<button onclick="searchByDomain()">Search by Domain</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Pagination buttons -->
|
<!-- Pagination buttons -->
|
||||||
<div>
|
<div>
|
||||||
<button {% if is_first %}disabled{% endif %}>
|
<button {% if is_first %}disabled{% endif %}>
|
||||||
|
|
@ -113,6 +122,14 @@
|
||||||
window.location.href = `/search?email=${encodeURIComponent(email)}`;
|
window.location.href = `/search?email=${encodeURIComponent(email)}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增的搜索域名功能
|
||||||
|
function searchByDomain() {
|
||||||
|
const domain = document.getElementById('domainSearch').value;
|
||||||
|
if (domain) {
|
||||||
|
window.location.href = `/search_domain?domain=${encodeURIComponent(domain)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue