fix(goods): 修复类型错误的问题

This commit is contained in:
李东云
2023-07-25 17:04:41 +08:00
parent 1a399e9e65
commit 9052dc2d43
2 changed files with 3 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Singularity\HDK\Pay\Resource;
use Hyperf\Resource\Json\JsonResource;
use Money\Currency;
use Money\Money;
/**
@@ -39,7 +40,7 @@ final class Goods extends JsonResource
'id' => $this->id,
'goodsName' => $this->goodsName,
'goodsSpec' => $this->goodsSpec,
'amount' => new Money($this->amount['price'], $this->amount['currency'])
'amount' => new Money($this->amount['price'], new Currency($this->amount['currency']))
];
}

View File

@@ -48,6 +48,6 @@ final class GoodsRpc
$response = $this->requestService->requestGet("/rpc/v1/goods/$goodsId/search", $specifies);
$content = $response->getBody()->getContents();
return Goods::make(Json::decode($content, false));
return Goods::make(Json::decode($content));
}
}