Initial commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\console\service;
|
||||
|
||||
use app\console\model\UsersModel;
|
||||
use app\mzl\common\services\BaseService;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UsersService extends BaseService
|
||||
{
|
||||
/**
|
||||
* 定义模型
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModel(): string
|
||||
{
|
||||
return UsersModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多场景配置
|
||||
*/
|
||||
public function queryScenes(): array
|
||||
{
|
||||
return [
|
||||
'default' => function ($params) {
|
||||
return [
|
||||
'filters' => [
|
||||
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||
],
|
||||
'fields' => ['id', 'user_sn', 'nickname', 'avatar', 'realname', 'phone', 'company', 'created_at', 'updated_at'],
|
||||
'sorts' => [
|
||||
['field' => 'id', 'direction' => 'desc']
|
||||
],
|
||||
'pagination' => [
|
||||
'page' => $params['page'] ?? 1,
|
||||
'per_page' => $params['per_page'] ?? 10,
|
||||
]
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user