更新bug
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use app\adminapi\logic\stats\ConversionLogic;
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
function conversionFanRuleExpect(bool $condition, string $message): void
|
||||
{
|
||||
if (!$condition) {
|
||||
throw new RuntimeException($message);
|
||||
}
|
||||
}
|
||||
|
||||
$method = new ReflectionMethod(ConversionLogic::class, 'loadFanRows');
|
||||
$sourceLines = file($method->getFileName());
|
||||
if ($sourceLines === false) {
|
||||
throw new RuntimeException('无法读取加粉统计源码');
|
||||
}
|
||||
$methodSource = implode('', array_slice(
|
||||
$sourceLines,
|
||||
$method->getStartLine() - 1,
|
||||
$method->getEndLine() - $method->getStartLine() + 1
|
||||
));
|
||||
|
||||
conversionFanRuleExpect(
|
||||
str_contains($methodSource, "->where('e.change_type', 'add_external_contact')"),
|
||||
'加粉必须继续以企微 add_external_contact 事件为事实来源'
|
||||
);
|
||||
conversionFanRuleExpect(
|
||||
!str_contains($methodSource, 'msg_audit_approved'),
|
||||
'会话存档同意是独立能力,不能再次成为加粉统计的硬性条件'
|
||||
);
|
||||
conversionFanRuleExpect(
|
||||
str_contains($methodSource, "['del_external_contact', \$endTimestamp]"),
|
||||
'加粉统计必须继续排除区间内已删除客户'
|
||||
);
|
||||
conversionFanRuleExpect(
|
||||
str_contains($methodSource, "['add_external_contact', \$startTimestamp]"),
|
||||
'加粉统计必须继续排除区间开始前已添加的重加客户'
|
||||
);
|
||||
conversionFanRuleExpect(
|
||||
str_contains($methodSource, "->group('e.user_id, e.external_userid')"),
|
||||
'加粉统计必须继续按员工和客户去重'
|
||||
);
|
||||
|
||||
$excludeMethod = new ReflectionMethod(ConversionLogic::class, 'excludeUncountedFanPairs');
|
||||
$excludeSource = implode('', array_slice(
|
||||
$sourceLines,
|
||||
$excludeMethod->getStartLine() - 1,
|
||||
$excludeMethod->getEndLine() - $excludeMethod->getStartLine() + 1
|
||||
));
|
||||
conversionFanRuleExpect(
|
||||
str_contains($excludeSource, '[1, 2, 3, 201, 202]'),
|
||||
'取消会话存档条件后仍须排除扫一扫、搜手机号、名片分享及继承/分配客户'
|
||||
);
|
||||
|
||||
$pageSource = file_get_contents(
|
||||
dirname(__DIR__, 2) . '/admin/src/views/first_visit/conversion/index.vue'
|
||||
);
|
||||
conversionFanRuleExpect(
|
||||
is_string($pageSource) && !str_contains($pageSource, '须会话同意'),
|
||||
'页面口径说明不能继续宣称加粉依赖会话存档同意'
|
||||
);
|
||||
|
||||
echo "Conversion fan event rule: OK\n";
|
||||
Reference in New Issue
Block a user