|
@@ -1,25 +1,14 @@
|
|
|
<?php
|
|
|
|
|
|
-// +----------------------------------------------------------------------
|
|
|
-// | ThinkAdmin
|
|
|
-// +----------------------------------------------------------------------
|
|
|
-// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
|
|
-// +----------------------------------------------------------------------
|
|
|
-// | 官方网站: http://demo.thinkadmin.top
|
|
|
-// +----------------------------------------------------------------------
|
|
|
-// | 开源协议 ( https://mit-license.org )
|
|
|
-// +----------------------------------------------------------------------
|
|
|
-// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
|
|
-// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
|
|
-// +----------------------------------------------------------------------
|
|
|
-
|
|
|
namespace app\api\controller;
|
|
|
-use library\File;
|
|
|
|
|
|
+use library\File;
|
|
|
use hg\apidoc\annotation as Apidoc;
|
|
|
+
|
|
|
/**
|
|
|
* @Apidoc\Title("上传文件")
|
|
|
* @Apidoc\Group("api")
|
|
|
+ * @Apidoc\Sort("3")
|
|
|
*/
|
|
|
class Upload extends Base
|
|
|
{
|
|
@@ -35,9 +24,6 @@ class Upload extends Base
|
|
|
/**
|
|
|
* @Apidoc\Title("上传文件接口(上传到本地(导入模板需要))")
|
|
|
* @Apidoc\Desc("获取配置")
|
|
|
- * @Apidoc\Method("GET")
|
|
|
- * @Apidoc\Author("HG")
|
|
|
- * @Apidoc\Tag("")
|
|
|
* @Apidoc\Query("file", type="string",require=true, desc="表达提交的文件信息")
|
|
|
* @Apidoc\Returned("url", type="string", desc="上传后的文件路径")
|
|
|
*/
|
|
@@ -64,6 +50,7 @@ class Upload extends Base
|
|
|
$this->error('文件处理失败,请稍候再试!');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private function getUploadFile()
|
|
|
{
|
|
|
try {
|
|
@@ -72,6 +59,7 @@ class Upload extends Base
|
|
|
$this->error(lang($e->getMessage()));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private function getUploadType()
|
|
|
{
|
|
|
$this->uptype = input('uptype');
|
|
@@ -80,13 +68,11 @@ class Upload extends Base
|
|
|
}
|
|
|
return $this->uptype;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* @Apidoc\Title("获取OSS配置(用于上传文件到OSS使用)")
|
|
|
* @Apidoc\Desc("获取配置")
|
|
|
- * @Apidoc\Method("GET")
|
|
|
- * @Apidoc\Author("HG")
|
|
|
- * @Apidoc\Tag("")
|
|
|
- * @Apidoc\Query("type", type="string",require=true, desc="文件要保存的目录名称(需前端创建好)")
|
|
|
+ * @Apidoc\Param("type", type="string",require=true, desc="文件要保存的目录名称(需前端创建好)")
|
|
|
* @Apidoc\Returned("OSSAccessKeyId", type="string", desc="keyId")
|
|
|
* @Apidoc\Returned("policy", type="string", desc="规则")
|
|
|
* @Apidoc\Returned("Signature", type="string", desc="签名")
|
|
@@ -128,6 +114,7 @@ class Upload extends Base
|
|
|
$response['key'] = $path;
|
|
|
return $response;
|
|
|
}
|
|
|
+
|
|
|
protected function _gmt_iso8601($time) {
|
|
|
$dtStr = date("c", $time);
|
|
|
$mydatetime = new \DateTime($dtStr);
|