<?php include "../inc/odbc.php"; ?>
|
<?php include "../inc/function.php"; ?>
|
<?php
|
|
$path = !empty($_GET["path"])?str_replace("|","&",$_GET["path"]):"";
|
$dir = !empty($_GET["dir"])?$_GET["dir"]:"";
|
|
if(!empty($_POST)){
|
// var_dump($_POST);exit;
|
$CodeType = !empty($_POST["CodeType"])?$_POST["CodeType"]:"1";
|
$is_hyaline = !empty($_POST["is_hyaline"])?$_POST["is_hyaline"]:"1";
|
|
$weixinAPP = $_POST["weixinAPP"];
|
if ($weixinAPP == "GDS-0008-fDwr") {
|
$APPSECRET="TH8o9RQItfd9bzffeOCW";
|
}else{
|
header("Location: ma.php?APPID=".$APPID);exit;
|
}
|
|
$GetUrl="https://api.966120.com.cn/weixin/";
|
$GetArgs="method=weixin_Appid&APPID=".$weixinAPP."&UnixTime=".time();
|
|
$Sign=PHP_Sign($GetUrl,$GetArgs,$APPSECRET);
|
|
$wx_url=$GetUrl."?".$GetArgs."&Sign=".$Sign;
|
//$wx_url = "https://api.966120.com.cn/weixin/?method=weixin_Appid&APPID=GDS-0008-fDwr&UnixTime=".time()."&Sign=Sign";
|
$wxinfo=file_get_contents($wx_url);
|
$wxinfo=json_decode($wxinfo,true);
|
|
$weixin_Name = $wxinfo["weixin_Name"];
|
$access_token = $wxinfo["access_token"];
|
if($_POST["dir"] == "0"){
|
header("Location: ma.php?APPID=".$APPID);exit;
|
}elseif($_POST["dir"] != "0"){
|
$dir = $_POST["dir"];
|
if(empty($_POST[$dir])){
|
header("Location: ma.php?APPID=".$APPID);exit;
|
}
|
if($dir == "detail"){
|
$path = "pages/detail/detail?";
|
$can = $_POST[$dir];
|
$path .= $can."&UAid=82188";
|
$width = $_POST["width"];
|
if ($CodeType==1){
|
$ma_url = "https://api.weixin.qq.com/wxa/getwxacode?access_token=$access_token";
|
}else{
|
$ma_url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=$access_token";
|
}
|
|
$send = array(
|
"path"=>$path,
|
"width"=>$width,
|
);
|
if ($is_hyaline==2 and $CodeType==1){
|
$send=array_merge($send, array("is_hyaline"=>true,));
|
}
|
// var_dump($send);exit;
|
$send = json_encode($send);
|
|
$ch = curl_init();//初始化curl
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
curl_setopt($ch, CURLOPT_URL, $ma_url);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);
|
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
curl_setopt($ch, CURLOPT_POSTFIELDS,$send);
|
|
$data_save = curl_exec($ch);//运行curl
|
// var_dump($data_save);exit;
|
curl_close($ch);
|
|
header("content-type: image/jpeg");
|
|
echo $data_save;
|
}elseif($dir == "shopList"){
|
$path = "pages/shopList/shopList?";
|
$can = $_POST[$dir];
|
$path .= $can;
|
$width = $_POST["width"];
|
if ($CodeType==1){
|
$ma_url = "https://api.weixin.qq.com/wxa/getwxacode?access_token=$access_token";
|
}else{
|
$ma_url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=$access_token";
|
}
|
|
$send = array(
|
"path"=>$path,
|
"width"=>$width,
|
);
|
if ($is_hyaline==2 and $CodeType==1){
|
$send=array_merge($send, array("is_hyaline"=>true,));
|
}
|
$send = json_encode($send);
|
|
$ch = curl_init();//初始化curl
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
curl_setopt($ch, CURLOPT_URL, $ma_url);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);
|
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
curl_setopt($ch, CURLOPT_POSTFIELDS,$send);
|
|
$data_save = curl_exec($ch);//运行curl
|
// var_dump($data_save);exit;
|
curl_close($ch);
|
|
header("content-type: image/jpeg");
|
|
echo $data_save;
|
}elseif($dir == "define"){
|
$hand = $_POST["define"];
|
$width = $_POST["width"];
|
if ($CodeType==1){
|
$ma_url = "https://api.weixin.qq.com/wxa/getwxacode?access_token=$access_token";
|
}else{
|
$ma_url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=$access_token";
|
}
|
|
$send = array(
|
"path"=>$hand,
|
"width"=>$width
|
//"is_hyaline"=>true,
|
);
|
if ($is_hyaline==2 and $CodeType==1){
|
$send=array_merge($send, array("is_hyaline"=>true,));
|
}
|
$send = json_encode($send);
|
|
$ch = curl_init();//初始化curl
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
curl_setopt($ch, CURLOPT_URL, $ma_url);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);
|
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
curl_setopt($ch, CURLOPT_POSTFIELDS,$send);
|
|
$data_save = curl_exec($ch);//运行curl
|
// var_dump($data_save);exit;
|
curl_close($ch);
|
|
header("content-type: image/png");
|
|
echo $data_save;
|
}
|
}
|
}
|
|
?>
|
<!DOCTYPE html>
|
<html>
|
<head>
|
<title></title>
|
</head>
|
<body>
|
<form method="post" action="ma.php?APPID=<?php echo $APPID;?>">
|
生成二维码类型:
|
<select name="CodeType">
|
<option value="1" selected>小程序码</option>
|
<option value="2">二维码</option>
|
</select>
|
<select name="is_hyaline">
|
<option value="1" selected>白底</option>
|
<option value="2">透明</option>
|
</select><br />
|
对应的小程序:
|
<select name="weixinAPP">
|
<option value="0">请选择</option>
|
<option value="GDS-0008-fDwr" selected>966120微信小程序</option>
|
<!--<option value="9">白马全球馆CX</option>-->
|
</select><br />
|
小程序指向:
|
<select id="set" name="dir">
|
<option value="0">请选择</option>
|
<option value="detail" <?php if($dir != "" && $dir=="detail"){echo "selected";}?>>商品详情页</option>
|
<option value="shopList" <?php if($dir != "" && $dir=="shopList"){echo "selected";}?>>商品列表页</option>
|
<option value="define"<?php if($dir == "" || $dir=="define"){echo "selected";}?>>自定义路径</option>
|
</select><br />
|
参数:<input type="text" name="path" id="get" style="width:350px;" value="<?php if($path != ""){echo $path;}?>"/><span class="0 spanSum" style="display:none;">请选择小程序的路径</span><span class="detail spanSum" style="display:none;">商品详情页参数例子:strItmID=1120-002735</span><span class="shopList spanSum" style="display:none;">商品列表页参数例子:TopID=1&ItmFlagOd=2</span><span class="define spanSum">自定义路径例子:pages/index/index</span>
|
<br />
|
图片宽度:<input type="text" value="430" name="width" /><br />
|
<input type="submit" />
|
<br><br>
|
966120微信小程序路径参考:<br>
|
首页:pages/index/index<br>
|
带来源参数的预约入口:pages/index/index?S=XXXX<br>
|
我的订单:pages/order/list/list<br>
|
订单详情/支付/评论:pages/order/detail/detail?ServiceOrdID=1016165355<br>
|
个人中心:pages/my/my<br>
|
发票申请列表:pages/order/list2/list2?OrdState=11<br>
|
服务评价列表:pages/order/list2/list2?OrdState=10<br>
|
H5网页:pages/h5/h5?src=https://api.966120.com.cn/<br>
|
</form>
|
<a href="ma0629.php">生成B模式码</a>
|
</body>
|
</html>
|
<script type="text/javascript" src="http://v.com.cn/js/jquery-1.7.2.min.js"></script>
|
<script type="text/javascript">
|
$('#get').attr('name',$('#set').val());
|
var set;
|
$('#set').change(function(){
|
$(".spanSum").hide();
|
set = $('#set').val();
|
$('#get').attr('name',set);
|
$("."+set).show();
|
})
|
</script>
|