|
@@ -11,24 +11,24 @@ if (empty($keywords) || strlen($keywords) < 4) {
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
-$searchStr = "SELECT c.cs_code, cc.contact_name as cs_name, c.cs_country, cc.tel as cs_tel,
|
|
|
- cc.email as cs_email, cc.whatsapp as cs_whatsapp, cc.wechat as cs_wechat,
|
|
|
- cc.linkedin as cs_linkedin, cc.facebook as cs_facebook, c.cs_addtime,
|
|
|
- c.cs_from, c.cs_belong, c.cs_deal, cc.alibaba as cs_alibaba
|
|
|
+$searchStr = "SELECT c.id, c.cs_code, cc.contact_name as cs_name, c.cs_country, cc.tel_1 as cs_tel,
|
|
|
+ cc.email_1 as cs_email, cc.whatsapp_1 as cs_whatsapp, cc.wechat_1 as cs_wechat,
|
|
|
+ cc.linkedin_1 as cs_linkedin, cc.facebook_1 as cs_facebook, c.cs_addtime,
|
|
|
+ c.cs_from, c.cs_belong, c.cs_deal, cc.alibaba_1 as cs_alibaba
|
|
|
FROM customer c
|
|
|
LEFT JOIN customer_contact cc ON c.id = cc.customer_id
|
|
|
- WHERE (cc.tel_format LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
- OR cc.email LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
- OR cc.whatsapp_format LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
- OR cc.wechat LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
- OR cc.alibaba LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
- OR cc.linkedin LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
- OR cc.facebook LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
- OR cc.email LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
|
|
|
- OR cc.wechat LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
|
|
|
- OR cc.alibaba LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
|
|
|
- OR cc.linkedin LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
|
|
|
- OR cc.facebook LIKE '%" . $conn->real_escape_string($keywordsNative) . "%')";
|
|
|
+ WHERE (cc.tel_1_format LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
+ OR cc.email_1 LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
+ OR cc.whatsapp_1_format LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
+ OR cc.wechat_1 LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
+ OR cc.alibaba_1 LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
+ OR cc.linkedin_1 LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
+ OR cc.facebook_1 LIKE '%" . $conn->real_escape_string($keywords) . "%'
|
|
|
+ OR cc.email_1 LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
|
|
|
+ OR cc.wechat_1 LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
|
|
|
+ OR cc.alibaba_1 LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
|
|
|
+ OR cc.linkedin_1 LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
|
|
|
+ OR cc.facebook_1 LIKE '%" . $conn->real_escape_string($keywordsNative) . "%')";
|
|
|
?>
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
@@ -105,13 +105,112 @@ if ($result && $result->num_rows > 0) {
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td colspan="6" class="contacts">
|
|
|
- <div class="tel"><?= htmlspecialcharsFix($row['cs_tel']) ?></div>
|
|
|
- <div class="mail"><?= htmlspecialcharsFix($row['cs_email']) ?></div>
|
|
|
- <div class="whatsapp"><?= htmlspecialcharsFix($row['cs_whatsapp']) ?></div>
|
|
|
- <div class="wechat"><?= htmlspecialcharsFix($row['cs_wechat']) ?></div>
|
|
|
- <div class="linkedin"><?= htmlspecialcharsFix($row['cs_linkedin']) ?></div>
|
|
|
- <div class="facebook"><?= htmlspecialcharsFix($row['cs_facebook']) ?></div>
|
|
|
- <div class="alibaba"><?= htmlspecialcharsFix($row['cs_alibaba']) ?></div>
|
|
|
+ <?php
|
|
|
+ // 获取该客户的所有联系人信息
|
|
|
+ if (isset($row['id']) && !empty($row['id'])) {
|
|
|
+ $contact_sql = "SELECT * FROM customer_contact WHERE customer_id = " . (int)$row['id'];
|
|
|
+ $contact_result = mysqli_query($conn, $contact_sql);
|
|
|
+ while ($contact = mysqli_fetch_assoc($contact_result)) {
|
|
|
+ ?>
|
|
|
+ <div class="contact-block">
|
|
|
+ <?php if(!empty($contact['contact_name'])): ?>
|
|
|
+ <div class="contact-name"><?= htmlspecialcharsFix($contact['contact_name']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <div class="tel">
|
|
|
+ <?php if(!empty($contact['tel_1'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['tel_1']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['tel_2'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['tel_2']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['tel_3'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['tel_3']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ </div>
|
|
|
+ <div class="mail">
|
|
|
+ <?php if(!empty($contact['email_1'])): ?>
|
|
|
+ <div><a href="mailto:<?= $contact['email_1'] ?>"><?= htmlspecialcharsFix($contact['email_1']) ?></a></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['email_2'])): ?>
|
|
|
+ <div><a href="mailto:<?= $contact['email_2'] ?>"><?= htmlspecialcharsFix($contact['email_2']) ?></a></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['email_3'])): ?>
|
|
|
+ <div><a href="mailto:<?= $contact['email_3'] ?>"><?= htmlspecialcharsFix($contact['email_3']) ?></a></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ </div>
|
|
|
+ <div class="whatsapp">
|
|
|
+ <?php if(!empty($contact['whatsapp_1'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['whatsapp_1']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['whatsapp_2'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['whatsapp_2']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['whatsapp_3'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['whatsapp_3']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ </div>
|
|
|
+ <div class="wechat">
|
|
|
+ <?php if(!empty($contact['wechat_1'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['wechat_1']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['wechat_2'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['wechat_2']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['wechat_3'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['wechat_3']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ </div>
|
|
|
+ <div class="linkedin">
|
|
|
+ <?php if(!empty($contact['linkedin_1'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['linkedin_1']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['linkedin_2'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['linkedin_2']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['linkedin_3'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['linkedin_3']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ </div>
|
|
|
+ <div class="facebook">
|
|
|
+ <?php if(!empty($contact['facebook_1'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['facebook_1']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['facebook_2'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['facebook_2']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['facebook_3'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['facebook_3']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ </div>
|
|
|
+ <div class="alibaba">
|
|
|
+ <?php if(!empty($contact['alibaba_1'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['alibaba_1']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['alibaba_2'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['alibaba_2']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ <?php if(!empty($contact['alibaba_3'])): ?>
|
|
|
+ <div><?= htmlspecialcharsFix($contact['alibaba_3']) ?></div>
|
|
|
+ <?php endif; ?>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 如果没有ID,则显示查询返回的基本联系信息
|
|
|
+ ?>
|
|
|
+ <div class="contact-block">
|
|
|
+ <div class="tel"><?= htmlspecialcharsFix($row['cs_tel'] ?? '') ?></div>
|
|
|
+ <div class="mail"><?= htmlspecialcharsFix($row['cs_email'] ?? '') ?></div>
|
|
|
+ <div class="whatsapp"><?= htmlspecialcharsFix($row['cs_whatsapp'] ?? '') ?></div>
|
|
|
+ <div class="wechat"><?= htmlspecialcharsFix($row['cs_wechat'] ?? '') ?></div>
|
|
|
+ <div class="linkedin"><?= htmlspecialcharsFix($row['cs_linkedin'] ?? '') ?></div>
|
|
|
+ <div class="facebook"><?= htmlspecialcharsFix($row['cs_facebook'] ?? '') ?></div>
|
|
|
+ <div class="alibaba"><?= htmlspecialcharsFix($row['cs_alibaba'] ?? '') ?></div>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ ?>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<?php
|