From 2a3abe593fd304d9a033f647f8d9f10828b71e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=B8=85=E7=88=BD?= Date: Thu, 15 May 2025 17:10:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=81=E5=9F=9F=E6=93=8D=E7=9B=98=E6=89=8B?= =?UTF-8?q?=20-=20=E5=BE=AE=E4=BF=A1=E5=8F=B7=E5=88=97=E8=A1=A8=E5=8A=A0?= =?UTF-8?q?=E5=8F=8B=E9=99=90=E5=88=B6=E9=95=BF=E5=BA=A6=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=9D=83=E9=87=8D=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GetWechatsOnDevicesV1Controller.php | 21 ++++++++++++++++--- .../UnitWeight/ActivityWeigth.php | 4 +--- .../AccountWeight/UnitWeight/AgeWeight.php | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) 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());