This commit is contained in:
2021-03-23 18:05:16 +08:00
parent 4137a817bb
commit 9523b00c7b
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -7,6 +7,7 @@ namespace Rpc;
use Exception;
use Snowflake\Abstracts\Component;
use Snowflake\Abstracts\Config;
use Snowflake\Core\Json;
use Snowflake\Exception\ConfigException;
use Swoole\Coroutine\Client as CClient;
@@ -47,12 +48,12 @@ class Client extends Component
return $this->addError($this->client->errMsg . '(' . $this->client->errCode . ')');
}
}
$isSend = $this->client->send(serialize(['cmd' => $cmd, 'body' => $param]));
$isSend = $this->client->send(Json::encode(['cmd' => $cmd, 'body' => $param]));
if ($isSend === false) {
return $this->addError($this->client->errMsg . '(' . $this->client->errCode . ')');
}
if (is_bool($unpack = unserialize($this->client->recv()))) {
if (is_bool($unpack = Json::decode($this->client->recv()))) {
return $this->addError('Service return data format error(500)');
}
return $unpack;