prepare("SELECT em_code, em_user FROM employee WHERE id = ?"); $stmt->bind_param("i", $chkact); $stmt->execute(); $result = $stmt->get_result(); $employeeCode = ''; $employeeName = '未知业务员'; if ($row = $result->fetch_assoc()) { $employeeCode = $row['em_code']; $employeeName = $row['em_user']; } $stmt->close(); // 检查是否有客户已经属于目标业务员 $checkSql = "SELECT GROUP_CONCAT(id) as existing_ids FROM customer WHERE cs_belong = " . (int)$chkact . " AND id IN " . $sqlStr; $checkResult = $conn->query($checkSql); $existingIds = ""; if ($checkResult && $checkRow = $checkResult->fetch_assoc()) { $existingIds = $checkRow['existing_ids']; } if (!empty($existingIds)) { // 有客户已经属于该业务员,显示错误信息 echo ""; exit; } $updateStr = "UPDATE customer SET cs_updatetime='" . date('Y-m-d H:i:s') . "', cs_code=REPLACE(cs_code, '-', '/$employeeCode-'), cs_belong=" . (int)$chkact . ", cs_chain=CONCAT(cs_chain,'," . (int)$chkact . "') WHERE id IN " . $sqlStr; $deleteTag = "DELETE FROM tagtable WHERE customerId IN " . $sqlStr; $conn->query($updateStr); $conn->query($deleteTag); // 记录操作日志 $action = "{$_SESSION['employee_name']} 从标签【{$tagName}】批量转移{$count}个客户({$ids})给业务员【{$employeeName}】"; logAction($action); } header('Location: tag.php?tagName=' . urlencode($tagName)); exit; } // Get all tags for the current employee $tagStr = ''; $result = $conn->query("SELECT DISTINCT tagName FROM tagtable WHERE employeeId=" . $_SESSION['employee_id']); while ($row = $result->fetch_assoc()) { $tagStr .= "" . htmlspecialcharsFix($row['tagName']) . ","; } ?> 管理区域

序号
客户编号
渠道来源
区域
跟进阶段
录入时间
操作
real_escape_string($tagName) . "')"; $result = $conn->query($sqlStr); $tempNum = 0; while ($row = $result->fetch_assoc()) { $tempNum++; ?>
query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']); echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未填写'; ?>
query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']); echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未填写'; ?>
成交"; } elseif ($row['cs_deal'] == 2) { echo "明确需求"; } elseif ($row['cs_deal'] == 1) { echo "背景调查"; } else { echo "无响应"; } ?>
联系方式
备注
query("SELECT tagName FROM tagtable WHERE customerId=" . $row['id']); while ($tagRow = $tagResult->fetch_assoc()) { $tagStr1 = str_replace( "" . htmlspecialcharsFix($tagRow['tagName']) . "", "" . htmlspecialcharsFix($tagRow['tagName']) . "", $tagStr1 ); } echo $tagStr1; ?>