|
|
@@ -29,6 +29,27 @@ class Upload extends AuthController{
|
|
|
if (empty($file)) {
|
|
|
return app('json')->fail("未上传文件");
|
|
|
}
|
|
|
+ $code = $request->post("code","");
|
|
|
+ //上传到本地
|
|
|
+ if($code=="invite"){
|
|
|
+ $size = $file->getSize();
|
|
|
+ if(!empty($size) && $size>2*1024*1024){
|
|
|
+ return app('json')->fail("图片不能超过{$uploadConfig["image"]["size"]}M");
|
|
|
+ }
|
|
|
+
|
|
|
+ $ext = $file->extension();
|
|
|
+ if(!in_array($ext, ["jpg","jpeg","png"])){
|
|
|
+ return app('json')->fail("图片类型错误");
|
|
|
+ }
|
|
|
+ $upPath = \think\facade\Filesystem::disk('resource')->putFile( $code, $file);
|
|
|
+ if(!$upPath){
|
|
|
+ return app('json')->fail("图片上传失败01");
|
|
|
+ }
|
|
|
+ $savePath = $sysData['system_url'].'/resource/' . $upPath;
|
|
|
+ $imgUrl = str_replace("\\", "/", $savePath);
|
|
|
+ return app('json')->success(['img'=>$imgUrl]);
|
|
|
+ }
|
|
|
+
|
|
|
$rootTmp = config('filesystem.disks.local.root') . '/' . \think\facade\Filesystem::putFile('tmp', $file);
|
|
|
$image_size = @getimagesize($rootTmp);
|
|
|
if ($image_size[0] > 1000) {
|