39 lines
974 B
PHP
39 lines
974 B
PHP
<?php
|
|
|
|
namespace app\adminapi\lists\match;
|
|
|
|
use app\adminapi\lists\BaseAdminDataLists;
|
|
use app\common\lists\ListsSearchInterface;
|
|
use app\common\model\match\MatchEvent;
|
|
|
|
class MatchLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
{
|
|
public function setSearch(): array
|
|
{
|
|
return [
|
|
'=' => ['sport_type', 'status', 'is_hot', 'is_show'],
|
|
'%like%' => ['home_team', 'away_team', 'league_name'],
|
|
];
|
|
}
|
|
|
|
public function lists(): array
|
|
{
|
|
$lists = MatchEvent::where($this->searchWhere)
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
->order('match_time', 'desc')
|
|
->select()
|
|
->toArray();
|
|
|
|
foreach ($lists as &$item) {
|
|
$item['match_time_str'] = date('Y-m-d H:i', $item['match_time']);
|
|
}
|
|
|
|
return $lists;
|
|
}
|
|
|
|
public function count(): int
|
|
{
|
|
return MatchEvent::where($this->searchWhere)->count();
|
|
}
|
|
}
|