<?php
/**
 * @author 林海涛
 * @date 2024/7/11 下午1:40
 */
namespace app\workerapi\lists;
use app\common\enum\YesNoEnum;
use app\common\lists\ListsSearchInterface;
use app\common\model\platform_rule\PlatformRule;


class PlatformRuleLists extends BaseWorkerDataLists implements ListsSearchInterface
{
    /**
     * 设置搜索条件
     * @return array[]
     * @author 林海涛
     * @date 2024/7/11 下午1:46
     */
    public function setSearch(): array
    {
        return [
            '=' => ['rule_name'],
        ];
    }

    public function lists():array
    {
       $data = PlatformRule::where($this->searchWhere)
            ->field(['id', 'rule_name','description', 'sort'])
            ->order(['sort' => 'desc','id' => 'desc'])
            ->select()
            ->toArray();
       return $data;
    }
    public function count(): int
    {
        return PlatformRule::where($this->searchWhere)->count();
    }
}