60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Author: ykxiao
|
|
* Date: 2025/6/5
|
|
* Time: 下午9:29
|
|
* Description:
|
|
*
|
|
* (c) ykxiao <yk_9001@hotmail.com>
|
|
*
|
|
* This source file is subject to the MIT license that is bundled
|
|
* with this source code in the file LICENSE.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Repository\Company\FirstCompanyRepository;
|
|
use App\Request\FirstCompanyRequest;
|
|
use Exception;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use Hyperf\HttpMessage\Server\Response;
|
|
use Hyperf\Validation\Annotation\Scene;
|
|
|
|
class FirstCompanyController extends AbstractController
|
|
{
|
|
#[Inject]
|
|
protected FirstCompanyRepository $firstCompanyRepository;
|
|
|
|
/**
|
|
* 添加公司.
|
|
* @param FirstCompanyRequest $request
|
|
* @return Response
|
|
* @throws Exception
|
|
*/
|
|
#[Scene(scene: 'addFirstCompany', argument: 'request')]
|
|
public function addFirstCompany(FirstCompanyRequest $request): Response
|
|
{
|
|
$data = $request->all();
|
|
|
|
$this->firstCompanyRepository->addCompany($data);
|
|
|
|
$this->opLogs('[添加公司]' . $data['full_name'] ?? '');
|
|
|
|
return $this->apiResponse->success();
|
|
}
|
|
|
|
/**
|
|
* 公司列表.
|
|
* @return Response
|
|
* @throws Exception
|
|
*/
|
|
public function companyList(): Response
|
|
{
|
|
[$page, $pageSize] = $this->getPage();
|
|
$params = $this->request->all();
|
|
$data = $this->firstCompanyRepository->getList($page, $pageSize, $params);
|
|
return $this->apiResponse->success($data);
|
|
}
|
|
} |