47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\console\service;
|
|
|
|
use app\console\model\SubscribeModel;
|
|
use app\mzl\common\services\BaseService;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class SubscribeService extends BaseService
|
|
{
|
|
/**
|
|
* 定义模型
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getModel(): string
|
|
{
|
|
return SubscribeModel::class;
|
|
}
|
|
|
|
/**
|
|
* 多场景配置
|
|
*/
|
|
public function queryScenes(): array
|
|
{
|
|
return [
|
|
'default' => function ($params) {
|
|
$keyword = $params['keyword'] ?? '';
|
|
return [
|
|
'filters' => [
|
|
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
|
],
|
|
'fields' => ['id', 'email', 'ip', 'created_at', 'updated_at'],
|
|
'relations' => [],
|
|
'sorts' => [
|
|
['field' => 'created_at', 'direction' => 'desc']
|
|
],
|
|
'pagination' => [
|
|
'page' => $params['page'] ?? 1,
|
|
'per_page' => $params['per_page'] ?? 10,
|
|
]
|
|
];
|
|
}
|
|
];
|
|
}
|
|
} |