data_center/app/adminapi/lists/systems/SystemLists.php

37 lines
1.1 KiB
PHP

<?php
namespace app\adminapi\lists\systems;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\systems\System;
class SystemLists extends BaseAdminDataLists implements ListsSearchInterface
{
// 搜索条件
public function setSearch(): array
{
return [
'=' => ['system_status'],
'%like%' => ['system_name'],
];
}
// 获取列表
public function lists(): array
{
$field = "id,system_name,system_appid,system_appkey,system_url,create_time,system_status";
return System::field($field)->where($this->searchWhere)->where('system_status','<>',2)
->limit($this->limitOffset, $this->limitLength)
->order('id desc')
->select()->each(function($item){
$item['system_status_text'] = $item->system_status_text;
})->toArray();
}
// 获取数量
public function count(): int
{
return System::field('id')->where($this->searchWhere)->where('system_status','<>',2)->count();
}
}