service = ImService::getInstance(); } public function bind() { $clientId = request()->input('client_id'); try { return jok($this->service->bindClientIdByUserId($clientId)); } catch (\Exception $e) { return jerr($e->getMessage()); } } /** * 发送消息 * @Method POST * @return JsonResponse */ public function sendMessage() { $messageType = request()->post('message_type'); $data = request()->post('data'); $toUserId = request()->post('to_user_id'); $chatRoomId = request()->post('chat_room_id'); $replayId = request()->post('replay_id', 0); try { return jok($this->service->sendMessage($data, $toUserId, $chatRoomId, $replayId, $messageType)); } catch (\Exception $e) { return jerr($e->getMessage()); } } public function getMessageByChatRoomId() { $chatRoomId = request()->input('chat_room_id'); try { return jok( $this->service->getMessageByChatRoomId($chatRoomId) ); } catch (\Exception $e) { return jerr($e->getMessage()); } } }