mirror of
http://124.126.16.154:8888/singularity/hdk-pay.git
synced 2026-01-15 03:35:06 +08:00
refactor(PointLogRepo): 优化 getList 方法参数类型
- 将 $type 参数类型从 string 改为 PointType 枚举 - 使用 isset 和 null 合并条件表达式简化代码
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user