关联账号状态优化

This commit is contained in:
wong
2025-07-07 17:00:52 +08:00
parent 2d4a1ee6ce
commit 0b81d1db0e

View File

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