From 50d6789312264abf92e49eaf9e758c5d4d25ec74 Mon Sep 17 00:00:00 2001 From: gzydong Date: Tue, 8 Dec 2020 23:32:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/Api/V1/GroupController.php | 6 +++++- app/Service/GroupService.php | 2 +- bin/hyperf.php | 1 - config/autoload/amqp.php | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Controller/Api/V1/GroupController.php b/app/Controller/Api/V1/GroupController.php index 94c4eb4..a147a39 100644 --- a/app/Controller/Api/V1/GroupController.php +++ b/app/Controller/Api/V1/GroupController.php @@ -204,7 +204,7 @@ class GroupController extends CController 'group_id' => 'required|integer', 'group_name' => 'required', 'group_profile' => 'required', - 'avatar' => 'required' + 'avatar' => 'present|url' ]); $result = UsersGroup::where('id', $params['group_id'])->where('user_id', $this->uid())->update([ @@ -235,6 +235,10 @@ class GroupController extends CController ]); $user_id = $this->uid(); + if (in_array($user_id, $params['members_ids'])) { + return $this->response->fail('群聊用户移除失败...'); + } + [$isTrue, $record_id] = $this->groupService->removeMember($params['group_id'], $user_id, $params['members_ids']); if (!$isTrue) { return $this->response->fail('群聊用户移除失败...'); diff --git a/app/Service/GroupService.php b/app/Service/GroupService.php index 1529f05..8f6914a 100644 --- a/app/Service/GroupService.php +++ b/app/Service/GroupService.php @@ -50,7 +50,7 @@ class GroupService extends BaseService $groupMember[] = [ 'group_id' => $insRes->id, 'user_id' => $uid, - 'group_owner' => ($k == 0) ? 1 : 0, + 'group_owner' => $user_id == $uid ? 1 : 0, 'status' => 0, 'created_at' => date('Y-m-d H:i:s'), ]; diff --git a/bin/hyperf.php b/bin/hyperf.php index 3c7e34f..bb438e8 100644 --- a/bin/hyperf.php +++ b/bin/hyperf.php @@ -10,7 +10,6 @@ date_default_timezone_set('Asia/Shanghai'); ! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1)); ! defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', SWOOLE_HOOK_ALL); -define('SWOOLE_SSL', 512); require BASE_PATH . '/vendor/autoload.php'; // 设置服务运行ID diff --git a/config/autoload/amqp.php b/config/autoload/amqp.php index 6c5e81a..9ccfbf7 100644 --- a/config/autoload/amqp.php +++ b/config/autoload/amqp.php @@ -29,7 +29,7 @@ return [ 'login_response' => null, 'locale' => 'en_US', 'connection_timeout' => 3.0, - 'read_write_timeout' => 6.0, + 'read_write_timeout' => 8.0, 'context' => null, 'keepalive' => false, 'heartbeat' => 3,