私域操盘手 - 重构账号权限加友限制组件化用于计划任务单日加友限制
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user