Fix API errors and improve customer discovery with real web results
- Fix usage/stats 500: use Date() not datetime.date() for SQL cast - Fix customers 422: raise size limit to 1000 - Replace unreliable MCP client with direct Bing batch search for discovery - Batch all search queries in one browser session (faster) - Show real company names/URLs from Bing, not generic templates - Smart filter for non-business results (news, blogs, forums) - Fallback suggestions when search results are insufficient - Frontend: clickable contact URLs, provider indicator, better layout
This commit is contained in:
@@ -11,12 +11,24 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div v-if="results.length">
|
||||
<el-card v-for="r in results" :key="r.id || r.name" shadow="hover" style="margin-top:12px">
|
||||
<h4>{{ r.name }} <el-tag v-if="r.match_score" size="small" :type="scoreType(r.match_score)">{{ r.match_score }}%</el-tag></h4>
|
||||
<p v-if="r.description" style="color:#666;font-size:13px">{{ r.description }}</p>
|
||||
<p v-if="r.contact" style="font-size:12px;color:#999">联系方式:{{ r.contact }}</p>
|
||||
<div style="margin-top:8px">
|
||||
<el-alert v-if="provider === 'template' || provider === '建议'" title="以下为搜索策略建议,可用于手动开发客户" type="warning" show-icon :closable="false" style="margin-bottom:12px" />
|
||||
<el-alert v-if="provider === 'bing'" title="以下为搜索到的相关公司,点击'访问网站'了解更多,也可添加为客户" type="info" show-icon :closable="false" style="margin-bottom:12px" />
|
||||
<el-card v-for="(r, idx) in results" :key="r.id || r.name || idx" shadow="hover" style="margin-top:12px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center">
|
||||
<h4 style="margin:0">{{ r.name }} <el-tag v-if="r.match_score" size="small" :type="scoreType(r.match_score)">{{ r.match_score }}%</el-tag></h4>
|
||||
<el-tag v-if="r.source && provider !== 'template'" size="small" type="info">{{ r.source }}</el-tag>
|
||||
</div>
|
||||
<p v-if="r.description" style="color:#666;font-size:13px;margin:8px 0">{{ r.description }}</p>
|
||||
<p v-if="r.contact" style="font-size:12px;color:#999;margin:4px 0">
|
||||
联系方式:
|
||||
<template v-if="r.contact.startsWith('http')">
|
||||
<a :href="r.contact" target="_blank" rel="noopener">{{ r.contact.substring(0, 50) }}{{ r.contact.length > 50 ? '…' : '' }}</a>
|
||||
</template>
|
||||
<template v-else>{{ r.contact }}</template>
|
||||
</p>
|
||||
<div style="margin-top:8px;display:flex;gap:8px">
|
||||
<el-button size="small" type="primary" @click="addCustomer(r)">添加为客户</el-button>
|
||||
<el-button v-if="r.contact && r.contact.startsWith('http')" size="small" @click="openUrl(r.contact)">访问网站</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
@@ -55,6 +67,9 @@ const tab = ref('search')
|
||||
const loading = ref(false)
|
||||
const searched = ref(false)
|
||||
const results = ref([])
|
||||
const provider = ref('')
|
||||
|
||||
function openUrl(url) { window.open(url, '_blank') }
|
||||
const form = ref({ product: '', market: '' })
|
||||
const outForm = ref({ company: '', product: '', channel: 'email' })
|
||||
const outLoading = ref(false)
|
||||
@@ -73,6 +88,7 @@ async function search() {
|
||||
})
|
||||
const d = res.data || res
|
||||
results.value = d.companies || d.items || d.results || d || []
|
||||
provider.value = d.provider || ''
|
||||
} catch { ElMessage.error('挖掘失败') }
|
||||
finally { loading.value = false }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user