Update ConversionLogic.php

This commit is contained in:
2026-05-04 17:37:14 +08:00
parent 28fbbd28b7
commit 1d6a2b9cbf
@@ -319,10 +319,13 @@ class ConversionLogic
->whereNull('a.delete_time'); ->whereNull('a.delete_time');
if ($visibleAdminIds !== null) { if ($visibleAdminIds !== null) {
if ($visibleAdminIds === []) { if ($visibleAdminIds === []) {
return []; // 与 HasDataScopeFilter::applyDataScopeByOwner 对齐:空集合用 0=1 闸门让 SQL 自然返回空,
} // 避免和"未传 visibleAdminIds (=SCOPE_ALL)"在调用侧产生混淆。
$query->whereRaw('0 = 1');
} else {
$query->whereIn('a.id', $visibleAdminIds); $query->whereIn('a.id', $visibleAdminIds);
} }
}
return $query return $query
->field(['a.id', 'a.name', 'a.account']) ->field(['a.id', 'a.name', 'a.account'])
@@ -575,10 +578,12 @@ class ConversionLogic
} }
if ($visibleAdminIds !== null) { if ($visibleAdminIds !== null) {
if ($visibleAdminIds === []) { if ($visibleAdminIds === []) {
return []; // 与 HasDataScopeFilter::applyDataScopeByOwner 对齐:空集合用 0=1 闸门让 SQL 自然返回空。
} $query->whereRaw('0 = 1');
} else {
$query->whereIn('a.id', $visibleAdminIds); $query->whereIn('a.id', $visibleAdminIds);
} }
}
$rows = $query->order('a.id asc')->select()->toArray(); $rows = $query->order('a.id asc')->select()->toArray();
$entities = []; $entities = [];
@@ -1798,10 +1803,12 @@ class ConversionLogic
if ($visibleAdminIds !== null) { if ($visibleAdminIds !== null) {
if ($visibleAdminIds === []) { if ($visibleAdminIds === []) {
return []; // 与 HasDataScopeFilter::applyDataScopeByOwner 对齐:空集合用 0=1 闸门让 SQL 自然返回空。
} $query->whereRaw('0 = 1');
} else {
$query->whereIn('a.id', $visibleAdminIds); $query->whereIn('a.id', $visibleAdminIds);
} }
}
if ($mediaChannel !== null) { if ($mediaChannel !== null) {
$query->leftJoin('qywx_external_contact q', 'q.external_userid = e.external_userid'); $query->leftJoin('qywx_external_contact q', 'q.external_userid = e.external_userid');