私域操盘手 - 微信号列表加友限制长度使用权重数据
This commit is contained in:
@@ -8,6 +8,7 @@ use app\common\model\DeviceUser as DeviceUserModel;
|
||||
use app\common\model\DeviceWechatLogin as DeviceWechatLoginModel;
|
||||
use app\common\model\User as UserModel;
|
||||
use app\common\model\WechatAccount as WechatAccountModel;
|
||||
use app\common\model\WechatCustomer as WechatCustomerModel;
|
||||
use app\common\model\WechatFriendShip as WechatFriendShipModel;
|
||||
use app\cunkebao\controller\BaseController;
|
||||
use library\ResponseHelper;
|
||||
@@ -25,7 +26,15 @@ class GetWechatsOnDevicesV1Controller extends BaseController
|
||||
*/
|
||||
protected function getCanAddFriendCount(string $wechatId): int
|
||||
{
|
||||
return 20; // 最多限制 20 次
|
||||
$weight = (string)WechatCustomerModel::where(
|
||||
[
|
||||
'wechatId' => $wechatId,
|
||||
'companyId' => $this->getUserInfo('companyId')
|
||||
]
|
||||
)
|
||||
->value('weight');
|
||||
|
||||
return json_decode($weight)->addLimit ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +45,7 @@ class GetWechatsOnDevicesV1Controller extends BaseController
|
||||
*/
|
||||
protected function getTodayNewFriendCount(string $ownerWechatId): int
|
||||
{
|
||||
return WechatFriendShipModel::where( compact('ownerWechatId') )
|
||||
return WechatFriendShipModel::where(compact('ownerWechatId'))
|
||||
->whereBetween('createTime',
|
||||
[
|
||||
strtotime(date('Y-m-d 00:00:00')),
|
||||
@@ -65,7 +74,13 @@ class GetWechatsOnDevicesV1Controller extends BaseController
|
||||
*/
|
||||
protected function getFriendsCount(string $ownerWechatId): int
|
||||
{
|
||||
return WechatFriendShipModel::where(compact('ownerWechatId'))->count();
|
||||
return WechatFriendShipModel::where(
|
||||
[
|
||||
'ownerWechatId' => $ownerWechatId,
|
||||
'companyId' => $this->getUserInfo('companyId'),
|
||||
]
|
||||
)
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,9 +23,7 @@ class ActivityWeigth implements WechatAccountWeightResultSetInterface
|
||||
)
|
||||
->value('activity');
|
||||
|
||||
$activity = json_decode($activity, true);
|
||||
|
||||
return $activity->yesterdayMsgCount ?? 0;
|
||||
return json_decode($activity)->yesterdayMsgCount ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ class AgeWeight implements WechatAccountWeightResultSetInterface
|
||||
)
|
||||
->value('basic');
|
||||
|
||||
$basic = json_decode($basic, true);
|
||||
$basic = json_decode($basic);
|
||||
|
||||
// 如果没有设置账号注册时间,则默认今天,即账号年龄为0
|
||||
return $basic && isset($basic->registerDate) ? $basic->registerDate : date('Y-m-d', time());
|
||||
|
||||
Reference in New Issue
Block a user