no message
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\lottery;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\lottery\LotteryDraw;
|
||||
use app\common\model\lottery\LotteryCategory;
|
||||
|
||||
class LotteryDrawLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['category_id', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = LotteryDraw::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('draw_date', 'desc')
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$catIds = array_unique(array_column($lists, 'category_id'));
|
||||
$cats = LotteryCategory::whereIn('id', $catIds)->column('name', 'id');
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['category_name'] = $cats[$item['category_id']] ?? '-';
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return LotteryDraw::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user