Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access-token refresh fixed. closes #7. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/push_admin/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private function refresh_token()
"Content-Type: application/x-www-form-urlencoded;charset=utf-8"
)));
$this->printLogMethodOperate('refresh_token result:' . json_encode($result), __FUNCTION__ . ':' . __LINE__);
if ($result == null || ! array_key_exists("access_token", $result)) {
if ($result == null || ! property_exists($result, "access_token")) {
$this->printLogMethodOperate('refresh_token result error!', __FUNCTION__ . ':' . __LINE__, Constants::HW_PUSH_LOG_ERROR_LEVEL);
return null;
}
Expand All @@ -139,7 +139,7 @@ private function curl_https_post($url, $data = array(), $header = array())
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$this->printLogMethodOperate('curl_https_post curl send headers:' . json_encode($header), __FUNCTION__ . ':' . __LINE__, Constants::HW_PUSH_LOG_DEBUG_LEVEL);

// resolve SSL: no alternative certificate subject name matches target host name
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // check verify
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
Expand Down Expand Up @@ -182,7 +182,7 @@ public function push_send_msg($msg)
if ($this->is_token_expired()) {
$this->refresh_token();
}

if (empty($this->accesstoken)){
$this->printLogMethodOperate("accesstoken is empty!",
__FUNCTION__ . ':' . __LINE__,Constants::HW_PUSH_LOG_ERROR_LEVEL);
Expand Down Expand Up @@ -217,7 +217,7 @@ public function common_send_msg($msg)
if ($this->is_token_expired()) {
$this->refresh_token();
}

if (empty($this->accesstoken)){
$this->printLogMethodOperate("accesstoken is empty!",
__FUNCTION__ . ':' . __LINE__,Constants::HW_PUSH_LOG_ERROR_LEVEL);
Expand All @@ -232,7 +232,6 @@ public function common_send_msg($msg)

// $result ==> eg: {"code":"80000000","msg":"Success","requestId":"157278422841836431010901"}
$this->printLogMethodOperate('common_send_msg leave result:' . json_encode($result), __FUNCTION__ . ':' . __LINE__);


if (! empty($result)) {
$arrResult = json_decode(json_encode($result), true);
Expand Down