Commit 5bdeab44 by 庄欣

旅拍城市

parent f66eb343
......@@ -4,13 +4,14 @@ namespace App\City\Controller;
use Illuminate\Routing\Controller;
use App\City\Model\City as CityModel;
use App\City\Model\Travel as TravelModel;
use App\Http\Response\Response;
class City extends Controller
{
use \App\Traits\Controller;
protected $query_fields = [
"is_open","is_hot","previous","name"
"is_open","is_hot","previous","name","abroad"
];
public function index()
......@@ -42,4 +43,13 @@ class City extends Controller
return Response::error(HttpStatus::HttpNotFound,"城市未找到");
}
}
public function travel()
{
$query = request()->query();
$where = $this->filter($query);
$model = $this->setBlurSearch(TravelModel::class,$where,"name");
return Response::success($model->get()->toArray());
}
}
......@@ -53,7 +53,7 @@ class Sets extends \Illuminate\Routing\Controller
$info->getRelate(request("relation"));
return Response::success($info->toArray());
} catch (ModelNotFoundException $e){
return Response::error(HttpStatus::HttpNotFound,"套系未找到");
return Response::error("套系未找到",HttpStatus::HttpNotFound);
}
}
......@@ -70,7 +70,7 @@ class Sets extends \Illuminate\Routing\Controller
$model->getRelate($relation);
return Response::success($model);
} catch (ModelNotFoundException $e){
return Response::error(HttpStatus::HttpNotFound,"套系未找到");
return Response::error("套系未找到",HttpStatus::HttpNotFound);
}
}
......@@ -120,7 +120,7 @@ class Sets extends \Illuminate\Routing\Controller
return Response::error();
}
} catch (ModelNotFoundException $e) {
return Response::error(HttpStatus::HttpNotFound,"样片未找到");
return Response::error("样片未找到",HttpStatus::HttpNotFound);
}
}
......@@ -136,7 +136,7 @@ class Sets extends \Illuminate\Routing\Controller
return Response::error();
}
} catch (ModelNotFoundException $e) {
return Response::error(HttpStatus::HttpNotFound,"样片未找到");
return Response::error("样片未找到",HttpStatus::HttpNotFound);
}
}
......
......@@ -7,7 +7,8 @@
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"upyun/sdk": "^2.2"
"upyun/sdk": "^2.2",
"predis/predis": "^1.1"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
......
......@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "6a5a209b6dd87ec29f26c81c6ff0d9b9",
"content-hash": "910e8b780417a3cc1155358a28afe10b",
"hash": "568cf3c1cf1a31924b9ec39ff38964e6",
"content-hash": "744ff33e503dbd8f37c11c3988ce32ec",
"packages": [
{
"name": "classpreloader/classpreloader",
......@@ -785,6 +785,56 @@
"time": "2016-04-03 06:00:07"
},
{
"name": "predis/predis",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/nrk/predis.git",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/nrk/predis/f0210e38881631afeafb56ab43405a92cafd9fd1.zip",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"suggest": {
"ext-curl": "Allows access to Webdis when paired with phpiredis",
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
},
"type": "library",
"autoload": {
"psr-4": {
"Predis\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniele Alessandri",
"email": "suppakilla@gmail.com",
"homepage": "http://clorophilla.net"
}
],
"description": "Flexible and feature-complete Redis client for PHP and HHVM",
"homepage": "http://github.com/nrk/predis",
"keywords": [
"nosql",
"predis",
"redis"
],
"time": "2016-06-16 16:22:20"
},
{
"name": "psr/log",
"version": "1.0.0",
"source": {
......
......@@ -33,6 +33,12 @@ require __DIR__.'/../bootstrap/autoload.php';
|
*/
header('Access-Control-Allow-Origin:*' );
header('Access-Control-Allow-Methods:POST,GET,PUT,DELETE');
header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept');
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
......
......@@ -101,8 +101,9 @@ Route::group(["prefix" => "photo", 'namespace' => Provider::getNamespace("photo"
//城市
Route::group(["prefix" => "city", 'namespace' => Provider::getNamespace("city")],function(){
Route::get("/" , "City@index");
Route::get("/travel" , "City@travel");
Route::get("/{id}/parent","City@parent");
Route::get("/{id}" , "City@show");
Route::get("/{id}" , "City@show")->where(['id'=>'\d+']);
});
//关键词
......
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