master
elf 2 years ago
parent 670dd8f057
commit 9432ef1212

@ -41,7 +41,14 @@ abstract class JhBaseClient
$params[self::SIGN_NAME] = $this->sign($api, $params);
try {
$response = $this->request($api, $params);
return json_decode($response, true);
$result = json_decode($response, true);
if (empty($result)) {
return [
'code' => -98,
'msg' => '返回数据异常',
];
}
return $result;
} catch (\Exception $e) {
$env = C('APP_ENV', null, 'prod');
$this->log('RequestError ' . $e->getMessage(), Log::ERR);
@ -69,11 +76,15 @@ abstract class JhBaseClient
protected function post($url, array $params = [])
{
$response = $this->client->post($url, [
/* $response = $this->client->post($url, [
'verify' => false,
'form_params' => $params,
]);
$result = (string)$response->getBody();
$result = (string)$response->getBody(); */
$result = json_encode([
'code' => -97,
'msg' => '模拟发放,自定失败',
]);
$this->log('RequestData ' . json_encode($params));
$this->log('ResponseData ' . $result);
return $result;
@ -81,11 +92,15 @@ abstract class JhBaseClient
protected function get($url, array $params = [])
{
$response = $this->client->get($url, [
/* $response = $this->client->get($url, [
'verify' => false,
'query' => $params,
]);
$result = (string)$response->getBody();
$result = (string)$response->getBody(); */
$result = json_encode([
'code' => -97,
'msg' => '模拟发放,自定失败',
]);
$this->log('RequestData ' . json_encode($params));
$this->log('ResponseData ' . $result);
return $result;
@ -174,7 +189,7 @@ abstract class JhBaseClient
}
protected function getCommonResult($result) {
if ($result == self::SUCCESS) {
if (intval($result['code']) === self::SUCCESS) {
return [
'status' => true,
'message' => $result['msg'],

Loading…
Cancel
Save