优化代码

main
gzydong 2021-08-09 22:15:17 +08:00
parent e298f3f950
commit d7950ca32a
3 changed files with 7 additions and 11 deletions

View File

@ -3,13 +3,9 @@ declare(strict_types=1);
namespace App\Service\Message;
use App\Cache\LastMessage;
use App\Cache\UnreadTalkCache;
use App\Constants\TalkEventConstant;
use App\Constants\TalkMessageType;
use App\Constants\TalkModeConstant;
use App\Event\TalkEvent;
use App\Model\Talk\TalkRecords;
use App\Service\SocketClientService;
use App\Service\TalkMessageService;
use App\Support\UserRelation;
@ -44,8 +40,8 @@ class ReceiveHandleService
* 对话文本消息
*
* @param Response|Server $server
* @param Frame $frame
* @param array|string $data 解析后数据
* @param Frame $frame
* @param array|string $data 解析后数据
* @return void
*/
public function onTalk($server, Frame $frame, $data)
@ -77,9 +73,9 @@ class ReceiveHandleService
* 键盘输入消息
*
* @param Response|Server $server
* @param Frame $frame
* @param array|string $data 解析后数据
* @return false
* @param Frame $frame
* @param array|string $data 解析后数据
* @return void
*/
public function onKeyboard($server, Frame $frame, $data)
{

View File

@ -82,7 +82,7 @@ class SocketClientService
* @param string $run_id 服务运行ID默认当前服务ID
* @return array
*/
public function findUserFds(int $user_id, $run_id = SERVER_RUN_ID)
public function findUserFds(int $user_id, $run_id = SERVER_RUN_ID): array
{
return SocketUserBindFds::getInstance()->findFds($user_id, $run_id);
}

View File

@ -20,7 +20,7 @@ trait StaticInstance
*
* @return static
*/
static public function getInstance()
public static function getInstance()
{
if (is_null(static::$instance)) {
static::$instance = new static();