websocket连接数据库 报错
$ws_worker->onMessage = function (TcpConnection $connection, $data) {
self::$_req_time = date("Y-m-d H:i:s");
$reqData = json_decode($data, true);
// 给connection临时设置一个lastMessageTime属性,用来记录上次收到消息的时间
$connection->lastMessageTime = time();
self::$_connection = $connection;
$this->output('接受到消息-data:%s:', [json_encode($reqData, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
$botInfo = app(SysTemBotListModel::class)->getInfo([
['bot_id', '=', '123']
], ['source']);
$response = self::chatSend($reqData);
if ($response) {
$this->output('发送消息-data:%s:', [json_encode($response, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
$connection->send(json_encode($response, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
}
};
提示不是很明显吗?没有app()这个方法啊