participant = $array['participant']; $this->partner = $array['partner']; $container = new Container(); $this->sms = new Sms($container); } /** * Execute the job. * * @return void */ public function handle() { try { //添加一次分享 FruitHistory::create(['participant_id'=>$this->participant->id, 'participant_helper_id'=>$this->partner->id]); //更新分享缓存; $key = Participant::PART_SHARE_KEY; $key = $key.$this->participant->official_openid; $share_list = FruitHistory::where('participant_id', $this->participant->id)->with('participant_helper')->orderBy('id','desc')->get(); Cache::forever($key, $share_list); } catch (Exception $e) { //TODO通知管理员 $message = $e->getMessage(); $this->sms->sentMessage($mobile, $message); } } }