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();