From 0b81d1db0e139f356a2765b28d9dc153bd0d695b Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Mon, 7 Jul 2025 17:00:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E8=81=94=E8=B4=A6=E5=8F=B7=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wechat/GetWechatsRelatedDeviceV1Controller.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Server/application/cunkebao/controller/wechat/GetWechatsRelatedDeviceV1Controller.php b/Server/application/cunkebao/controller/wechat/GetWechatsRelatedDeviceV1Controller.php index 92d20ce63..0d8d45831 100644 --- a/Server/application/cunkebao/controller/wechat/GetWechatsRelatedDeviceV1Controller.php +++ b/Server/application/cunkebao/controller/wechat/GetWechatsRelatedDeviceV1Controller.php @@ -9,6 +9,7 @@ use app\common\model\WechatAccount as WechatAccountModel; use app\common\model\WechatFriendShip as WechatFriendShipModel; use app\cunkebao\controller\BaseController; use library\ResponseHelper; +use think\Db; use think\model\Collection as ResultCollection; /** @@ -100,9 +101,12 @@ class GetWechatsRelatedDeviceV1Controller extends BaseController * @param string $wechatId * @return string */ - protected function getWechatAliveText(string $wechatId): string + protected function getWechatAlive(string $wechatId): string { - return 1 ? '正常' : '异常'; + $wechat_account = Db::table('s2_wechat_account') + ->where('wechatId', $wechatId) + ->value('wechatAlive'); + return !empty($wechat_account) ? $wechat_account : 0; } /** @@ -140,7 +144,9 @@ class GetWechatsRelatedDeviceV1Controller extends BaseController $account->lastActive = $this->getWechatLastActiveTime($account->wechatId); $account->statusText = $this->getWechatStatusText($account->wechatId); $account->totalFriend = $this->getCountFriend($account->wechatId); - $account->wechatAliveText = $this->getWechatAliveText($account->wechatId); + $getWechatAlive = $this->getWechatAlive($account->wechatId); + $account->wechatAlive = $getWechatAlive; + $account->wechatAliveText = !empty($getWechatAlive) ? '正常' : '异常'; } return $collection->toArray();