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