diff --git a/application/common.php b/application/common.php index 2d4eb4d09feaffaa661a948a16ab63087c107826..4f10029b4dad1daffa1c24f42e482ba24af3d827 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']; + } +}