Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-micro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
without authentication
meibuyu-micro
Commits
113c18f3
Commit
113c18f3
authored
Feb 13, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
cf24e168
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
BaseRepository.php
src/Repository/Eloquent/BaseRepository.php
+7
-1
functions.php
src/functions.php
+1
-1
No files found.
src/Repository/Eloquent/BaseRepository.php
View file @
113c18f3
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
namespace
Meibuyu\Micro\Repository\Eloquent
;
namespace
Meibuyu\Micro\Repository\Eloquent
;
use
Hyperf\Database\Model\Builder
;
use
Hyperf\DbConnection\Model\Model
;
use
Hyperf\DbConnection\Model\Model
;
use
Hyperf\HttpServer\Contract\RequestInterface
;
use
Hyperf\HttpServer\Contract\RequestInterface
;
use
Meibuyu\Micro\Exceptions\HttpResponseException
;
use
Meibuyu\Micro\Exceptions\HttpResponseException
;
...
@@ -31,7 +32,7 @@ abstract class BaseRepository implements RepositoryInterface
...
@@ -31,7 +32,7 @@ abstract class BaseRepository implements RepositoryInterface
protected
$request
;
protected
$request
;
/**
/**
* @var Model
* @var Model
|Builder
*/
*/
protected
$model
;
protected
$model
;
...
@@ -134,6 +135,11 @@ abstract class BaseRepository implements RepositoryInterface
...
@@ -134,6 +135,11 @@ abstract class BaseRepository implements RepositoryInterface
return
$this
->
all
();
return
$this
->
all
();
}
}
/**
* @param $id
* @return Model|mixed
* @throws HttpResponseException
*/
public
function
show
(
$id
)
public
function
show
(
$id
)
{
{
return
$this
->
find
(
$id
);
return
$this
->
find
(
$id
);
...
...
src/functions.php
View file @
113c18f3
...
@@ -275,7 +275,7 @@ if (!function_exists('get_tree_id')) {
...
@@ -275,7 +275,7 @@ if (!function_exists('get_tree_id')) {
{
{
static
$list
=
[];
static
$list
=
[];
foreach
(
$array
as
$key
=>
$value
)
{
foreach
(
$array
as
$key
=>
$value
)
{
if
(
$value
[
'p
arent_
id'
]
==
$pid
||
$value
[
'id'
]
==
$pid
)
{
if
(
$value
[
'pid'
]
==
$pid
||
$value
[
'id'
]
==
$pid
)
{
$value
[
'level'
]
=
$level
;
$value
[
'level'
]
=
$level
;
$list
[]
=
$value
[
'id'
];
$list
[]
=
$value
[
'id'
];
unset
(
$array
[
$key
]);
unset
(
$array
[
$key
]);
...
...
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