重构初始化

This commit is contained in:
技术老胡
2026-04-15 11:45:46 +08:00
parent 72d72d735b
commit 7612026773
381 changed files with 28287 additions and 14717 deletions

View File

@@ -0,0 +1,63 @@
<?php
namespace app\http\admin\controller\account;
use app\common\base\BaseController;
use app\http\admin\validation\MerchantAccountValidator;
use app\service\account\funds\MerchantAccountService;
use support\Request;
use support\Response;
/**
* 商户账户控制器。
*/
class MerchantAccountController extends BaseController
{
/**
* 构造函数,注入商户账户服务。
*/
public function __construct(
protected MerchantAccountService $merchantAccountService
) {
}
/**
* 查询商户账户列表。
*/
public function index(Request $request): Response
{
$data = $this->validated($request->all(), MerchantAccountValidator::class, 'index');
return $this->page(
$this->merchantAccountService->paginate(
$data,
(int) ($data['page'] ?? 1),
(int) ($data['page_size'] ?? 10)
)
);
}
/**
* 资金中心概览。
*/
public function summary(Request $request): Response
{
return $this->success($this->merchantAccountService->summary());
}
/**
* 查询商户账户详情。
*/
public function show(Request $request, string $id): Response
{
$data = $this->validated(['id' => (int) $id], MerchantAccountValidator::class, 'show');
$account = $this->merchantAccountService->findById((int) $data['id']);
if (!$account) {
return $this->fail('商户账户不存在', 404);
}
return $this->success($account);
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace app\http\admin\controller\account;
use app\common\base\BaseController;
use app\http\admin\validation\MerchantAccountLedgerValidator;
use app\service\account\ledger\MerchantAccountLedgerService;
use support\Request;
use support\Response;
/**
* 商户账户流水控制器。
*/
class MerchantAccountLedgerController extends BaseController
{
/**
* 构造函数,注入账户流水服务。
*/
public function __construct(
protected MerchantAccountLedgerService $merchantAccountLedgerService
) {
}
/**
* 查询账户流水列表。
*/
public function index(Request $request): Response
{
$data = $this->validated($request->all(), MerchantAccountLedgerValidator::class, 'index');
return $this->page(
$this->merchantAccountLedgerService->paginate(
$data,
(int) ($data['page'] ?? 1),
(int) ($data['page_size'] ?? 10)
)
);
}
/**
* 查询账户流水详情。
*/
public function show(Request $request, string $id): Response
{
$data = $this->validated(['id' => (int) $id], MerchantAccountLedgerValidator::class, 'show');
$ledger = $this->merchantAccountLedgerService->findById((int) $data['id']);
if (!$ledger) {
return $this->fail('账户流水不存在', 404);
}
return $this->success($ledger);
}
}