<?php

namespace App\Http\Controllers\H5;

use App\Facades\UploadService;
use App\Http\Controllers\Controller;
use App\Http\Response\ResponseJson;
use Illuminate\Http\Request;

class UploadController extends Controller
{
    use ResponseJson;

    public function uploadImage(Request $request)
    {
        $file = $request->file();
        if (empty($file)) return $this->failure("请先选择图片");
        $url = UploadService::upload($file['fileData']);
        if (empty($url)) return $this->failure();
        return $this->success('ok', $url);
    }
}
