appid = "ce785842f7394c77a8f34c5e02b218d3"; $this->appSecret = "55ea82338d8b48c38f42398e5b10fd60"; $this->userId = "c4a02f047d4a45e393dd6fab70067eed"; $this->getAccessToken(); } /** * @ 获取access_token */ public function getAccessToken(){ if(!empty($this->data)){ return $this->data; } $redis_name = "cxgyc:XtOpenApi:getAccessToken_v6:{$this->appid}"; $get = \Yii::$app->redis->get($redis_name); if(!empty($get)){ $this->access_token = $get; return $get; } $url = "https://op.anjucloud.com/api/auth"; $arr = [ 'appKey' => $this->appid, 'appSecret' => $this->appSecret ]; $res = $this->post_url($url,http_build_query($arr)); if(empty($res)){ $this->data = $this->returnMsg(1,"请求失败"); return false; } $data = json_decode($res,true); if(isset($data['code']) && $data['code'] == 20001){ return $this->getAccessToken(); } if(empty($data['result'])){ $this->data = $this->returnMsg(1,$data['msg']); return false; } \Yii::$app->redis->setex($redis_name,60*60*1.8,$data['result']['access_token']); $this->access_token = $data['result']['access_token']; return $data['result']['access_token']; } /** * @title 开门 * @param $sn string sn号码 * @return_param code int 1失败,0。成功 */ public function Open($sn){ $redis_name = "cxgyc:XtOpenApi:door:list"; $get = \Yii::$app->redis->hget($redis_name,$sn); if(empty($get)){ return $this->returnMsg(1,'暂无云盒'); } $json_de = json_decode($get,true); return $this->openDoor([ 'userId' => $this->userId, 'id' => $json_de['id'], ])->getData(); } /** * @title 获取开门二维码内容 * @param $sn string sn号码 * @param $time int 过期时间,如 1681113652 * @return_param code int 1失败,0。成功 * @return_param data.qr string 二维码内容,需要前段或后端生成二维码 */ public function OpenQr($sn,$time){ $redis_name = "cxgyc:XtOpenApi:door:list"; $get = \Yii::$app->redis->hget($redis_name,$sn); if(empty($get)){ return $this->returnMsg(1,'暂无云盒'); } $md5 = md5($sn."_".$time."_".$this->userId."_".$this->user_id); $redis_data_name = "cxgyc:XtOpenApi:OpenQr:{$md5}"; $get_ = \Yii::$app->redis->get($redis_data_name); if(!empty($get_)){ return json_decode($get_,true); } $json_de = json_decode($get,true); $res = $this->getDoorQR([ 'userId' => $this->userId, 'villageId' => $json_de['villageId'], 'doorIds' => $json_de['id'], 'timeout' => strval($time), ])->getData(); if(empty($res['code'])){ // 请求成功,缓存数据 $ttl = intval($time) - time(); if($ttl < 0){ $ttl = 0; } if($ttl > 60*60*24){ $ttl = 60*60*24; } \Yii::$app->redis->setex($redis_data_name,$ttl,json_encode($res,JSON_UNESCAPED_UNICODE)); } return $res; } /** * @ 获取getArea */ public function getArea($id=''){ if(!empty($this->data)){ return $this; } $url = "https://op.anjucloud.com/api/getArea?id={$id}"; $arr = []; $res = $this->post_url($url,$arr,$this->access_token); if(empty($res)){ $this->data = $this->returnMsg(1,"请求失败"); return $this; } $data = json_decode($res,true); if(empty($data['result'])){ $this->data = $this->returnMsg(1,$data['msg']); return $this; } $this->data = array_column($data['result'],null,'name'); return $this; } /** * @ 三、新增小区 */ public function addVillage($data=[]){ $this->url = "https://op.anjucloud.com/api/village/addVillage"; $this->arr = [ 'name' => $data['name']??'', 'streetCode' => $data['streetCode']??'', 'address' => $data['address']??'', 'validateType' => $data['validateType']??0, 'sort' => $data['sort']??1, ]; return $this; } /** * @ 四、查询小区 */ public function getVillage($data=[]){ $this->url = "https://op.anjucloud.com/api/village/getVillage"; $this->arr = [ 'keyword' => $data['keyword']??'', 'pageNo' => $data['page']??1, 'pageSize' => $data['limit']??10, ]; return $this; } /** * @ 五、删除小区 */ public function deleteVillage($data=[]){ $this->url = "https://op.anjucloud.com/api/village/deleteVillage"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 六、修改小区 */ public function updateVillage($data=[]){ $this->url = "https://op.anjucloud.com/api/village/updateVillage"; $this->arr = [ 'id' => $data['id'], ]; if(!empty($data['name'])){ $this->arr['name'] = $data['name']; } if(!empty($data['streetCode'])){ $this->arr['streetCode'] = $data['streetCode']; } if(!empty($data['address'])){ $this->arr['address'] = $data['address']; } if(!empty($data['validateType'])){ $this->arr['validateType'] = $data['validateType']; } if(!empty($data['sort'])){ $this->arr['sort'] = $data['sort']; } return $this; } /** * @ 七、新增楼栋 */ public function addBuilding($data=[]){ $this->url = "https://op.anjucloud.com/api/village/addBuilding"; $this->arr = [ 'name' => $data['name']??'', 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 八、查询楼栋 */ public function getBuilding($data=[]){ $this->url = "https://op.anjucloud.com/api/village/getBuilding"; $this->arr = [ 'keyword' => $data['keyword']??'', 'villageId' => $data['villageId']??'', 'pageNo' => $data['page']??1, 'pageSize' => $data['limit']??10, ]; return $this; } /** * @ 九、删除楼栋 */ public function deleteBuilding($data=[]){ $this->url = "https://op.anjucloud.com/api/village/deleteBuilding"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 十、修改楼栋 */ public function updateBuilding($data=[]){ $this->url = "https://op.anjucloud.com/api/village/updateBuilding"; $this->arr = [ 'id' => $data['id']??'', 'name' => $data['name']??'', ]; return $this; } /** * @ 十一、新增单元 */ public function addUnit($data=[]){ $this->url = "https://op.anjucloud.com/api/village/addUnit"; $this->arr = [ 'name' => $data['name']??'', 'buildingId' => $data['buildingId']??'', ]; return $this; } /** * @ 十二、查询单元 */ public function getUnit($data=[]){ $this->url = "https://op.anjucloud.com/api/village/getUnit"; $this->arr = [ 'keyword' => $data['keyword']??'', 'villageId' => $data['villageId']??'', 'buildingId' => $data['buildingId']??'', 'pageNo' => $data['page']??'', 'pageSize' => $data['limit']??'', ]; return $this; } /** * @ 十三、删除单元 */ public function deleteUnit($data=[]){ $this->url = "https://op.anjucloud.com/api/village/deleteUnit"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 十四、修改单元 */ public function updateUnit($data=[]){ $this->url = "https://op.anjucloud.com/api/village/updateUnit"; $this->arr = [ 'id' => $data['id']??'', 'name' => $data['name']??'', ]; return $this; } /** * @ 十五、新增房屋 */ public function addHouse($data=[]){ $this->url = "https://op.anjucloud.com/api/village/addHouse"; $this->arr = [ 'name' => $data['name']??'', 'unitId' => $data['unitId']??'', ]; return $this; } /** * @ 十六、查询房屋 */ public function getHouse($data=[]){ $this->url = "https://op.anjucloud.com/api/village/getHouse"; $this->arr = [ 'keyword' => $data['keyword']??'', 'villageId' => $data['villageId']??'', 'buildingId' => $data['buildingId']??'', 'unitId' => $data['unitId']??'', 'pageNo' => $data['page']??'', 'pageSize' => $data['limit']??'', ]; return $this; } /** * @ 十七、删除房屋 */ public function deleteHouse($data=[]){ $this->url = "https://op.anjucloud.com/api/village/deleteHouse"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 十八、修改房屋 */ public function updateHouse($data=[]){ $this->url = "https://op.anjucloud.com/api/village/updateHouse"; $this->arr = [ 'id' => $data['id']??'', 'name' => $data['name']??'', ]; return $this; } /** * @ 二十二、新增小区用户 */ public function addUser($data=[]){ $this->url = "https://op.anjucloud.com/api/user/addUser"; $this->arr = [ 'mobile' => $data['mobile']??'', 'houseId' => $data['houseId']??'', 'name' => $data['name']??'', 'password' => $data['password']??'', ]; return $this; } /** * @ 二十三、查询小区用户 */ public function getUser($data=[]){ $this->url = "https://op.anjucloud.com/api/user/getUser"; $this->arr = [ 'keyword' => $data['keyword']??'', 'villageId' => $data['villageId']??'', 'buildingId' => $data['buildingId']??'', 'unitId' => $data['unitId']??'', 'houseId' => $data['houseId']??'', 'pageNo' => $data['page']??'', 'pageSize' => $data['limit']??'', ]; return $this; } /** * @ 二十四、删除小区用户 */ public function deleteUser($data=[]){ $this->url = "https://op.anjucloud.com/api/user/deleteUser"; $this->arr = [ 'id' => $data['id']??'', 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 二十五、修改小区用户 */ public function updateUser($data=[]){ $this->url = "https://op.anjucloud.com/api/user/updateUser"; $this->arr = [ 'id' => $data['id']??'', 'villageId' => $data['villageId']??'', 'name' => $data['name']??'', 'password' => $data['password']??'', 'houseId' => $data['houseId']??'', 'identity' => $data['identity']??'', 'pictureId' => $data['pictureId']??'', ]; return $this; } /** * @ 二十七、新增门-更新 */ public function addDoor($data=[]){ $this->url = "https://op.anjucloud.com/api/door/addDoor"; $this->arr = [ 'name' => $data['name']??'', 'sn' => $data['sn']??'', 'type' => $data['type']??3, 'unitId' => $data['unitId']??'', 'buildingId' => $data['buildingId']??'', 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 二十八、查询门 */ public function getDoor($data=[]){ $this->url = "https://op.anjucloud.com/api/door/getDoor"; $this->arr = [ 'keyword' => $data['sn']??'', 'villageId' => $data['villageId']??'', 'buildingId' => $data['buildingId']??'', 'unitId' => $data['unitId']??'', 'pageNo' => $data['page']??'', 'pageSize' => $data['limit']??'', ]; return $this; } /** * @ 二十九、删除门 */ public function deleteDoor($data=[]){ $this->url = "https://op.anjucloud.com/api/door/deleteDoor"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 三十、修改门 */ public function updateDoor($data=[]){ $this->url = "https://op.anjucloud.com/api/door/updateDoor"; $this->arr = [ 'id' => $data['id']??'', 'name' => $data['name']??'', 'type' => $data['type']??'', 'sn' => $data['sn']??'', 'code' => $data['code']??'', 'pictureId' => $data['pictureId']??'', 'villageId' => $data['villageId']??'', 'buildingId' => $data['buildingId']??'', 'unitId' => $data['unitId']??'', 'sort' => $data['sort']??'', 'address' => $data['address']??'', 'longitude' => $data['longitude']??'', 'latitude' => $data['latitude']??'', ]; return $this; } /** * @ 三十一、新增卡片 */ public function addCar($data=[]){ $this->url = "https://op.anjucloud.com/api/card/addCar"; $this->arr = [ 'villageId' => $data['villageId']??'', 'cardNo' => $data['cardNo']??'', ]; return $this; } /** * @ 三十二、查询卡片 */ public function getCard($data=[]){ $this->url = "https://op.anjucloud.com/api/card/getCard"; $this->arr = [ 'keyword' => $data['keyword']??'', 'villageId' => $data['villageId']??'', 'pageNo' => $data['page']??'', 'pageSize' => $data['limit']??'', ]; return $this; } /** * @ 三十三、删除卡片 */ public function deleteCard($data=[]){ $this->url = "https://op.anjucloud.com/api/card/deleteCard"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 三十四、新增监控 */ public function addDevice($data=[]){ $this->url = "https://op.anjucloud.com/api/device/addDevice"; $this->arr = [ 'name' => $data['name']??'', 'code' => $data['code']??'', 'chanNo' => $data['chanNo']??'', 'type' => $data['type']??'', 'villageId' => $data['villageId']??'', 'buildingId' => $data['buildingId']??'', 'unitId' => $data['unitId']??'', 'address' => $data['address']??'', 'sort' => $data['sort']??'', ]; return $this; } /** * @ 三十五、查询监控 */ public function getDevice($data=[]){ $this->url = "https://op.anjucloud.com/api/device/getDevice"; $this->arr = [ 'keyword' => $data['keyword']??'', 'villageId' => $data['villageId']??'', 'buildingId' => $data['buildingId']??'', 'unitId' => $data['unitId']??'', 'pageNo' => $data['page']??'', 'pageSize' => $data['limit']??'', ]; return $this; } /** * @ 三十六、删除监控 */ public function deleteDevice($data=[]){ $this->url = "https://op.anjucloud.com/api/device/deleteDevice"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 三十七、修改监控 */ public function updateDevice($data=[]){ $this->url = "https://op.anjucloud.com/api/device/updateDevice"; $this->arr = [ 'id' => $data['id']??'', 'name' => $data['name']??'', 'chanNo' => $data['chanNo']??'', 'type' => $data['type']??'', 'villageId' => $data['villageId']??'', 'buildingId' => $data['buildingId']??'', 'unitId' => $data['unitId']??'', 'address' => $data['address']??'', 'sort' => $data['sort']??'', ]; return $this; } /** * @ 三十八、查询门禁的监控配置 */ public function getdoorDevice($data=[]){ $this->url = "https://op.anjucloud.com/api/door/getDevice"; $this->arr = [ 'doorId' => $data['doorId']??'', ]; return $this; } /** * @ 三十九、设置门禁的监控配置-更新 */ public function assignDevice($data=[]){ $this->url = "https://op.anjucloud.com/api/door/assignDevice"; $this->arr = [ 'doorId' => $data['doorId']??'', 'style' => $data['style']??'', 'deviceIds' => $data['deviceIds']??'', ]; return $this; } /** * @ 四十、删除门禁的监控配置 */ public function deletedoorDevice($data=[]){ $this->url = "https://op.anjucloud.com/api/door/deleteDevice"; $this->arr = [ 'doorId' => $data['doorId']??'', ]; return $this; } /** * @ 四十一、获取用户的门禁权限 */ public function getassignDoor($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/getDoor"; $this->arr = [ 'userId' => $data['userId']??'', 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 四十二、分配用户的门禁权限 */ public function assignDoor($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/assignDoor"; $this->arr = [ 'userId' => $data['userId']??'', 'villageId' => $data['villageId']??'', 'doorIds' => $data['doorIds']??'', 'type' => $data['type']??'', ]; return $this; } /** * @ 四十三、获取用户的监控权限 */ public function getassignDevice($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/getDevice"; $this->arr = [ 'userId' => $data['userId']??'', 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 四十四、分配用户的监控权限 */ public function assignassignDevice($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/assignDevice"; $this->arr = [ 'userId' => $data['userId']??'', 'villageId' => $data['villageId']??'', 'deviceIds' => $data['deviceIds']??'', 'type' => $data['type']??'', ]; return $this; } /** * @ 四十五、获取小区的卡-更新 */ public function getassignCard($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/getCard"; $this->arr = [ 'villageId' => $data['villageId']??'', 'status' => $data['status']??'', 'type' => $data['type']??'', ]; return $this; } /** * @ 四十六、分配用户卡片 */ public function assignCard($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/assignCard"; $this->arr = [ 'villageId' => $data['villageId']??'', 'assignList' => $data['assignList']??'', ]; return $this; } /** * @ 四十七、获取用户已分配的卡 */ public function getassignAssignCard($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/getAssignCard"; $this->arr = [ 'villageId' => $data['villageId']??'', 'userId' => $data['userId']??'', ]; return $this; } /** * @ 四十八、解绑用户卡片-更新 */ public function assigndeleteCard($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/deleteCard"; $this->arr = [ 'id' => $data['id']??'', 'isForce' => $data['isForce']??'', ]; return $this; } /** * @ 四十九、获取小区的临时卡 */ public function getCardTemp($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/getCardTemp"; $this->arr = [ 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 五十、分配用户临时卡 */ public function assignCardTemp($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/assignCardTemp"; $this->arr = [ 'id' => $data['id']??'', 'userId' => $data['userId']??'', ]; return $this; } /** * @ 五十一、删除小区的临时卡 */ public function deleteCardTemp($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/deleteCardTemp"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 五十二、获取分配卡片记录 */ public function getAssignCardRecord($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/getAssignCardRecord"; $this->arr = [ 'villageId' => $data['villageId']??'', 'id' => $data['id']??'', 'pageNo' => $data['page']??'', 'pageSize' => $data['limit']??'', ]; return $this; } /** * @ 五十三、获取云盒信号 */ public function getDoorSignal($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/getDoorSignal"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 五十四、获取用户的门禁 */ public function getuserDoor($data=[]){ $this->url = "https://op.anjucloud.com/api/user/getDoor"; $this->arr = [ 'userId' => $data['userId']??'', 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 五十五、获取小区用户的卡片-更新 */ public function getuserCard($data=[]){ $this->url = "https://op.anjucloud.com/api/user/getCard"; $this->arr = [ 'userId' => $data['userId']??'', 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 五十六、开门 */ public function openDoor($data=[]){ $this->url = "https://op.anjucloud.com/api/user/openDoor"; $this->arr = [ 'userId' => $data['userId']??'', 'id' => $data['id']??'', ]; return $this; } /** * @ 五十七、获取开门记录 */ public function getOpenDoorRecord($data=[]){ $this->url = "https://op.anjucloud.com/api/user/getOpenDoorRecord"; $this->arr = [ 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 五十八、获取开门记录详情 */ public function getOpenDoorDetail($data=[]){ $this->url = "https://op.anjucloud.com/api/user/getOpenDoorDetail"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 五十九、获取开门记录资源 */ public function getOpenDoorResource($data=[]){ $this->url = "https://op.anjucloud.com/api/user/getOpenDoorResource"; $this->arr = [ 'id' => $data['id']??'', 'type' => $data['type']??'', ]; return $this; } /** * @ 六十、执行卡片下发 */ public function execute($data=[]){ $this->url = "https://op.anjucloud.com/api/assign/execute"; $this->arr = [ 'villageId' => $data['villageId']??'', ]; return $this; } /** * @ 六十一、获取开门二维码 */ public function getDoorQR($data=[]){ $this->url = "https://op.anjucloud.com/api/door/getDoorQR"; $this->arr = [ 'villageId' => $data['villageId']??'', 'doorIds' => $data['doorIds']??'', 'timeout' => strval($data['timeout']??''), 'userId' => $data['userId']??'', ]; return $this; } /** * @ 六十二、获取开门订阅 */ public function getPushConfigure($data=[]){ $this->url = "https://op.anjucloud.com/api/getPushConfigure"; $this->arr = []; return $this; } /** * @ 六十三、新增开门订阅 */ public function addPushConfigure($data=[]){ $this->url = "https://op.anjucloud.com/api/addPushConfigure"; $this->arr = [ 'pushUrl' => $data['pushUrl']??'', ]; return $this; } /** * @ 六十四、删除开门订阅 */ public function deletePushConfigure($data=[]){ $this->url = "https://op.anjucloud.com/api/deletePushConfigure"; $this->arr = [ 'id' => $data['id']??'', ]; return $this; } /** * @ 六十五、开关控制--新增 */ public function setBreaker($data=[]){ $this->url = "https://op.anjucloud.com/api/door/setBreaker"; $this->arr = [ 'id' => $data['id']??'', 'cmdType' => $data['cmdType']??'', ]; return $this; } public function returnMsg($code=400,$msg='',$data=[],$count=0){ return ['code'=>$code,'msg'=>$msg,'data'=>$data,'count'=>$count]; } // 获取数据 public function getData($call=''){ if(!empty($this->data)){ return $this->data; } if(empty($this->url)){ return $this->returnMsg(1,"请求错误"); } foreach ($this->arr as $key=>$val){ if(empty($val)){ unset($this->arr[$key]); } } $res = $this->post_url($this->url,http_build_query($this->arr),$this->access_token); if(empty($res)){ return $this->returnMsg(1,"请求失败"); } $data = json_decode($res,true); if(empty($data['result']) && $data['code'] != '00000'){ return $this->returnMsg(1,$data['msg'],$data); } if(isset($data['result']['list'])){ if(!empty($call)){ return $call($data['result']['list'],$data['result']['total']); } return $this->returnMsg(0,'success',$data['result']['list'],$data['result']['total']); }else{ if(!empty($call)){ return $call($data['result']); } return $this->returnMsg(0,'success',$data['result']); } } /** * 写入日志 */ public function insetLog($url,$arr,$return){ $obj = new XtOpenRequest(); $obj->url = $url; $obj->send_data = $arr; $obj->created_at = time(); $obj->return_data = $return; $obj->user_id = $this->user_id; if(!$obj->save()){ return 0; } return $obj->id; } /** * 模拟POST提交 * @param string $url 地址 * @param array|string $data 提交的数据 * @return string 返回结果 */ public function post_url($url, $data,$access_token='') { $curl = curl_init(); // 启动一个CURL会话 curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); // 对认证证书来源的检查 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); // 从证书中检查SSL加密算法是否存在 curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); // 模拟用户使用的浏览器 //curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 //curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer $header = [ 'ContentType:application/x-www-form-urlencoded;Charset=UTF-8', "access_token:{$access_token}", ]; curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求 curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包x curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制 防止死循环 curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 $tmpInfo = curl_exec($curl); // 执行操作 if(curl_errno($curl)) { return false; // echo 'Errno'.curl_error($curl);//捕抓异常 } $this->insetLog($url,$data,$tmpInfo); curl_close($curl); // 关闭CURL会话 return $tmpInfo; // 返回数据 } }