From 3d2565113e338792bc405ce21ef17093b031e8b0 Mon Sep 17 00:00:00 2001 From: T2cc <404094862@qq.com> Date: Tue, 12 Oct 2021 02:09:59 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BF=AB=E6=8D=B7=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=BD=93=E5=89=8D=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95=20=E5=9B=A0=E4=B8=BA=E7=BB=8F?= =?UTF-8?q?=E5=B8=B8=E9=9C=80=E8=A6=81=E8=8E=B7=E5=8F=96=20user=5Fid=20?= =?UTF-8?q?=E7=AD=89=E4=BF=A1=E6=81=AF=EF=BC=8C=E4=BD=BF=E7=94=A8=20$this-?= =?UTF-8?q?>auth->getUserInfo=20=E5=A4=AA=E7=B9=81=E7=90=90=E4=BA=86?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/application/common.php b/application/common.php index 2d4eb4d09..4f10029b4 100755 --- a/application/common.php +++ b/application/common.php @@ -481,3 +481,25 @@ if (!function_exists('check_ip_allowed')) { } } } + +if (!function_exists('current_user')){ + /** + * 快捷获取当前用户 + * @return array + */ + function current_user(){ + $auth = \app\common\library\Auth::instance(); + return $auth->getUserinfo(); + } +} + +if (!function_exists('current_user_id')){ + /** + * 快捷获取当前用户 id + * @return mixed + */ + function current_user_id(){ + $auth = \app\common\library\Auth::instance(); + return $auth->getUserinfo()['id']; + } +} -- Gitee