Browse Source

!337 解决api模块上传文件获取不到uid的问题
Merge pull request !337 from Henry/repair

Karson 3 years ago
parent
commit
5599170ce4
1 changed files with 2 additions and 1 deletions
  1. 2 1
      application/common/library/Upload.php

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

@@ -354,9 +354,10 @@ class Upload
         $this->file = $file;
         $category = request()->post('category');
         $category = array_key_exists($category, config('site.attachmentcategory') ?? []) ? $category : '';
+        $auth = Auth::instance();
         $params = array(
             'admin_id'    => (int)session('admin.id'),
-            'user_id'     => (int)cookie('uid'),
+            'user_id'     => (int)$auth->id,
             'filename'    => substr(htmlspecialchars(strip_tags($this->fileInfo['name'])), 0, 100),
             'category'    => $category,
             'filesize'    => $this->fileInfo['size'],