存客宝应用接口初始化
This commit is contained in:
25
extend/AccountWeight/WechatFriendAddLimitAssessment.php
Normal file
25
extend/AccountWeight/WechatFriendAddLimitAssessment.php
Normal file
@@ -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