|
|
@ -126,7 +126,38 @@ class Server |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @notes:发布版本 |
|
|
|
* @notes:获取体验码 |
|
|
|
|
|
|
|
* @param $appid |
|
|
|
|
|
|
|
* @return array|mixed |
|
|
|
|
|
|
|
* @throws DataNotFoundException |
|
|
|
|
|
|
|
* @throws DbException |
|
|
|
|
|
|
|
* @throws ModelNotFoundException |
|
|
|
|
|
|
|
* @author: wanghousheng |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function getQrcode($appid) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$model = new WxserverAccount(); |
|
|
|
|
|
|
|
$info = $model->where(['appid' => $appid])->find(); |
|
|
|
|
|
|
|
if (!empty($info)) { |
|
|
|
|
|
|
|
$info = $info->toArray(); |
|
|
|
|
|
|
|
$access_token = $this->authorizerAccessToken($appid, $info['refresh_token']); |
|
|
|
|
|
|
|
if ($access_token) { |
|
|
|
|
|
|
|
$url = 'https://api.weixin.qq.com/wxa/get_qrcode?access_token=' . $access_token; |
|
|
|
|
|
|
|
$ch = curl_init(); |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $url); |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 如果你的环境没有安装证书,可以设置为 false,但生产环境不建议这样做 |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // 同上 |
|
|
|
|
|
|
|
$qrcode_response = curl_exec($ch); |
|
|
|
|
|
|
|
curl_close($ch); |
|
|
|
|
|
|
|
return json_decode($qrcode_response, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return []; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @notes:发布体验版 |
|
|
|
* @param $appid |
|
|
|
* @param $appid |
|
|
|
* @param $template_id |
|
|
|
* @param $template_id |
|
|
|
* @return bool |
|
|
|
* @return bool |
|
|
|