select("select * from news_column_list")->get(); dd($res); //宁煤洗选重复摄像头 //$this->xixuan_repeat(); //新接入摄像头接口测试 //$this->new_joggle(); //乐橙token // $this->token(); //乐橙直播列表 // $this->list(); //根据序列号获取直播地址和直播状态 // $this->address(); //区域下摄像头接口测试 // $this->camera_list(); //区域列表接口测试 // $this->mine_list(); } //区域列表接口测试 public function mine_list(){ $result = MineServices::getHaiKangArea(968, CameraEnum::REQUEST_TYPE_LOCAL); dd($result); } //区域下摄像头接口测试 public function camera_list(){ $result = CameraServices::getHaiKangCamera(968, '64018112582160000010', CameraEnum::CAMERA_TYPE_ALL); dd($result); } //直播列表 public function list(){ // At_0000bd7f06fa796842778d92b50d4d2d $url = 'https://openapi.lechange.cn/openapi/liveList'; //当前的UTC时间戳 $time= strtotime(date('Y-m-d H:i:s',time())); //随机字符串 $nonce = md5(time()); //授权信息之appid $appId='lc753b03152e3b4f1e'; //授权信息之appSecret $appSecret='cc9b1224acd24571a5daf18e8c7f94'; //拼接计算“签名原始串” $signStr="time:$time,nonce:$nonce,appSecret:$appSecret"; //计算摘要 sign $sign=md5($signStr); //业务参数 $params = [ 'token'=>'At_0000bd7f06fa796842778d92b50d4d2d', 'queryRange'=>"1-99" ]; //组装调用接口的body体内容 $data = json_encode([ 'system'=> [ 'ver'=>'1.0', 'sign'=>$sign, 'appId'=>$appId, 'time'=>$time, 'nonce'=>$nonce ], 'params'=>empty($params)? new \stdClass():$params, 'id'=>'88' ]); //http调用 $ret = $this->curl_post($data, $url); $utf8 = iconv('utf-8', 'UTF-8', $ret); //调用后返回输出 // dd(nl2br($utf8)); $aa = json_decode(nl2br($utf8), true); dd($aa['result']['data']); } //根据序列号获取直播地址和直播状态 public function address(){ // At_0000bd7f06fa796842778d92b50d4d2d $url = 'https://openapi.lechange.cn/openapi/getLiveStreamInfo'; //当前的UTC时间戳 $time= strtotime(date('Y-m-d H:i:s',time())); //随机字符串 $nonce = md5(time()); //授权信息之appid $appId='lc753b03152e3b4f1e'; //授权信息之appSecret $appSecret='cc9b1224acd24571a5daf18e8c7f94'; //拼接计算“签名原始串” $signStr="time:$time,nonce:$nonce,appSecret:$appSecret"; //计算摘要 sign $sign=md5($signStr); //业务参数 $params = [ 'token'=>'At_0000bd7f06fa796842778d92b50d4d2d', 'deviceId'=>'6J0C716PAZ6CF87', 'channelId'=>22 ]; //组装调用接口的body体内容 $data = json_encode([ 'system'=> [ 'ver'=>'1.0', 'sign'=>$sign, 'appId'=>$appId, 'time'=>$time, 'nonce'=>$nonce ], 'params'=>empty($params)? new \stdClass():$params, 'id'=>'88' ]); //http调用 $ret = $this->curl_post($data, $url); $utf8 = iconv('utf-8', 'UTF-8', $ret); //调用后返回输出 dd(nl2br($utf8 )); } public function token(){ // At_0000bd7f06fa796842778d92b50d4d2d $url = 'https://openapi.lechange.cn:443/openapi/accessToken'; //当前的UTC时间戳 $time= strtotime(date('Y-m-d H:i:s',time())); //随机字符串 $nonce = md5(time()); //授权信息之appid $appId='lc753b03152e3b4f1e'; //授权信息之appSecret $appSecret='cc9b1224acd24571a5daf18e8c7f94'; //拼接计算“签名原始串” $signStr="time:$time,nonce:$nonce,appSecret:$appSecret"; //计算摘要 sign $sign=md5($signStr); //业务参数 $params = []; //组装调用接口的body体内容 $data = json_encode([ 'system'=> [ 'ver'=>'1.0', 'sign'=>$sign, 'appId'=>$appId, 'time'=>$time, 'nonce'=>$nonce ], 'params'=>empty($params)? new \stdClass():$params, 'id'=>'88' ]); //http调用 $ret = $this->curl_post($data, $url); $utf8 = iconv('utf-8', 'UTF-8', $ret); //调用后返回输出 echo 'result:
'.nl2br($utf8 ).'
'; } function curl_post($data,$url) { $ch = curl_init(); $res= curl_setopt ($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($ch); curl_close($ch); if ($result == NULL) { return 0; } return $result; } //新接入摄像头接口测试 public function new_joggle(){ $mine_id_list = MineListExt::where('is_hak', 1)->pluck('mine_id')->all(); // dd($mine_id_list); $result = MineServices::getHaiKangArea(4569, CameraEnum::REQUEST_TYPE_LOCAL);//配合修改mineext和haikangcontroller里打印 dd($result); } //宁煤洗选重复摄像头 public function xixuan_repeat(){ $mine_all = DB::table('mine_list')->where('deleted_at',null)->get();//所有区域 //宁煤下各矿在离线数量 $mine_list = DB::table('mine_list')->where('parent_id',968)->where('deleted_at',null)->get(); $mine_use = [];//宁煤下每个矿所有区域 foreach($mine_all as $key=>$value){ if(count(explode('|',$value->degree)) > 1){ if(explode('|',$value->degree)[0] == 968 && explode('|',$value->degree)[1] == 2429){ $mine_use[] = $value->id; } } } $total = DB::table('camera_list') ->select('camera_list.camera_name','camera_list.camera_status','mine_list.title') ->leftJoin('mine_list','mine_list.id','=','camera_list.mine_id') ->whereIn('camera_list.mine_id',$mine_use) ->where('camera_list.deleted_at',null) ->where('mine_list.deleted_at',null) ->orderBy('mine_list.title') ->get(); // dd($total); $aa = []; foreach($total as $k=>$v){ $aa[] = $v->camera_name; } $unique_arr = array_unique ( $aa ); // dd($unique_arr); $repeat_arr = array_diff_assoc ( $aa, $unique_arr ); return $repeat_arr; } }