Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminApi4Tpl
Overview
Overview
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminApi4Tpl
Commits
f9ad0752
Commit
f9ad0752
authored
Sep 23, 2016
by
庄欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2
parent
0b7439b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
+23
-5
app/Http/Controllers/ControllerBase.php
+9
-5
routes/api.php
+14
-0
No files found.
app/Http/Controllers/ControllerBase.php
View file @
f9ad0752
...
...
@@ -32,13 +32,15 @@ class ControllerBase
return
$id
;
}
public
function
index
(
$query
=
""
)
public
function
index
(
$query
=
""
,
$checkUid
=
true
)
{
empty
(
$query
)
&&
$query
=
request
()
->
getQueryString
();
try
{
$client
=
app
(
"client"
);
$uid
=
$this
->
getAuth
();
$query
.=
"&uid="
.
$uid
;
if
(
$checkUid
===
true
)
{
$uid
=
$this
->
getAuth
();
$query
.=
"&uid="
.
$uid
;
}
$client
->
setUrl
(
$this
->
prefix
.
"?"
.
$query
);
$client
->
setMethod
(
"get"
);
$res
=
$client
->
curl
();
...
...
@@ -82,7 +84,7 @@ class ControllerBase
}
}
public
function
show
(
$id
,
$query
=
""
)
public
function
show
(
$id
,
$query
=
""
,
$checkUid
=
true
)
{
try
{
$client
=
app
(
"client"
);
...
...
@@ -93,7 +95,9 @@ class ControllerBase
$client
->
setUrl
(
$url
);
$client
->
setMethod
(
"get"
);
$res
=
$client
->
curl
();
$this
->
isAllowed
(
$id
,
$res
);
if
(
$checkUid
===
true
)
{
$this
->
isAllowed
(
$id
,
$res
);
}
return
Response
::
success
(
$res
);
}
catch
(
ApiUnauthorized
$e
)
{
return
Response
::
error
(
$e
->
getMessage
(),
HttpStatus
::
HttpUnauthorized
);
...
...
routes/api.php
View file @
f9ad0752
...
...
@@ -15,14 +15,20 @@ use App\Providers\RouteServiceProvider as Provider;
Route
::
group
([
"prefix"
=>
"file"
,
'namespace'
=>
Provider
::
getNamespace
(
"file"
)],
function
(){
//上传图片
Route
::
post
(
"/
{
uid}/{type
}
"
,
"File@upload"
);
//编辑器上传
Route
::
post
(
"/editor/
{
uid}/{action
}
"
,
"File@editorUpload"
);
});
Route
::
group
([
"prefix"
=>
"user"
,
'namespace'
=>
Provider
::
getNamespace
(
"member"
)],
function
(){
//获取登录二维码图片
Route
::
get
(
"/code/
{
code?
}
"
,
"User@getLoginImg"
);
//获取登录某个二维码状态
Route
::
get
(
"/status/
{
code
}
"
,
"User@getLoginStatus"
);
//申请成为摄影师
Route
::
post
(
"/apply"
,
"User@Apply"
);
//获取用户微信openid
Route
::
get
(
"/openid/
{
platform?
}
"
,
"User@getOAuth"
);
});
...
...
@@ -59,4 +65,11 @@ Route::group(["prefix" => "works", 'namespace' => Provider::getNamespace("works"
Route
::
put
(
"/
{
id
}
/hidden"
,
"Works@hidden"
)
->
where
([
'id'
=>
'\d+'
]);
//显示
Route
::
put
(
"/
{
id
}
/show"
,
"Works@display"
)
->
where
([
'id'
=>
'\d+'
]);
});
Route
::
group
([
"prefix"
=>
"keywords"
,
'namespace'
=>
Provider
::
getNamespace
(
"keywords"
)],
function
(){
//全部关键词
Route
::
get
(
"/"
,
"Keywords@index"
);
//热门关键词
Route
::
get
(
"/hot"
,
"Keywords@gethot"
);
});
\ No newline at end of file
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