34 lines
871 B
PHP
34 lines
871 B
PHP
<?php
|
|
|
|
namespace app\adminapi\lists\device;
|
|
|
|
use app\adminapi\lists\BaseAdminDataLists;
|
|
use app\common\lists\ListsSearchInterface;
|
|
use app\common\model\device\UserDevice;
|
|
|
|
class DeviceLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
{
|
|
public function setSearch(): array
|
|
{
|
|
return [
|
|
'=' => ['platform', 'user_id'],
|
|
'%like%' => ['device_id', 'model', 'brand', 'app_version', 'ip'],
|
|
];
|
|
}
|
|
|
|
public function lists(): array
|
|
{
|
|
return UserDevice::where($this->searchWhere)
|
|
->append(['platform_text'])
|
|
->order(['last_at' => 'desc', 'id' => 'desc'])
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
->select()
|
|
->toArray();
|
|
}
|
|
|
|
public function count(): int
|
|
{
|
|
return UserDevice::where($this->searchWhere)->count();
|
|
}
|
|
}
|