From d6a372771353a56896165cca39730c34f580b2e3 Mon Sep 17 00:00:00 2001 From: ganzizi Date: Wed, 20 Dec 2023 10:34:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?perf:=20=E5=85=BC=E5=AE=B9okr1.1=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/DialogController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php index a707ed924..da325f072 100755 --- a/app/Http/Controllers/Api/DialogController.php +++ b/app/Http/Controllers/Api/DialogController.php @@ -1830,6 +1830,7 @@ class DialogController extends AbstractController * * @apiParam {Number} dialog_id 会话ID * @apiParam {Number} userid 新的群主 + * @apiParam {String} check_owner 转让验证 yes-需要验证 no-不需要验证 * * @apiSuccess {Number} ret 返回状态码(1正确、0错误) * @apiSuccess {String} msg 返回信息(错误描述) @@ -1841,17 +1842,18 @@ class DialogController extends AbstractController // $dialog_id = intval(Request::input('dialog_id')); $userid = intval(Request::input('userid')); + $check_owner = trim(Request::input('check_owner', 'yes')) === 'yes'; // - if ($userid === $user->userid) { + if ($check_owner && $userid === $user->userid) { return Base::retError('你已经是群主'); } if (!User::whereUserid($userid)->exists()) { return Base::retError('请选择有效的新群主'); } // - $dialog = WebSocketDialog::checkDialog($dialog_id, true); + $dialog = WebSocketDialog::checkDialog($dialog_id, $check_owner); // - $dialog->checkGroup('user'); + $dialog->checkGroup($check_owner ? 'user' : null); $dialog->owner_id = $userid; if ($dialog->save()) { $dialog->joinGroup($userid, 0); From e0c3ea4456172d7c1c7e656abac986a06c5a8523 Mon Sep 17 00:00:00 2001 From: ganzizi Date: Wed, 20 Dec 2023 17:54:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?perf:=20=E5=85=BC=E5=AE=B9okr1.1=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/DialogController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php index da325f072..004c8bdd7 100755 --- a/app/Http/Controllers/Api/DialogController.php +++ b/app/Http/Controllers/Api/DialogController.php @@ -1831,6 +1831,7 @@ class DialogController extends AbstractController * @apiParam {Number} dialog_id 会话ID * @apiParam {Number} userid 新的群主 * @apiParam {String} check_owner 转让验证 yes-需要验证 no-不需要验证 + * @apiParam {String} key 密钥(APP_KEY) * * @apiSuccess {Number} ret 返回状态码(1正确、0错误) * @apiSuccess {String} msg 返回信息(错误描述) @@ -1838,13 +1839,15 @@ class DialogController extends AbstractController */ public function group__transfer() { - $user = User::auth(); + if (!Base::is_internal_ip(Base::getIp()) || Request::input("key") !== env('APP_KEY')) { + $user = User::auth(); + } // $dialog_id = intval(Request::input('dialog_id')); $userid = intval(Request::input('userid')); $check_owner = trim(Request::input('check_owner', 'yes')) === 'yes'; // - if ($check_owner && $userid === $user->userid) { + if ($check_owner && $userid === $user?->userid) { return Base::retError('你已经是群主'); } if (!User::whereUserid($userid)->exists()) { @@ -1979,7 +1982,7 @@ class DialogController extends AbstractController */ public function okr__push() { - if (Request::input("key") !== env('APP_KEY')) { + if (!Base::is_internal_ip(Base::getIp()) || Request::input("key") !== env('APP_KEY')) { User::auth(); } $text = trim(Request::input('text'));