This commit is contained in:
parent
9c2c6dac78
commit
f864b82255
17
app.py
17
app.py
|
|
@ -322,7 +322,24 @@ def search_by_email():
|
|||
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')
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,17 @@
|
|||
<input type="text" id="emailSearch" placeholder="Enter email address">
|
||||
<button onclick="searchByEmail()">Search by Email</button>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 搜索域名的输入框和按钮 -->
|
||||
<div>
|
||||
<input type="text" id="domainSearch" placeholder="Enter domain">
|
||||
<button onclick="searchByDomain()">Search by Domain</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
<!-- Pagination buttons -->
|
||||
<div>
|
||||
|
|
@ -113,6 +122,14 @@
|
|||
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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue