2025-05-15 10:50:28 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace AccountWeight;
|
|
|
|
|
|
|
2025-10-23 09:51:43 +08:00
|
|
|
|
use library\Interfaces\WechatAccountWeightAssessment as WechatAccountWeightAssessmentInterface;
|
|
|
|
|
|
use library\Interfaces\WechatFriendAddLimitAssessment as WechatFriendAddLimitAssessmentInterface;
|
2025-05-15 10:50:28 +08:00
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|