Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
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
庄欣
UserAdminV2
Commits
92da4001
Commit
92da4001
authored
Sep 21, 2016
by
庄欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成90%
parent
a084214a
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
79 additions
and
23 deletions
+79
-23
app/Article/v1/Controller/Article.php
+2
-2
app/City/Controller/City.php
+2
-6
app/Http/Kernel.php
+1
-0
app/Http/Middleware/ParseNull.php
+20
-0
app/Kw/Controller/Keywords.php
+26
-0
app/Photo/v1/Controller/Photo.php
+0
-1
app/Sets/v1/Controller/Sets.php
+2
-2
app/Traits/Controller.php
+24
-10
app/Works/v1/Controller/Works.php
+2
-2
No files found.
app/Article/v1/Controller/Article.php
View file @
92da4001
...
...
@@ -31,10 +31,10 @@ class Article extends \Illuminate\Routing\Controller
{
$query
=
request
()
->
query
();
$where
=
$this
->
filter
(
$query
);
$
where
=
$this
->
setBlurSearch
(
$where
,
"title"
);
$
model
=
$this
->
setBlurSearch
(
ArtModel
::
class
,
$where
,
"title"
);
is_null
(
$where
)
&&
$where
=
[];
$row
=
isset
(
$query
[
"size"
])
?
$query
[
"size"
]
:
config
(
"app.default_perpage"
);
return
Response
::
success
(
ArtModel
::
where
(
$where
)
->
paginate
(
$row
)
->
toArray
());
return
Response
::
success
(
$model
->
paginate
(
$row
)
->
toArray
());
}
public
function
store
(
Request
$request
)
...
...
app/City/Controller/City.php
View file @
92da4001
...
...
@@ -17,11 +17,7 @@ class City extends Controller
{
$query
=
request
()
->
query
();
$where
=
$this
->
filter
(
$query
);
$model
=
CityModel
::
where
(
$where
);
if
(
isset
(
$where
[
'city_name'
]))
{
$model
->
where
(
$where
,
"like"
,
$where
[
'city_name'
]
.
"%"
);
}
$res
=
$model
->
get
();
return
Response
::
success
(
$res
->
toArray
());
$model
=
$this
->
setBlurSearch
(
CityModel
::
class
,
$where
,
"city_name"
);
return
Response
::
success
(
$model
->
get
()
->
toArray
());
}
}
app/Http/Kernel.php
View file @
92da4001
...
...
@@ -15,6 +15,7 @@ class Kernel extends HttpKernel
*/
protected
$middleware
=
[
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode
::
class
,
\App\Http\Middleware\ParseNull
::
class
];
/**
...
...
app/Http/Middleware/ParseNull.php
0 → 100644
View file @
92da4001
<?php
/**
* Created by PhpStorm.
* User: zhuangxin
* Date: 16-9-21
* Time: 上午10:34
*/
namespace
App\Http\Middleware
;
use
Closure
;
class
ParseNull
{
public
function
handle
(
$request
,
Closure
$next
)
{
$response
=
$next
(
$request
);
return
$response
;
}
}
\ No newline at end of file
app/Kw/Controller/Keywords.php
0 → 100755
View file @
92da4001
<?php
namespace
App\Kw\Controller
;
use
App\Http\Response\Response
;
class
Keywords
extends
\Illuminate\Routing\Controller
{
public
function
index
()
{
}
public
function
info
(
$id
)
{
}
public
function
child
(
$id
)
{
}
}
app/Photo/v1/Controller/Photo.php
View file @
92da4001
...
...
@@ -39,7 +39,6 @@ class Photo extends \Illuminate\Routing\Controller
* cover string required
* extra_truing_price float required
* count int required
*
*/
public
function
store
(
Request
$request
)
{
...
...
app/Sets/v1/Controller/Sets.php
View file @
92da4001
...
...
@@ -34,10 +34,10 @@ class Sets extends \Illuminate\Routing\Controller
{
$query
=
request
()
->
query
();
$where
=
$this
->
filter
(
$query
);
$
where
=
$this
->
setBlurSearch
(
$where
,
"title"
);
$
model
=
$this
->
setBlurSearch
(
SetsModel
::
class
,
$where
,
"title"
);
is_null
(
$where
)
&&
$where
=
[];
$row
=
isset
(
$query
[
"size"
])
?
$query
[
"size"
]
:
config
(
"app.default_perpage"
);
return
Response
::
success
(
SetsModel
::
where
(
$where
)
->
paginate
(
$row
)
->
toArray
());
return
Response
::
success
(
$model
->
paginate
(
$row
)
->
toArray
());
}
/**
...
...
app/Traits/Controller.php
View file @
92da4001
...
...
@@ -29,32 +29,46 @@ trait Controller
return
$where
;
}
public
function
setBlurSearch
(
$
where
,
$key
,
$condition
=
"eq
"
)
public
function
setBlurSearch
(
$
model
,
$where
,
$key
,
$condition
=
"like
"
)
{
if
(
is_null
(
$where
))
{
return
nul
l
;
return
$mode
l
;
}
if
(
!
in_array
(
$key
,
array_keys
(
$where
)))
{
return
$
where
;
return
$
model
::
where
(
$where
)
;
}
$where
[
$key
]
=
trim
(
$where
[
$key
]);
$result_model
=
null
;
switch
(
$condition
)
{
case
"
eq
"
:
$
where
[
"_condition"
]
=
[
$key
,
"like"
,
"'%.
$where[$key].%'"]
;
case
"
like
"
:
$
result_model
=
$model
::
where
(
$key
,
"like"
,
"%"
.
$where
[
$key
]
.
"%"
)
;
break
;
case
"elt"
:
$
where["_condition"]
= [
$key
,"
<=
","
'$where[$key]'
"]
;
$
result_model
=
$model
::
where
(
$key
,
"<="
,
"'
$where[$key]
'"
)
;
break
;
case
"lt"
:
$
where["_condition"]
= [
$key
,"
<
","
'$where[$key]'
"]
;
$
result_model
=
$model
::
where
(
$key
,
"<="
,
"'
$where[$key]
'"
)
;
break
;
case
"gt"
:
$
where["_condition"]
= [
$key
,"
<
","
'$where[$key]'
"]
;
$
result_model
=
$model
::
where
(
$key
,
">"
,
"'
$where[$key]
'"
)
;
break
;
case
"egt"
:
$where["_condition"]
= [
$key
,"
>=
","
'$where[$key]'
"];
$result_model
=
$model
::
where
(
$key
,
">="
,
"'
$where[$key]
'"
);
break
;
case
"eq"
:
$result_model
=
$model
::
where
(
$where
);
break
;
case
"in"
:
$result_model
=
$model
::
whereIn
(
$key
,
"in"
,
$where
[
$key
]);
break
;
}
return
$where
;
unset
(
$where
[
$key
]);
try
{
$result_model
=
$result_model
->
where
(
$where
);
}
catch
(
\Exception
$e
)
{
}
return
$result_model
;
}
public
function
csrf
(
$data
,
$key
)
{
...
...
app/Works/v1/Controller/Works.php
View file @
92da4001
...
...
@@ -35,10 +35,10 @@ class Works extends \Illuminate\Routing\Controller
{
$query
=
request
()
->
query
();
$where
=
$this
->
filter
(
$query
);
$
where
=
$this
->
setBlurSearch
(
$where
,
"name"
);
$
model
=
$this
->
setBlurSearch
(
WorksModel
::
class
,
$where
,
"name"
);
is_null
(
$where
)
&&
$where
=
[];
$row
=
isset
(
$query
[
"size"
])
?
$query
[
"size"
]
:
config
(
"app.default_perpage"
);
return
Response
::
success
(
WorksModel
::
where
(
$where
)
->
paginate
(
$row
)
->
toArray
());
return
Response
::
success
(
$model
->
paginate
(
$row
)
->
toArray
());
}
/**
...
...
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