refactor(PointLogRepo): 优化 getList 方法参数类型

- 将 $type 参数类型从 string 改为 PointType 枚举
- 使用 isset 和 null 合并条件表达式简化代码
This commit is contained in:
李东云
2025-09-04 11:30:30 +08:00
parent 8a70e35de7
commit 86f375b18a

View File

@@ -14,13 +14,14 @@ namespace Singularity\HDK\Pay\Infrastructure\Repository;
use Carbon\Carbon;
use Hyperf\Codec\Json;
use Singularity\HDK\Pay\Domain\Account\Aggregate\PointLog\PointLog;
use Singularity\HDK\Pay\Domain\Account\Enum\PointType;
use Singularity\HDK\Pay\Domain\Account\Repository\PointLogRepoInterface;
final class PointLogRepo extends AbstractRepo implements PointLogRepoInterface
{
public function getList(string $uid, ?string $type = null): array
public function getList(string $uid, ?PointType $type = null): array
{
$type ??= 'all';
$type = isset($type) ? $type->value: 'all';
$response = $this->requestService->requestGet(url: "/rpc/v2/account/$uid/balance/$type/logs");
$content = $response->getBody()->getContents();