wupengfei 2 years ago
parent
commit
3de1c9839c
2 changed files with 30 additions and 1 deletions
  1. 1 1
      .idea/workspace.xml
  2. 29 0
      application/api/controller/Upload.php

+ 1 - 1
.idea/workspace.xml

@@ -3,7 +3,7 @@
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/nutrition/view/one_datum/form.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/nutrition/view/one_datum/form.html" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Upload.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Upload.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />

+ 29 - 0
application/api/controller/Upload.php

@@ -71,6 +71,35 @@ class Upload extends Base
             $this->error('文件处理失败,请稍候再试!');
         }
     }
+
+    /**
+     * @title 文件上传
+     * @desc 个人信息
+     * @author qc
+     * @url /api/upload/upload
+     * @method GET||POST
+     * @tag
+     * @param name:file require:1 desc:文件名
+     *
+     */
+    public function pdfUpload()
+    {
+        if (!($file = $this->getUploadFile()) || empty($file)) {
+            $this->error('文件上传异常,文件可能过大或未上传!');
+        }
+        if (!$file->checkExt(strtolower(sysconf('storage_local_exts')))) {
+            $this->error('文件上传类型受限,请在后台配置!');
+        }
+        if ($file->checkExt('php,sh')) {
+            $this->error('可执行文件禁止上传到本地服务器!');
+        }
+        $res = requestPost('http://101.132.128.55:9999/v1/pdf/upload',$file);
+        var_dump($res);
+
+
+    }
+
+
     /**
      * 获取本地文件对象
      * @return \think\File