Files
cunkebao_v3/Server/extend/AccountWeight/WechatFriendAddLimitAssessment.php
2025-10-23 09:51:43 +08:00

25 lines
718 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace AccountWeight;
use library\Interfaces\WechatAccountWeightAssessment as WechatAccountWeightAssessmentInterface;
use library\Interfaces\WechatFriendAddLimitAssessment as WechatFriendAddLimitAssessmentInterface;
class WechatFriendAddLimitAssessment implements WechatFriendAddLimitAssessmentInterface
{
/**
* @inheritDoc
*/
public function maxLimit(WechatAccountWeightAssessmentInterface $weight): int
{
$adjusted = $scope = $weight->getWeightScope();
$lastDigit = $scope % 10;
if ($scope < 10) {
$adjusted = $lastDigit < 5 ? 5 : 10;
}
// 每5权重=1好友最多20个
return min(20, floor($adjusted / 5));
}
}