Validate.php文件修改后不生效,我检查了语法没什么问题,测试注册第6个域名就是不抛出异常
/**
* Check if user has exceeded domain limit by counting SLDs for the same client_id.
*/
public function checkUserDomainLimit(int $clientId): bool
{
// Hardcoded domain limit with switch
$domainLimitEnabled = true; // 硬编码开关:true=启用,false=禁用
$domainLimit = 5; // 硬编码域名数量限制
if (!$domainLimitEnabled) {
return true; // 如果开关关闭,不限制域名数量
}
// 查询同一个client_id在service_domain表中的记录数量
$domainCount = $this->di['db']->getCell(
'SELECT COUNT(sld) FROM service_domain WHERE client_id = :client_id',
[':client_id' => $clientId]
);
if ($domainCount >= $domainLimit) {
throw new \FOSSBilling\InformationException(
'User has reached the domain limit of :limit domains',
[':limit' => $domainLimit]
);
}
return true;
}
2
10

10 条回复
排序