限制查询条件
This commit is contained in:
@@ -60,8 +60,8 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
||||
const end = document.getElementById('dateEnd').value;
|
||||
const display = document.getElementById('resultsArea');
|
||||
|
||||
if (!term) {
|
||||
alert("请输入证书编号、持有人姓名或奖项名。");
|
||||
if (!term && !start && !end) {
|
||||
alert("请至少输入一个查询条件。");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,9 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
||||
|
||||
try {
|
||||
let query = sbClient.from('certificates').select('*');
|
||||
query = query.or(`cert_number.ilike.%${term}%,holder_name.ilike.%${term}%,honor_title.ilike.%${term}%`);
|
||||
if (term) {
|
||||
query = query.or(`cert_number.ilike.%${term}%,holder_name.ilike.%${term}%,honor_title.ilike.%${term}%`);
|
||||
}
|
||||
|
||||
if (start) query = query.gte('issue_date', start);
|
||||
if (end) query = query.lte('issue_date', end);
|
||||
|
||||
Reference in New Issue
Block a user