Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
751f01ae
authored
Nov 19, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传图片报错
parent
5f9c15ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
app/Api/Controllers/PharmacistController.php
+7
-3
No files found.
app/Api/Controllers/PharmacistController.php
View file @
751f01ae
...
...
@@ -7,6 +7,7 @@
use
App\Models\PharmacyModel
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Support\Facades\Validator
;
class
PharmacistController
extends
BaseApiController
{
...
...
@@ -48,9 +49,13 @@ public function detail(Request $request)
public
function
uploadCertificate
(
Request
$request
)
{
// 验证上传的图片文件
$validat
ed
=
$request
->
validate
(
[
'image'
=>
'required|image|mimes:jpeg,png,jpg
,gif,svg
|max:2048'
,
$validat
or
=
Validator
::
make
(
$request
->
all
(),
[
'image'
=>
'required|image|mimes:jpeg,png,jpg|max:2048'
,
]);
if
(
$validator
->
fails
())
{
return
$this
->
failed
(
'图片必须2Mb以内,且是jpeg,png,jpg三种格式~'
);
}
// 验证药师编号
$authInfo
=
auth
(
'api'
)
->
user
();
// 获取药店信息
...
...
@@ -66,7 +71,6 @@ public function uploadCertificate(Request $request)
$imageUrl
=
Storage
::
url
(
$path
);
return
$this
->
success
([
'image_id'
=>
$path
,
'full_url'
=>
$imageUrl
]);
}
else
{
return
$this
->
failed
(
'请上传图片~'
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment