|
|
@@ -89,6 +89,102 @@ class weixina {
|
|
|
}
|
|
|
return $data["phone_info"];
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取小程序码
|
|
|
+ * @param type $path
|
|
|
+ * @param type $width
|
|
|
+ */
|
|
|
+ public function getQRCode($path,$width){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取不限制的小程序码
|
|
|
+ * @param type $page 页面
|
|
|
+ * @param type $scene 携带参数
|
|
|
+ * @param type $width 宽度
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
+ public function getUnlimitedQRCode($page,$scene,$width=430){
|
|
|
+ $accessData = $this->getAccessToken();
|
|
|
+ if(empty($accessData) || empty($accessData["access_token"])){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $access_token = $accessData["access_token"];
|
|
|
+ $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?"
|
|
|
+ ."access_token=".$access_token;
|
|
|
+ $postData = json_encode(array(
|
|
|
+ "page"=>$page,
|
|
|
+ "scene"=>$scene,
|
|
|
+ "width"=>$width,//默认430
|
|
|
+ "auto_color"=>true,//自动配置线条颜色
|
|
|
+ "is_hyaline" => false,//是否透明底色
|
|
|
+ ));
|
|
|
+ $data = $this->Post($postData,$url);
|
|
|
+ return $data;
|
|
|
+// $res = $data;
|
|
|
+// if(empty($data)){
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// $data = json_decode($data,true);
|
|
|
+// if(empty($data) || empty($data["phone_info"]) || empty($data["phone_info"]["purePhoneNumber"])){
|
|
|
+// $this->error="返回参数名称错误".$res;
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// return $data["phone_info"];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// $key = md5($this->appid.$parms['path'].$parms['params']);
|
|
|
+// $imgsrc = Factory::cache('default')->hget($this->pathAndWxacodeunlimitKey, $key);
|
|
|
+// if(!empty($imgsrc)){
|
|
|
+// return ResultWrapper::success($imgsrc);
|
|
|
+// }
|
|
|
+//
|
|
|
+// $apiUrl = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token='.$access_token;
|
|
|
+//
|
|
|
+// $postData = [
|
|
|
+// 'scene' => $parms['params'],
|
|
|
+// 'page' => $parms['path'],
|
|
|
+// 'width' => 430,
|
|
|
+// 'auto_color' => true,
|
|
|
+// ];
|
|
|
+//
|
|
|
+// $reponse = request($apiUrl, json_encode($postData));
|
|
|
+// if($reponse['httpcode'] != 200){
|
|
|
+// return ResultWrapper::fail('请求外部系统接口报错', ErrorCode::$apiNotResult);
|
|
|
+// }else{
|
|
|
+// if(!is_object($reponse['content'])){
|
|
|
+// $base64 = 'data:'.$reponse['content_type'].';base64,'.base64_encode($reponse['content']);
|
|
|
+// $upload = Factory::baseImg();
|
|
|
+// $upload->move($base64);
|
|
|
+// $imgsrc = $upload->getSaveName();
|
|
|
+// Factory::cache('default')->hset($this->pathAndWxacodeunlimitKey, $key, $imgsrc);
|
|
|
+// return ResultWrapper::success($imgsrc);
|
|
|
+// }
|
|
|
+// $reponseData = json_decode($reponse['content'], true);
|
|
|
+// if( isset($reponseData['errcode']) ){
|
|
|
+// return ResultWrapper::fail($reponseData['errmsg'], $reponseData['errcode']);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取小程序二维码
|
|
|
+ * @param type $path
|
|
|
+ * @param type $width
|
|
|
+ */
|
|
|
+ public function createQRCode($path,$width){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 新版获取接口调用凭证
|
|
|
* @return type
|
|
|
@@ -106,6 +202,11 @@ class weixina {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|