add apimanager module

This commit is contained in:
uctoo
2021-07-27 16:49:30 +08:00
parent 7ad6bacb2d
commit b784251605
25 changed files with 2248 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | UCToo [ Universal Convergence Technology ]
// +----------------------------------------------------------------------
// | Copyright (c) 2014-2021 https://www.uctoo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: UCToo <contact@uctoo.com>
// +----------------------------------------------------------------------
namespace catchAdmin\apimanager\model\search;
trait ApiCategorySearch
{
public function searchCategoryTitleAttr($query, $value, $data)
{
return $query->whereLike('category_title', $value);
}
public function searchStatusAttr($query, $value, $data)
{
return $query->where('status', $value);
}
}

View File

@@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | UCToo [ Universal Convergence Technology ]
// +----------------------------------------------------------------------
// | Copyright (c) 2014-2021 https://www.uctoo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: UCToo <contact@uctoo.com>
// +----------------------------------------------------------------------
namespace catchAdmin\apimanager\model\search;
use catchAdmin\apimanager\model\ApiCategory;
trait ApiTesterSearch
{
public function searchApiTitleAttr($query, $value, $data)
{
return $query->whereLike('api_title', $value);
}
public function searchApiNameAttr($query, $value, $data)
{
return $query->whereLike('api_name', $value);
}
public function searchStatusAttr($query, $value, $data)
{
return $query->where($this->aliasField('status'), $value);
}
public function searchTypeAttr($query, $value, $data)
{
return $query->where($this->aliasField('type'), $value);
}
/**
* 查询分类下的API
*
* @time 2021年05月20日
* @param $query
* @param $value
* @param $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @return mixed
*/
public function searchCategoryIdAttr($query, $value, $data)
{
return $query->whereIn($this->aliasField('category_id'), ApiCategory::getChildrenCategoryIds($value));
}
}

View File

@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | UCToo [ Universal Convergence Technology ]
// +----------------------------------------------------------------------
// | Copyright (c) 2014-2021 https://www.uctoo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: UCToo <contact@uctoo.com>
// +----------------------------------------------------------------------
namespace catchAdmin\apimanager\model\search;
use catchAdmin\permissions\model\Users;
trait ApiTesterUserenvSearch
{
public function searchCreatorAttr($query, $value, $data)
{
return $query->whereLike(app(Users::class)->getTable() . '.username', $value);
}
public function searchEnvNameAttr($query, $value, $data)
{
return $query->whereLike('env_name', $value);
}
}