新增上传文件接口
This commit is contained in:
parent
c80f147744
commit
d90fd9bcaa
@ -273,6 +273,24 @@ class Common extends BaseController
|
||||
return app('json')->success(['src' => tidy_url($upload->getFileInfo()->filePath)]);
|
||||
}
|
||||
|
||||
public function uploadFile()
|
||||
{
|
||||
$file = $this->request->file('file');
|
||||
if (!$file)
|
||||
return app('json')->fail('请上传文件');
|
||||
validate(["file|文件" => [
|
||||
'fileSize' => config('upload.filesize'),
|
||||
'fileExt' => 'apk,ipa,doc,pdf,txt',
|
||||
'fileMime' => '',
|
||||
]])->check(['file' => $file]);
|
||||
$upload = UploadService::create();
|
||||
$data = $upload->to('media')->validate([])->move('file');
|
||||
if ($data === false) {
|
||||
return app('json')->fail($upload->getError());
|
||||
}
|
||||
return app('json')->success(['src' => tidy_url($upload->getFileInfo()->filePath)]);
|
||||
}
|
||||
|
||||
public function config()
|
||||
{
|
||||
$data = systemConfig(['tx_map_key','delivery_status','delivery_type']);
|
||||
|
@ -552,7 +552,7 @@ Route::group('api/', function () {
|
||||
})->prefix('api.article.');
|
||||
|
||||
Route::post('upload/video', 'merchant.Common/uploadVideo');
|
||||
Route::post('upload/file', 'merchant.Common/uploadVideo');
|
||||
Route::post('upload/file', 'merchant.Common/uploadFile');
|
||||
Route::get('excel/download/:id', 'merchant.store.order.Order/download');
|
||||
//申请商户
|
||||
Route::post('intention/create', 'api.store.merchant.MerchantIntention/create');
|
||||
|
Loading…
x
Reference in New Issue
Block a user