v1.0.39: 修复碎片总数不降反升 - social_accounts的profile_url/remark改为仅真实社媒账号(非phone/email)计入非必要层(conditional支持_not_in),补全人员写入的手机/邮箱账号不再误判软碎片,补全后碎片总数精确-1

This commit is contained in:
nanguaboss
2026-08-09 23:04:11 +08:00
parent 3a5cdcdd36
commit 8aca5b3bc6
2 changed files with 19 additions and 5 deletions
+18 -4
View File
@@ -31,7 +31,12 @@ const COMPLETENESS_LAYERS = [
'social_accounts' => [
'core' => ['platform', 'account_id'],
'important' => ['is_primary'],
'optional' => ['profile_url', 'remark'],
'optional' => [],
// 主页链接/备注仅对真实社媒账号(非 phone/email)计入非必要层;手机/邮箱账号无主页,不适用
'conditional' => [
'profile_url' => ['layer' => 'optional', 'when' => ['platform_not_in' => ['phone', 'email']]],
'remark' => ['layer' => 'optional', 'when' => ['platform_not_in' => ['phone', 'email']]],
],
'virtual' => [],
],
'media' => [
@@ -125,9 +130,18 @@ function completenessCalc($table, $row)
$layer = $cond['layer'] ?? 'optional';
$match = true;
foreach (($cond['when'] ?? []) as $wf => $wv) {
if ((string)($row[$wf] ?? '') !== (string)$wv) {
$match = false;
break;
// 支持 _not_in 后缀:字段值不在列表中才满足条件
if (substr($wf, -7) === '_not_in') {
$realField = substr($wf, 0, -7);
if (in_array((string)($row[$realField] ?? ''), (array)$wv, true)) {
$match = false;
break;
}
} else {
if ((string)($row[$wf] ?? '') !== (string)$wv) {
$match = false;
break;
}
}
}
if (!$match) {