Karson 1 سال پیش
والد
کامیت
0a5484b738

+ 1 - 1
application/admin/common.php

@@ -121,7 +121,7 @@ if (!function_exists('build_toolbar')) {
         $html = [];
         foreach ($btns as $k => $v) {
             //如果未定义或没有权限
-            if (!isset($btnAttr[$v]) || ($v !== 'refresh' && !$auth->check("{$controller}/{$v}"))) {
+            if (!isset($btnAttr[$v]) || ($v !== 'refresh' && !$auth->check("{$controller}/{$v}", $auth->id))) {
                 continue;
             }
             list($href, $class, $icon, $text, $title) = $btnAttr[$v];

+ 1 - 1
application/admin/library/traits/Backend.php

@@ -391,7 +391,7 @@ trait Backend
         }
 
         //导入文件首行类型,默认是注释,如果需要使用字段名称请使用name
-        $importHeadType = $this->importHeadType ?? 'comment';
+        $importHeadType = isset($this->importHeadType) ? $this->importHeadType : 'comment';
 
         $table = $this->model->getQuery()->getTable();
         $database = \think\Config::get('database.database');

+ 1 - 1
application/admin/model/UserGroup.php

@@ -28,7 +28,7 @@ class UserGroup extends Model
     {
         $value = $value ? $value : $data['status'];
         $list = $this->getStatusList();
-        return isset($list[$value]) ? $list[$value] : '';
+        return $list[$value] ?? '';
     }
 
 }

+ 1 - 1
application/admin/model/UserRule.php

@@ -42,7 +42,7 @@ class UserRule extends Model
     {
         $value = $value ? $value : $data['status'];
         $list = $this->getStatusList();
-        return isset($list[$value]) ? $list[$value] : '';
+        return $list[$value] ?? '';
     }
 
     public static function getTreeList($selected = [])

+ 2 - 2
application/common/library/Ems.php

@@ -28,7 +28,7 @@ class Ems
      *
      * @param int    $email 邮箱
      * @param string $event 事件
-     * @return  Ems
+     * @return  Ems|null
      */
     public static function get($email, $event = 'default')
     {
@@ -36,7 +36,7 @@ class Ems
             ->order('id', 'DESC')
             ->find();
         Hook::listen('ems_get', $ems, null, true);
-        return $ems ? $ems : null;
+        return $ems ?: null;
     }
 
     /**

+ 1 - 1
application/common/library/Sms.php

@@ -36,7 +36,7 @@ class Sms
             ->order('id', 'DESC')
             ->find();
         Hook::listen('sms_get', $sms, null, true);
-        return $sms ? $sms : null;
+        return $sms ?: null;
     }
 
     /**

+ 1 - 1
application/common/library/Token.php

@@ -150,7 +150,7 @@ class Token
     /**
      * 清除Token
      * @access public
-     * @param int user_id 会员ID
+     * @param int $user_id 会员ID
      * @return boolean
      */
     public static function clear($user_id = null)

+ 1 - 1
application/common/library/Upload.php

@@ -147,7 +147,7 @@ class Upload
         $size = $matches ? $matches[1] : $this->config['maxsize'];
         $type = $matches ? strtolower($matches[2]) : 'b';
         $typeDict = ['b' => 0, 'k' => 1, 'kb' => 1, 'm' => 2, 'mb' => 2, 'gb' => 3, 'g' => 3];
-        $size = $size * pow(1024, $typeDict[$type] ?? 0);
+        $size = (int)($size * pow(1024, $typeDict[$type] ?? 0));
         if ($this->fileInfo['size'] > $size) {
             throw new UploadException(__(
                 'File is too big (%sMiB), Max filesize: %sMiB.',