You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.5 KiB
PHTML
56 lines
1.5 KiB
PHTML
3 years ago
|
<?php
|
||
|
namespace Qrcode\Controller;
|
||
|
|
||
|
class JumpController extends HomeController
|
||
|
{
|
||
|
private $secret = "99d5dd03c24a3dbedd7ef176ec5b9a39";
|
||
|
private $appid = "wxab40e4470236e599";
|
||
|
|
||
|
private function getAccessToken()
|
||
|
{
|
||
|
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->appid}&secret={$this->secret}";
|
||
|
$r = file_get_contents($url);
|
||
|
$ret = json_decode($r, true);
|
||
|
|
||
|
return $ret['access_token'];
|
||
|
}
|
||
|
|
||
|
public function getURLScheme()
|
||
|
{
|
||
|
$url = "https://api.weixin.qq.com/wxa/generatescheme?access_token=".$this->getAccessToken();
|
||
|
$data = [
|
||
|
'jump_wxa' => [
|
||
|
'path' => '/pages/share/share',
|
||
|
'query' => 'id=3'
|
||
|
],
|
||
|
'is_expire' => false,
|
||
|
"expire_time" => 1606737600
|
||
|
];
|
||
|
|
||
|
$ret = curl_post($url, json_encode($data));
|
||
|
|
||
|
echo $ret;
|
||
|
}
|
||
|
|
||
|
public function jumpMp() {
|
||
|
$this->display();
|
||
|
}
|
||
|
|
||
|
// MiniTop 二维码推广
|
||
|
public function getImgs()
|
||
|
{
|
||
|
$id = I('request.id', 0);
|
||
|
// 二维码
|
||
|
$qrcodePromotionList = M('qrcode_promotion_list', 'tab_')->where(['id' => $id])->find();
|
||
|
|
||
|
// 背景图
|
||
|
$qrcodePromotion = M('qrcode_promotion', 'tab_')->where(['id' => $qrcodePromotionList['qp_id']])->find();
|
||
|
|
||
|
$this->ajaxReturn([
|
||
|
'status' => 1,
|
||
|
'background_img' => $qrcodePromotion['background_img'],
|
||
|
'qrcode_img' => $qrcodePromotionList['qrcode_img']
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
}
|