Commit f9ad0752 by 庄欣

2

parent 0b7439b5
...@@ -32,13 +32,15 @@ class ControllerBase ...@@ -32,13 +32,15 @@ class ControllerBase
return $id; return $id;
} }
public function index($query = "") public function index($query = "",$checkUid = true)
{ {
empty($query) && $query = request()->getQueryString(); empty($query) && $query = request()->getQueryString();
try { try {
$client = app("client"); $client = app("client");
$uid = $this->getAuth(); if ($checkUid === true) {
$query .= "&uid=".$uid; $uid = $this->getAuth();
$query .= "&uid=" . $uid;
}
$client->setUrl($this->prefix."?".$query); $client->setUrl($this->prefix."?".$query);
$client->setMethod("get"); $client->setMethod("get");
$res = $client->curl(); $res = $client->curl();
...@@ -82,7 +84,7 @@ class ControllerBase ...@@ -82,7 +84,7 @@ class ControllerBase
} }
} }
public function show($id,$query = "") public function show($id,$query = "",$checkUid = true)
{ {
try { try {
$client = app("client"); $client = app("client");
...@@ -93,7 +95,9 @@ class ControllerBase ...@@ -93,7 +95,9 @@ class ControllerBase
$client->setUrl($url); $client->setUrl($url);
$client->setMethod("get"); $client->setMethod("get");
$res = $client->curl(); $res = $client->curl();
$this->isAllowed($id , $res); if ($checkUid === true) {
$this->isAllowed($id, $res);
}
return Response::success($res); return Response::success($res);
} catch (ApiUnauthorized $e) { } catch (ApiUnauthorized $e) {
return Response::error($e->getMessage(), HttpStatus::HttpUnauthorized); return Response::error($e->getMessage(), HttpStatus::HttpUnauthorized);
......
...@@ -15,14 +15,20 @@ use App\Providers\RouteServiceProvider as Provider; ...@@ -15,14 +15,20 @@ use App\Providers\RouteServiceProvider as Provider;
Route::group(["prefix" => "file", 'namespace' => Provider::getNamespace("file")],function(){ Route::group(["prefix" => "file", 'namespace' => Provider::getNamespace("file")],function(){
//上传图片
Route::post("/{uid}/{type}","File@upload"); Route::post("/{uid}/{type}","File@upload");
//编辑器上传
Route::post("/editor/{uid}/{action}","File@editorUpload"); Route::post("/editor/{uid}/{action}","File@editorUpload");
}); });
Route::group(["prefix" => "user", 'namespace' => Provider::getNamespace("member")],function(){ Route::group(["prefix" => "user", 'namespace' => Provider::getNamespace("member")],function(){
//获取登录二维码图片
Route::get("/code/{code?}","User@getLoginImg"); Route::get("/code/{code?}","User@getLoginImg");
//获取登录某个二维码状态
Route::get("/status/{code}","User@getLoginStatus"); Route::get("/status/{code}","User@getLoginStatus");
//申请成为摄影师
Route::post("/apply","User@Apply"); Route::post("/apply","User@Apply");
//获取用户微信openid
Route::get("/openid/{platform?}","User@getOAuth"); Route::get("/openid/{platform?}","User@getOAuth");
}); });
...@@ -59,4 +65,11 @@ Route::group(["prefix" => "works", 'namespace' => Provider::getNamespace("works" ...@@ -59,4 +65,11 @@ Route::group(["prefix" => "works", 'namespace' => Provider::getNamespace("works"
Route::put ("/{id}/hidden" , "Works@hidden")->where(['id' => '\d+']); Route::put ("/{id}/hidden" , "Works@hidden")->where(['id' => '\d+']);
//显示 //显示
Route::put ("/{id}/show" , "Works@display")->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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment