32) { respond(400, '备注名不能超过32个字'); } try { ensureWebImAppTables(); $imDb = imDb(); $exists = $imDb->prepare('select 1 from `t_user` where `_uid` = ? limit 1'); $exists->execute([$targetId]); if (!$exists->fetchColumn()) { respond(404, '没有找到该用户'); } $friend = $imDb->prepare('select 1 from `t_friend` where `_uid` = ? and `_friend_uid` = ? limit 1'); $friend->execute([$userId, $targetId]); $isContact = (bool)$friend->fetchColumn(); if ($isContact) { requireImSuccess( imAdminPost('/admin/friend/set_alias', [ 'operator' => $userId, 'targetId' => $targetId, 'alias' => $alias, ]), '备注名修改失败' ); } saveWebUserRemark(imAppDb(), $userId, $targetId, $alias); respond(0, 'success', [ 'contact' => [ 'uid' => $targetId, 'alias' => $alias, 'isContact' => $isContact, ], ]); } catch (Throwable $error) { respond(500, $error->getMessage() ?: '备注名服务暂不可用'); }