mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 优化筛选功能,同步数据库字段
This commit is contained in:
parent
867319ba9e
commit
7b7b144acf
@ -28,21 +28,21 @@ class InterfaceGroup extends Base {
|
|||||||
$type = $this->request->get('type', '');
|
$type = $this->request->get('type', '');
|
||||||
$status = $this->request->get('status', '');
|
$status = $this->request->get('status', '');
|
||||||
|
|
||||||
$where = [];
|
$obj = new AdminGroup();
|
||||||
if ($status === '1' || $status === '0') {
|
if (strlen($status)) {
|
||||||
$where['status'] = $status;
|
$obj = $obj->where('status', $status);
|
||||||
}
|
}
|
||||||
if ($type) {
|
if ($type) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 1:
|
case 1:
|
||||||
$where['hash'] = $keywords;
|
$obj = $obj->where('hash', $keywords);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$where['name'] = ['like', "%{$keywords}%"];
|
$obj = $obj->whereLike('name', "%{$keywords}%");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$listObj = (new AdminGroup())->where($where)->paginate($limit, false, ['page' => $start])->toArray();
|
$listObj = $obj->order('create_time desc')->paginate($limit, false, ['page' => $start])->toArray();
|
||||||
|
|
||||||
return $this->buildSuccess([
|
return $this->buildSuccess([
|
||||||
'list' => $listObj['data'],
|
'list' => $listObj['data'],
|
||||||
@ -92,7 +92,6 @@ class InterfaceGroup extends Base {
|
|||||||
*/
|
*/
|
||||||
public function add() {
|
public function add() {
|
||||||
$postData = $this->request->post();
|
$postData = $this->request->post();
|
||||||
$postData['addTime'] = $postData['updateTime'] = time();
|
|
||||||
$res = AdminGroup::create($postData);
|
$res = AdminGroup::create($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||||
@ -108,7 +107,6 @@ class InterfaceGroup extends Base {
|
|||||||
*/
|
*/
|
||||||
public function edit() {
|
public function edit() {
|
||||||
$postData = $this->request->post();
|
$postData = $this->request->post();
|
||||||
$postData['updateTime'] = time();
|
|
||||||
$res = AdminGroup::update($postData);
|
$res = AdminGroup::update($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||||
@ -132,7 +130,7 @@ class InterfaceGroup extends Base {
|
|||||||
return $this->buildFailed(ReturnCode::INVALID, '系统预留关键数据,禁止删除!');
|
return $this->buildFailed(ReturnCode::INVALID, '系统预留关键数据,禁止删除!');
|
||||||
}
|
}
|
||||||
|
|
||||||
AdminList::update(['groupHash' => 'default'], ['groupHash' => $hash]);
|
AdminList::update(['group_hash' => 'default'], ['group_hash' => $hash]);
|
||||||
|
|
||||||
$hashRule = AdminApp::all([
|
$hashRule = AdminApp::all([
|
||||||
'app_api_show' => ['like', "%$hash%"]
|
'app_api_show' => ['like', "%$hash%"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user