初始化

main
gzydong 2020-12-12 23:36:20 +08:00
parent 7112a470b6
commit bbf222b03a
4 changed files with 6 additions and 4 deletions

View File

@ -18,7 +18,6 @@ use Hyperf\HttpServer\Contract\ResponseInterface;
* Class DownloadController * Class DownloadController
* *
* @Controller(path="/api/v1/download") * @Controller(path="/api/v1/download")
* @Middleware(JWTAuthMiddleware::class)
* *
* @package App\Controller\Api\V1 * @package App\Controller\Api\V1
*/ */

View File

@ -155,7 +155,10 @@ class EmoticonController extends CController
} }
// 读取图片信息 // 读取图片信息
$imgInfo = getimagesize($file->getPath()); $imgInfo = @getimagesize($file->getRealPath());
if(!$imgInfo){
return $this->response->fail('表情包上传失败...');
}
$save_path = $uploadService->media($file, 'media/images/emoticon', create_image_name($ext, $imgInfo[0], $imgInfo[1])); $save_path = $uploadService->media($file, 'media/images/emoticon', create_image_name($ext, $imgInfo[0], $imgInfo[1]));
if (!$save_path) { if (!$save_path) {

View File

@ -49,6 +49,6 @@ class UploadService extends BaseService
@chmod(sprintf('%s/%s', $save_dir, $filename), 0644); @chmod(sprintf('%s/%s', $save_dir, $filename), 0644);
} }
return $file->isMoved() ? sprintf('/%s/%s', trim($dir, '/'), $filename) : false; return $file->isMoved() ? sprintf('%s/%s', trim($dir, '/'), $filename) : false;
} }
} }

View File

@ -169,7 +169,7 @@ function diff_date($day1, $day2)
*/ */
function get_media_url(string $path) function get_media_url(string $path)
{ {
return config('domain.img_url') . $path; return sprintf('%s/%s', rtrim(config('domain.img_url'), '/'), ltrim($path,'/'));
} }
/** /**