Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
7f923275
Commit
7f923275
authored
Aug 14, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片上传
parent
2ce7c152
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
UploadImg.php
application/api/controller/UploadImg.php
+39
-0
route.php
application/route.php
+1
-0
No files found.
application/api/controller/UploadImg.php
0 → 100644
View file @
7f923275
<?php
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\api_broker\service\UploadFileService
;
use
think\Request
;
class
UploadImg
extends
Basic
{
private
$uFService
;
public
function
__construct
(
Request
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
uFService
=
new
UploadFileService
();
}
/**
* 图片上传
* @return \think\Response
*/
public
function
uploadImg
()
{
header
(
'Access-Control-Allow-Origin:*'
);
set_time_limit
(
0
);
$file
=
$_FILES
[
'image'
];
$type
=
request
()
->
param
(
'type'
);
$uploadResult
=
$this
->
uFService
->
upload
(
$file
,
$type
);
if
(
$uploadResult
[
"code"
]
==
200
)
{
return
$this
->
response
(
"200"
,
"图片上传成功"
,
$uploadResult
[
"msg"
]);
}
else
{
return
$this
->
response
(
"101"
,
$uploadResult
[
"msg"
]);
}
}
}
\ No newline at end of file
application/route.php
View file @
7f923275
...
...
@@ -677,6 +677,7 @@ Route::group('api', [
'getFindShop'
=>
[
'api/FindShop/getFindShopByParams'
,
[
'method'
=>
'get|post'
]],
'getRecommendShopList'
=>
[
'api/FindShop/getRecommendShopList'
,
[
'method'
=>
'get|post'
]],
'uploadImg'
=>
[
'api/UploadImg/uploadImg'
,
[
'method'
=>
'POST|GET'
]],
//图片上传
]);
...
...
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