home_tranfer_120_2
This commit is contained in:
@@ -57,6 +57,37 @@ class Hdwechat
|
||||
return $this->access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取小程序scheme码
|
||||
* Created on: 2021/3/5 17:00
|
||||
* Created by: dengbw
|
||||
* 文档 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.generate.html
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
function urlscheme($params = array()){
|
||||
$access_token = $this->access_token();
|
||||
if(!$access_token){
|
||||
debug_log("[error] ". __FUNCTION__ . ": not access_token", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
$pre_url = 'https://api.weixin.qq.com/wxa/generatescheme?access_token=';
|
||||
$url = $pre_url . $access_token;
|
||||
$data = array(
|
||||
'jump_wxa' => array('path'=>$params['path'],'query'=>$params['query']),//跳转到的目标小程序信息
|
||||
'is_expire' => $params['is_expire'],//到期失效:true,永久有效:false
|
||||
'expire_time' => $params['expire_time'],//失效时间
|
||||
);
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
if(isset($ret['errcode']) && 40001 == $ret['errcode']){//token过期,重置后请求
|
||||
$url = $pre_url . $this->access_token(true);
|
||||
list($code, $res) = $this->curl_post($url, $data);
|
||||
$ret = json_decode($res, true);
|
||||
}
|
||||
return array('openlink' => $ret['openlink']);
|
||||
}
|
||||
|
||||
function activityid($unionid)
|
||||
{
|
||||
$access_token = $this->access_token();
|
||||
|
||||
Reference in New Issue
Block a user