Commit 113c18f3 authored by 王源's avatar 王源 🎧

优化

parent cf24e168
...@@ -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);
......
...@@ -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['parent_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]);
......
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