diff --git a/Server/application/cunkebao/controller/wechat/GetWechatsOnDevicesV1Controller.php b/Server/application/cunkebao/controller/wechat/GetWechatsOnDevicesV1Controller.php index 3deb2a7f..7041d8d9 100644 --- a/Server/application/cunkebao/controller/wechat/GetWechatsOnDevicesV1Controller.php +++ b/Server/application/cunkebao/controller/wechat/GetWechatsOnDevicesV1Controller.php @@ -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(); } /** diff --git a/Server/extend/AccountWeight/UnitWeight/ActivityWeigth.php b/Server/extend/AccountWeight/UnitWeight/ActivityWeigth.php index dde5f9e3..5763ea4f 100644 --- a/Server/extend/AccountWeight/UnitWeight/ActivityWeigth.php +++ b/Server/extend/AccountWeight/UnitWeight/ActivityWeigth.php @@ -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; } /** diff --git a/Server/extend/AccountWeight/UnitWeight/AgeWeight.php b/Server/extend/AccountWeight/UnitWeight/AgeWeight.php index 6025ebfc..02a2833e 100644 --- a/Server/extend/AccountWeight/UnitWeight/AgeWeight.php +++ b/Server/extend/AccountWeight/UnitWeight/AgeWeight.php @@ -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());