data = $data; $this->user_ids = $user_ids; } /** * Execute the job. * * @return void */ public function handle() { // dd($data); AssistantUser::insert($this->data); $content = ($this->data)[0]['content']; $body = ['msg'=>$content]; foreach ($this->user_ids as $user_id) { $other_user = User::find($user_id); if (empty($other_user)) { return; } //发送网易消息 //发送IM消息 $im_service = new IMService(env('IM_APP_KEY'), env('IM_APP_SECRET')); $result = $im_service->sendMsg(1, 0, $user_id,$type=0,$body,$option=array("push"=>false,"roam"=>true,"history"=>true,"sendersync"=>true, "route"=>false),$pushcontent=''); broadcast(new NoticeServer($other_user)); sleep(1); } } }