微信公众号相关调整
This commit is contained in:
@@ -45,7 +45,6 @@ class Wechat
|
||||
return FALSE;
|
||||
}
|
||||
$result = json_decode($result, true);
|
||||
|
||||
if (!empty($result['access_token'])) {
|
||||
$sToken = $result['access_token'];
|
||||
Cache::set($this->sWechatAccessToken.'_'.$this->sAppID, $sToken, 7000); // 有效期7200秒
|
||||
@@ -305,19 +304,18 @@ class Wechat
|
||||
return json_encode($aInfo);
|
||||
}
|
||||
|
||||
// //CURL请求
|
||||
// $sUrl = "https://api.weixin.qq.com/cgi-bin/freepublish/submit?access_token={$sToken}";
|
||||
// //参数组装
|
||||
// $sJsonData = json_encode([
|
||||
// 'media_id' => $sMediaId
|
||||
// ], JSON_UNESCAPED_UNICODE);
|
||||
// //发送CURL请求
|
||||
// $aCurlResult = $this->curlWechatApi($sUrl,$sJsonData);
|
||||
// if($aCurlResult['status'] != 1){
|
||||
// return $aCurlResult;
|
||||
// }
|
||||
// $response = empty($aCurlResult['data']) ? [] : $aCurlResult['data'];
|
||||
$response['publish_id'] = '100000001';
|
||||
//CURL请求
|
||||
$sUrl = "https://api.weixin.qq.com/cgi-bin/freepublish/submit?access_token={$sToken}";
|
||||
//参数组装
|
||||
$sJsonData = json_encode([
|
||||
'media_id' => $sMediaId
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
//发送CURL请求
|
||||
$aCurlResult = $this->curlWechatApi($sUrl,$sJsonData);
|
||||
if($aCurlResult['status'] != 1){
|
||||
return $aCurlResult;
|
||||
}
|
||||
$response = empty($aCurlResult['data']) ? [] : $aCurlResult['data'];
|
||||
//判断是否推送成功
|
||||
if(empty($response['publish_id'])){
|
||||
return json_encode(['status' => 9,'msg' => "The publish_id of the published draft was not obtained"]);
|
||||
@@ -345,25 +343,24 @@ $response['publish_id'] = '100000001';
|
||||
return json_encode(['status' => 2,'msg' => 'Please configure the AppID and AppSecret']);
|
||||
}
|
||||
|
||||
// //获取Token
|
||||
// $sToken = $this->getAccessToken();
|
||||
// if (empty($sToken)) {
|
||||
// return json_encode(['status' => 3, 'msg' => 'Failed to obtain access_token']);
|
||||
// }
|
||||
//获取Token
|
||||
$sToken = $this->getAccessToken();
|
||||
if (empty($sToken)) {
|
||||
return json_encode(['status' => 3, 'msg' => 'Failed to obtain access_token']);
|
||||
}
|
||||
|
||||
// //CURL请求
|
||||
// $sUrl = "https://api.weixin.qq.com/cgi-bin/freepublish/get?access_token={$sToken}";
|
||||
// //参数组装
|
||||
// $sJsonData = json_encode([
|
||||
// 'publish_id' => $sPublishId
|
||||
// ], JSON_UNESCAPED_UNICODE);
|
||||
// //发送CURL请求
|
||||
// $aCurlResult = $this->curlWechatApi($sUrl,$sJsonData);
|
||||
// $response = empty($aCurlResult['data']) ? [] : $aCurlResult['data'];
|
||||
// if(empty($response)){
|
||||
// return json_encode(['status' => 4,'msg' => 'Query failed']);
|
||||
// }
|
||||
$response = ['publish_id' => '1000001','publish_status' => 2,'article_id'=> '','article_detail','fail_idx' => [1,2]];
|
||||
//CURL请求
|
||||
$sUrl = "https://api.weixin.qq.com/cgi-bin/freepublish/get?access_token={$sToken}";
|
||||
//参数组装
|
||||
$sJsonData = json_encode([
|
||||
'publish_id' => $sPublishId
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
//发送CURL请求
|
||||
$aCurlResult = $this->curlWechatApi($sUrl,$sJsonData);
|
||||
$response = empty($aCurlResult['data']) ? [] : $aCurlResult['data'];
|
||||
if(empty($response)){
|
||||
return json_encode(['status' => 4,'msg' => 'Query failed']);
|
||||
}
|
||||
return json_encode(['status' => 1,'msg' => 'query was successful','data' => $response]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user