Files
fdesk/app/admin/service/CorpFeishuAppService.php
T
2025-08-14 20:08:57 +08:00

70 lines
1.7 KiB
PHP

<?php
namespace app\admin\service;
use app\common\validate\CorpFeishuAppValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\CorpFeishuApp;
use support\Request;
class CorpFeishuAppService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = CorpFeishuApp::class;
/**
* 验证器
*/
protected $validator = CorpFeishuAppValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
/**
* 构建查询条件
*/
protected function buildQueryConfig(Request $request, string $scene = 'index'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'index':
$config['where']['status'] = 1;
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
$config['with']['corpInfo'][] = 'name';
$config['with']['systemInfo'][] = 'name';
break;
case 'show':
$config['where']['id'] = $p['id'];
$config['where']['status'] = 1;
$config['with']['corpInfo'][] = 'name';
$config['with']['systemInfo'][] = 'name';
break;
case 'store':
break;
case 'update':
$config['where']['id'] = $p['id'];
break;
case 'destroy':
$config['where']['id'] = $p['id'];
break;
}
return $config;
}
}