|
|
@@ -42,37 +42,37 @@ function gift_card_pass(){
|
|
|
function outFileLog($data,$filename='log',$title='data'){
|
|
|
file_put_contents(runtime_path() . 'log/'.$filename.'.txt', PHP_EOL .date('Y-m-d h:i:s', time()).'~'.$title.':' . json_encode($data,JSON_UNESCAPED_UNICODE), FILE_APPEND);
|
|
|
}
|
|
|
-//构建请求二维码参数
|
|
|
-//path是扫描二维码跳转的小程序路径,可以带参数?id=xxx
|
|
|
-//width是二维码宽度
|
|
|
-function getQrCode($ACCESS_TOKEN,$PAGES,$NAME,$PATH='uploads/qrcode/'){
|
|
|
-
|
|
|
- //判断文件夹是否存在,不存在则创建
|
|
|
- if (!file_exists($PATH)) {
|
|
|
- mkdir ($PATH,0777,true);
|
|
|
- }
|
|
|
-// $qcode ="https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=$ACCESS_TOKEN"; //方形二维码
|
|
|
- $qcode='https://api.weixin.qq.com/wxa/getwxacode?access_token='.$ACCESS_TOKEN; //圆形二维码
|
|
|
-
|
|
|
- $data = [
|
|
|
- 'width'=>120,
|
|
|
- 'path'=>$PAGES,
|
|
|
- 'is_hyaline'=>false,
|
|
|
- ];
|
|
|
-
|
|
|
-
|
|
|
- $param = json_encode($data);
|
|
|
-
|
|
|
- //POST参数
|
|
|
- $result = httpRequest( $qcode, $param,"POST");
|
|
|
- return $result;
|
|
|
- //生成二维码
|
|
|
-// file_put_contents($name.".png", $result);
|
|
|
- file_put_contents($PATH.$NAME.".png", $result);
|
|
|
- $base64_image ="data:image/jpeg;base64,".base64_encode($result);
|
|
|
- return $result;
|
|
|
-
|
|
|
-}
|
|
|
+////构建请求二维码参数
|
|
|
+////path是扫描二维码跳转的小程序路径,可以带参数?id=xxx
|
|
|
+////width是二维码宽度
|
|
|
+//function getQrCode($ACCESS_TOKEN,$PAGES,$NAME,$PATH='uploads/qrcode/'){
|
|
|
+//
|
|
|
+// //判断文件夹是否存在,不存在则创建
|
|
|
+// if (!file_exists($PATH)) {
|
|
|
+// mkdir ($PATH,0777,true);
|
|
|
+// }
|
|
|
+//// $qcode ="https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=$ACCESS_TOKEN"; //方形二维码
|
|
|
+// $qcode='https://api.weixin.qq.com/wxa/getwxacode?access_token='.$ACCESS_TOKEN; //圆形二维码
|
|
|
+//
|
|
|
+// $data = [
|
|
|
+// 'width'=>120,
|
|
|
+// 'path'=>$PAGES,
|
|
|
+// 'is_hyaline'=>false,
|
|
|
+// ];
|
|
|
+//
|
|
|
+//
|
|
|
+// $param = json_encode($data);
|
|
|
+//
|
|
|
+// //POST参数
|
|
|
+// $result = httpRequest( $qcode, $param,"POST");
|
|
|
+// return $result;
|
|
|
+// //生成二维码
|
|
|
+//// file_put_contents($name.".png", $result);
|
|
|
+// file_put_contents($PATH.$NAME.".png", $result);
|
|
|
+// $base64_image ="data:image/jpeg;base64,".base64_encode($result);
|
|
|
+// return $result;
|
|
|
+//
|
|
|
+//}
|
|
|
//把请求发送到微信服务器换取二维码
|
|
|
function httpRequest($url, $data='', $method='GET'){
|
|
|
$curl = curl_init();
|