diff --git a/app/Amqp/Consumer/ChatMessageConsumer.php b/app/Amqp/Consumer/ChatMessageConsumer.php index efca7ed..5d623eb 100644 --- a/app/Amqp/Consumer/ChatMessageConsumer.php +++ b/app/Amqp/Consumer/ChatMessageConsumer.php @@ -141,11 +141,14 @@ class ChatMessageConsumer extends ConsumerMessage public function onConsumeTalk(array $data, AMQPMessage $message): string { $source = $data['data']['source']; - $fds = $this->socketClientService->findUserFds($data['data']['sender']); + $fds = []; $groupInfo = null; if ($source == 1) {// 私聊 - $fds = array_merge($fds, $this->socketClientService->findUserFds($data['data']['receive'])); + $fds = array_merge( + $this->socketClientService->findUserFds($data['data']['sender']), + $this->socketClientService->findUserFds($data['data']['receive']) + ); } else if ($source == 2) {// 群聊 $userIds = SocketRoom::getInstance()->getRoomMembers(strval($data['data']['receive'])); foreach ($userIds as $uid) { diff --git a/app/Command/TestCommand.php b/app/Command/TestCommand.php index 57f4a82..97c414d 100644 --- a/app/Command/TestCommand.php +++ b/app/Command/TestCommand.php @@ -19,6 +19,8 @@ use App\Cache\SocketFdBindUser; use App\Cache\SocketRoom; use App\Cache\SocketUserBindFds; use App\Cache\UnreadTalk; +use App\Model\Group\Group; +use App\Model\Group\GroupMember; use App\Service\TalkService; use Hyperf\Command\Command as HyperfCommand; use Hyperf\Command\Annotation\Command; @@ -144,14 +146,14 @@ class TestCommand extends HyperfCommand //SocketFdBindUser::getInstance()->bind(1, 2054); //SocketUserBindFds::getInstance()->bind(1, 2054); - $model1 = SocketUserBindFds::getInstance(); - $model2 = FriendRemark::getInstance(); - - var_dump($model1 === SocketUserBindFds::getInstance()); - var_dump($model2 === FriendRemark::getInstance()); - - var_dump(SocketUserBindFds::getInstance()); - var_dump(FriendRemark::getInstance()); + //$model1 = SocketUserBindFds::getInstance(); + //$model2 = FriendRemark::getInstance(); + // + //var_dump($model1 === SocketUserBindFds::getInstance()); + //var_dump($model2 === FriendRemark::getInstance()); + // + //var_dump(SocketUserBindFds::getInstance()); + //var_dump(FriendRemark::getInstance()); //SocketUserBindFds::getInstance(); //SocketUserBindFds::getInstance(); @@ -169,5 +171,7 @@ class TestCommand extends HyperfCommand //var_dump(SocketUserBindFds::getInstance()); //var_dump(SocketRoom::getInstance()); //var_dump(FriendRemark::getInstance()); + + //var_dump(Group::isManager(2054,116)); } } diff --git a/app/Controller/Api/V1/ArticleController.php b/app/Controller/Api/V1/ArticleController.php index 4c53fc6..f1a4616 100644 --- a/app/Controller/Api/V1/ArticleController.php +++ b/app/Controller/Api/V1/ArticleController.php @@ -147,6 +147,7 @@ class ArticleController extends CController * @RequestMapping(path="del-article-class", methods="post") * * @return ResponseInterface + * @throws \Exception */ public function delArticleClass() { @@ -418,7 +419,7 @@ class ArticleController extends CController $params = $this->request->inputs(['article_id', 'tags']); $this->validate($params, [ 'article_id' => 'required|integer|min:0', - 'tags' => 'required|array' + 'tags' => 'present|array' ]); $isTrue = $this->articleService->updateArticleTag($this->uid(), (int)$params['article_id'], $params['tags']); diff --git a/app/Controller/Api/V1/AuthController.php b/app/Controller/Api/V1/AuthController.php index 77c227e..0660011 100644 --- a/app/Controller/Api/V1/AuthController.php +++ b/app/Controller/Api/V1/AuthController.php @@ -61,8 +61,9 @@ class AuthController extends CController return $this->response->success([ 'authorize' => [ + 'type' => 'Bearer', 'access_token' => $token, - 'expires_in' => $this->guard()->getJwtManager()->getTtl() + 'expires_in' => $this->guard()->getJwtManager()->getTtl(), ], 'user_info' => [ 'nickname' => $userInfo->nickname, @@ -155,11 +156,12 @@ class AuthController extends CController public function refresh() { if ($this->guard()->guest()) { - return $this->response->fail('登录 token 刷新失败!'); + return $this->response->fail('token 刷新失败!'); } return $this->response->success([ 'authorize' => [ + 'type' => 'Bearer', 'token' => $this->guard()->refresh(), 'expire' => $this->guard()->getJwtManager()->getTtl() ] diff --git a/app/Service/ArticleService.php b/app/Service/ArticleService.php index 417676a..bbe3373 100644 --- a/app/Service/ArticleService.php +++ b/app/Service/ArticleService.php @@ -487,7 +487,7 @@ class ArticleService extends BaseService */ public function updateArticleTag(int $uid, int $article_id, array $tags) { - return (bool)Article::where('id', $article_id)->where('user_id', $uid)->update(['tags_id' => implode(',', $tags)]); + return (bool)Article::where('id', $article_id)->where('user_id', $uid)->update(['tags_id' => implode(',', $tags), 'updated_at' => date('Y-m-d H:i:s')]); } /** diff --git a/app/Service/GroupService.php b/app/Service/GroupService.php index 4e529e3..1055980 100644 --- a/app/Service/GroupService.php +++ b/app/Service/GroupService.php @@ -288,6 +288,7 @@ class GroupService extends BaseService */ public function quit(int $user_id, int $group_id) { + // 判断是否属于管理员 if (Group::isManager($user_id, $group_id)) { return [false, 0]; } diff --git a/app/Traits/StaticInstance.php b/app/Traits/StaticInstance.php index 98c2a93..9e136f8 100644 --- a/app/Traits/StaticInstance.php +++ b/app/Traits/StaticInstance.php @@ -24,4 +24,13 @@ trait StaticInstance return static::$instance; } + + public function __construct() + { + } + + public function __clone() + { + + } }