request->param("user_id"); $userim_res = $use_im->where('user_id',$user_id)->find(); $user_res = $user->where('id',$user_id)->find(); if(!empty($userim_res)){ $this->success('success',$userim_res['id']); } if(!empty($user_res)){ if(!empty($user_res['mobile'])){ $this->simulation($user_res['mobile']); $userim_res = $use_im->where('user_id',$user_id)->find(); $this->success('success',$userim_res['id']); } if(!empty($user_res['email'])){ $this->simulation($user_res['email']); $userim_res = $use_im->where('user_id',$user_id)->find(); $this->success('success',$userim_res['id']); } } } public function openim(){ $use_im = new Userim(); $uid1 = $this->request->param("uid1"); $uid2 = $this->request->param("uid2"); $userim_res1 = $use_im->where('id',$uid1)->find(); $userim_res2 = $use_im->where('id',$uid2)->find(); if(empty($userim_res1) || empty($userim_res2)) $this->error('chat fail'); // $message = new Message(); $common = new Common(); $res = $common->imSession('single',$uid1,$uid2); $this->success('success',$res); } public function get_imtoken(){ $use_im = new Userim(); $user = new UserModel(); $user_id = $this->request->param("user_id"); $user_res = $user->where('id',$user_id)->find(); // var_dump($user_id);exit; if(!empty($user_res)){ if(!empty($user_res['mobile'])){ $res = $this->simulation($user_res['mobile']); // var_dump($res);exit; // var_dump(json_decode($res,true));exit; // return json(json_decode($res,true)); // $userim_res = $use_im->where('user_id',$user_id)->find(); // $this->success('success',$userim_res['id']); }elseif(!empty($user_res['email'])){ $this->simulation($user_res['email']); // return json($res); // $userim_res = $use_im->where('user_id',$user_id)->find(); // $this->success('success',$userim_res['id']); } }else{ $this->error('empty user'); } } public function find_alluser(){ $user = new User(); $res = $user->where('id','<',0)->select(); // var_dump($res);exit; $sum = 0; foreach ($res as $val){ if(!empty($val['mobile'])){ $this->simulation($val['mobile']); }elseif(!empty($val['email'])){ $this->simulation($val['email']); }else{ $arr[] = $val; $sum++; // var_dump($val); } // var_dump($val['username']);exit; } var_dump($sum); exit; } public function simulation($account){ $url = "https://www.fpvone.cn/addons/fastim/api.user/logins";//你要请求的地址 $post_data = array( "captcha" => "6556", "captcha_id" => "d55d405fdc6a871ad0dcdc4fad5d582d", "account" => $account, "password" => "lunar5", ); $ch = curl_init();//初始化cURL curl_setopt($ch,CURLOPT_URL,$url);//抓取指定网页 curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);//要求结果为字符串并输出到屏幕上 curl_setopt($ch,CURLOPT_POST,1);//Post请求方式 curl_setopt($ch,CURLOPT_POSTFIELDS,$post_data);//Post变量 $output = curl_exec($ch);//执行并获得HTML内容 curl_close($ch);//释放cURL句柄 print_r($output); } }